From 6f7c2bed089181bd30499770f32df80dbd7267e1 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 10 Jun 2024 23:44:00 +0000 Subject: [PATCH] chore!: promote AiPlatform to v1 --- .repo-metadata-full.json | 2 +- AiPlatform/.OwlBot.yaml | 4 +- AiPlatform/README.md | 5 +- AiPlatform/owlbot.py | 34 +- AiPlatform/src/V1/ActiveLearningConfig.php | 4 +- ...ddContextArtifactsAndExecutionsRequest.php | 2 +- .../src/V1/AddContextChildrenRequest.php | 2 +- .../src/V1/AddExecutionEventsRequest.php | 2 +- .../src/V1/AddTrialMeasurementRequest.php | 4 +- AiPlatform/src/V1/Annotation.php | 14 +- AiPlatform/src/V1/AnnotationSpec.php | 10 +- AiPlatform/src/V1/Artifact.php | 22 +- ...AssignNotebookRuntimeOperationMetadata.php | 4 +- .../src/V1/AssignNotebookRuntimeRequest.php | 8 +- AiPlatform/src/V1/Attribution.php | 20 +- AiPlatform/src/V1/AutomaticResources.php | 4 +- AiPlatform/src/V1/AutoscalingMetricSpec.php | 4 +- AiPlatform/src/V1/AvroSource.php | 2 +- ...tchCancelPipelineJobsOperationMetadata.php | 2 +- .../src/V1/BatchCancelPipelineJobsRequest.php | 2 +- .../BatchCreateFeaturesOperationMetadata.php | 2 +- .../src/V1/BatchCreateFeaturesRequest.php | 2 +- .../V1/BatchCreateTensorboardRunsRequest.php | 2 +- ...atchCreateTensorboardTimeSeriesRequest.php | 2 +- AiPlatform/src/V1/BatchDedicatedResources.php | 6 +- .../src/V1/BatchDeletePipelineJobsRequest.php | 2 +- ...BatchImportEvaluatedAnnotationsRequest.php | 2 +- ...atchImportEvaluatedAnnotationsResponse.php | 2 +- ...atchImportModelEvaluationSlicesRequest.php | 2 +- ...BatchMigrateResourcesOperationMetadata.php | 2 +- .../PartialResult.php | 2 +- .../src/V1/BatchMigrateResourcesRequest.php | 2 +- AiPlatform/src/V1/BatchPredictionJob.php | 50 +- .../src/V1/BatchPredictionJob/InputConfig.php | 2 +- .../V1/BatchPredictionJob/InstanceConfig.php | 4 +- .../V1/BatchPredictionJob/OutputConfig.php | 2 +- .../src/V1/BatchPredictionJob/OutputInfo.php | 2 +- ...atchReadFeatureValuesOperationMetadata.php | 2 +- .../src/V1/BatchReadFeatureValuesRequest.php | 6 +- .../EntityTypeSpec.php | 4 +- .../PassThroughField.php | 2 +- ...chReadTensorboardTimeSeriesDataRequest.php | 2 +- AiPlatform/src/V1/BigQueryDestination.php | 2 +- AiPlatform/src/V1/BigQuerySource.php | 2 +- AiPlatform/src/V1/Blob.php | 4 +- AiPlatform/src/V1/BlurBaselineConfig.php | 2 +- .../V1/CancelBatchPredictionJobRequest.php | 2 +- AiPlatform/src/V1/CancelCustomJobRequest.php | 2 +- .../src/V1/CancelDataLabelingJobRequest.php | 2 +- .../CancelHyperparameterTuningJobRequest.php | 2 +- AiPlatform/src/V1/CancelNasJobRequest.php | 2 +- .../src/V1/CancelPipelineJobRequest.php | 2 +- .../src/V1/CancelTrainingPipelineRequest.php | 2 +- AiPlatform/src/V1/CancelTuningJobRequest.php | 2 +- AiPlatform/src/V1/Candidate.php | 12 +- .../CheckTrialEarlyStoppingStateMetatdata.php | 6 +- .../CheckTrialEarlyStoppingStateRequest.php | 2 +- .../CheckTrialEarlyStoppingStateResponse.php | 2 +- AiPlatform/src/V1/Citation.php | 12 +- .../src/V1/Client/DatasetServiceClient.php | 79 +- .../DeploymentResourcePoolServiceClient.php | 71 +- .../src/V1/Client/EndpointServiceClient.php | 59 +- .../FeatureOnlineStoreAdminServiceClient.php | 95 +- .../FeatureOnlineStoreServiceClient.php | 35 +- .../Client/FeatureRegistryServiceClient.php | 71 +- ...FeaturestoreOnlineServingServiceClient.php | 44 +- .../V1/Client/FeaturestoreServiceClient.php | 77 +- .../V1/Client/GenAiTuningServiceClient.php | 26 +- .../V1/Client/IndexEndpointServiceClient.php | 37 +- .../src/V1/Client/IndexServiceClient.php | 49 +- AiPlatform/src/V1/Client/JobServiceClient.php | 191 +- .../src/V1/Client/LlmUtilityServiceClient.php | 20 +- .../src/V1/Client/MatchServiceClient.php | 18 +- .../src/V1/Client/MetadataServiceClient.php | 111 +- .../src/V1/Client/MigrationServiceClient.php | 49 +- .../V1/Client/ModelGardenServiceClient.php | 12 +- .../src/V1/Client/ModelServiceClient.php | 104 +- .../src/V1/Client/NotebookServiceClient.php | 102 +- .../PersistentResourceServiceClient.php | 74 +- .../src/V1/Client/PipelineServiceClient.php | 99 +- .../src/V1/Client/PredictionServiceClient.php | 22 +- .../src/V1/Client/ScheduleServiceClient.php | 61 +- .../V1/Client/SpecialistPoolServiceClient.php | 55 +- .../V1/Client/TensorboardServiceClient.php | 186 +- .../src/V1/Client/VizierServiceClient.php | 49 +- AiPlatform/src/V1/CompleteTrialRequest.php | 8 +- AiPlatform/src/V1/CompletionStats.php | 8 +- AiPlatform/src/V1/ComputeTokensRequest.php | 2 +- .../src/V1/ContainerRegistryDestination.php | 2 +- AiPlatform/src/V1/ContainerSpec.php | 2 +- AiPlatform/src/V1/Content.php | 2 +- AiPlatform/src/V1/Context.php | 18 +- .../src/V1/CopyModelOperationMetadata.php | 2 +- AiPlatform/src/V1/CopyModelRequest.php | 6 +- AiPlatform/src/V1/CopyModelResponse.php | 4 +- AiPlatform/src/V1/CountTokensRequest.php | 4 +- AiPlatform/src/V1/CountTokensResponse.php | 4 +- AiPlatform/src/V1/CreateArtifactRequest.php | 6 +- .../V1/CreateBatchPredictionJobRequest.php | 4 +- AiPlatform/src/V1/CreateContextRequest.php | 6 +- AiPlatform/src/V1/CreateCustomJobRequest.php | 4 +- .../src/V1/CreateDataLabelingJobRequest.php | 4 +- .../src/V1/CreateDatasetOperationMetadata.php | 2 +- AiPlatform/src/V1/CreateDatasetRequest.php | 4 +- .../CreateDatasetVersionOperationMetadata.php | 2 +- .../src/V1/CreateDatasetVersionRequest.php | 4 +- ...eploymentResourcePoolOperationMetadata.php | 2 +- .../CreateDeploymentResourcePoolRequest.php | 6 +- .../V1/CreateEndpointOperationMetadata.php | 2 +- AiPlatform/src/V1/CreateEndpointRequest.php | 6 +- .../V1/CreateEntityTypeOperationMetadata.php | 2 +- AiPlatform/src/V1/CreateEntityTypeRequest.php | 6 +- AiPlatform/src/V1/CreateExecutionRequest.php | 6 +- .../CreateFeatureGroupOperationMetadata.php | 2 +- .../src/V1/CreateFeatureGroupRequest.php | 6 +- ...ateFeatureOnlineStoreOperationMetadata.php | 2 +- .../V1/CreateFeatureOnlineStoreRequest.php | 6 +- .../src/V1/CreateFeatureOperationMetadata.php | 2 +- AiPlatform/src/V1/CreateFeatureRequest.php | 6 +- .../V1/CreateFeatureViewOperationMetadata.php | 2 +- .../src/V1/CreateFeatureViewRequest.php | 8 +- .../CreateFeaturestoreOperationMetadata.php | 2 +- .../src/V1/CreateFeaturestoreRequest.php | 6 +- .../CreateHyperparameterTuningJobRequest.php | 4 +- .../CreateIndexEndpointOperationMetadata.php | 2 +- .../src/V1/CreateIndexEndpointRequest.php | 4 +- .../src/V1/CreateIndexOperationMetadata.php | 4 +- AiPlatform/src/V1/CreateIndexRequest.php | 4 +- .../src/V1/CreateMetadataSchemaRequest.php | 6 +- .../CreateMetadataStoreOperationMetadata.php | 2 +- .../src/V1/CreateMetadataStoreRequest.php | 6 +- ...ateModelDeploymentMonitoringJobRequest.php | 4 +- AiPlatform/src/V1/CreateNasJobRequest.php | 4 +- ...tebookRuntimeTemplateOperationMetadata.php | 2 +- .../CreateNotebookRuntimeTemplateRequest.php | 6 +- ...atePersistentResourceOperationMetadata.php | 4 +- .../V1/CreatePersistentResourceRequest.php | 6 +- .../src/V1/CreatePipelineJobRequest.php | 6 +- ...CreateRegistryFeatureOperationMetadata.php | 2 +- AiPlatform/src/V1/CreateScheduleRequest.php | 4 +- .../CreateSpecialistPoolOperationMetadata.php | 2 +- .../src/V1/CreateSpecialistPoolRequest.php | 4 +- AiPlatform/src/V1/CreateStudyRequest.php | 4 +- .../V1/CreateTensorboardExperimentRequest.php | 6 +- .../V1/CreateTensorboardOperationMetadata.php | 2 +- .../src/V1/CreateTensorboardRequest.php | 4 +- .../src/V1/CreateTensorboardRunRequest.php | 6 +- .../V1/CreateTensorboardTimeSeriesRequest.php | 6 +- .../src/V1/CreateTrainingPipelineRequest.php | 4 +- AiPlatform/src/V1/CreateTrialRequest.php | 4 +- AiPlatform/src/V1/CreateTuningJobRequest.php | 4 +- AiPlatform/src/V1/CsvDestination.php | 2 +- AiPlatform/src/V1/CsvSource.php | 2 +- AiPlatform/src/V1/CustomJob.php | 20 +- AiPlatform/src/V1/CustomJobSpec.php | 38 +- AiPlatform/src/V1/DataItem.php | 10 +- AiPlatform/src/V1/DataItemView.php | 4 +- AiPlatform/src/V1/DataLabelingJob.php | 28 +- AiPlatform/src/V1/Dataset.php | 24 +- AiPlatform/src/V1/DatasetServiceClient.php | 34 - .../src/V1/DatasetServiceGrpcClient.php | 216 - AiPlatform/src/V1/DatasetVersion.php | 16 +- AiPlatform/src/V1/DedicatedResources.php | 6 +- AiPlatform/src/V1/DeleteArtifactRequest.php | 4 +- .../V1/DeleteBatchPredictionJobRequest.php | 2 +- AiPlatform/src/V1/DeleteContextRequest.php | 6 +- AiPlatform/src/V1/DeleteCustomJobRequest.php | 2 +- .../src/V1/DeleteDataLabelingJobRequest.php | 2 +- AiPlatform/src/V1/DeleteDatasetRequest.php | 2 +- .../src/V1/DeleteDatasetVersionRequest.php | 2 +- .../DeleteDeploymentResourcePoolRequest.php | 2 +- AiPlatform/src/V1/DeleteEndpointRequest.php | 2 +- AiPlatform/src/V1/DeleteEntityTypeRequest.php | 4 +- AiPlatform/src/V1/DeleteExecutionRequest.php | 4 +- .../src/V1/DeleteFeatureGroupRequest.php | 4 +- .../V1/DeleteFeatureOnlineStoreRequest.php | 4 +- AiPlatform/src/V1/DeleteFeatureRequest.php | 2 +- .../DeleteFeatureValuesOperationMetadata.php | 2 +- .../src/V1/DeleteFeatureValuesRequest.php | 2 +- .../SelectEntity.php | 2 +- .../SelectTimeRangeAndFeature.php | 6 +- .../SelectEntity.php | 4 +- .../SelectTimeRangeAndFeature.php | 6 +- .../src/V1/DeleteFeatureViewRequest.php | 2 +- .../src/V1/DeleteFeaturestoreRequest.php | 4 +- .../DeleteHyperparameterTuningJobRequest.php | 2 +- .../src/V1/DeleteIndexEndpointRequest.php | 2 +- AiPlatform/src/V1/DeleteIndexRequest.php | 2 +- .../DeleteMetadataStoreOperationMetadata.php | 2 +- .../src/V1/DeleteMetadataStoreRequest.php | 2 +- ...eteModelDeploymentMonitoringJobRequest.php | 2 +- AiPlatform/src/V1/DeleteModelRequest.php | 2 +- .../src/V1/DeleteModelVersionRequest.php | 2 +- AiPlatform/src/V1/DeleteNasJobRequest.php | 2 +- .../src/V1/DeleteNotebookRuntimeRequest.php | 2 +- .../DeleteNotebookRuntimeTemplateRequest.php | 2 +- AiPlatform/src/V1/DeleteOperationMetadata.php | 2 +- .../V1/DeletePersistentResourceRequest.php | 2 +- .../src/V1/DeletePipelineJobRequest.php | 2 +- AiPlatform/src/V1/DeleteSavedQueryRequest.php | 2 +- AiPlatform/src/V1/DeleteScheduleRequest.php | 2 +- .../src/V1/DeleteSpecialistPoolRequest.php | 4 +- AiPlatform/src/V1/DeleteStudyRequest.php | 2 +- .../V1/DeleteTensorboardExperimentRequest.php | 2 +- .../src/V1/DeleteTensorboardRequest.php | 2 +- .../src/V1/DeleteTensorboardRunRequest.php | 2 +- .../V1/DeleteTensorboardTimeSeriesRequest.php | 2 +- .../src/V1/DeleteTrainingPipelineRequest.php | 2 +- AiPlatform/src/V1/DeleteTrialRequest.php | 2 +- .../src/V1/DeployIndexOperationMetadata.php | 4 +- AiPlatform/src/V1/DeployIndexRequest.php | 4 +- AiPlatform/src/V1/DeployIndexResponse.php | 2 +- .../src/V1/DeployModelOperationMetadata.php | 2 +- AiPlatform/src/V1/DeployModelRequest.php | 4 +- AiPlatform/src/V1/DeployModelResponse.php | 2 +- AiPlatform/src/V1/DeployedIndex.php | 22 +- AiPlatform/src/V1/DeployedIndexAuthConfig.php | 2 +- AiPlatform/src/V1/DeployedIndexRef.php | 6 +- AiPlatform/src/V1/DeployedModel.php | 22 +- AiPlatform/src/V1/DeployedModelRef.php | 4 +- AiPlatform/src/V1/DeploymentResourcePool.php | 12 +- .../DeploymentResourcePoolServiceClient.php | 34 - .../src/V1/DestinationFeatureSetting.php | 4 +- AiPlatform/src/V1/DirectPredictRequest.php | 4 +- AiPlatform/src/V1/DirectPredictResponse.php | 2 +- AiPlatform/src/V1/DirectRawPredictRequest.php | 6 +- .../src/V1/DirectRawPredictResponse.php | 2 +- AiPlatform/src/V1/DiskSpec.php | 4 +- AiPlatform/src/V1/EncryptionSpec.php | 2 +- AiPlatform/src/V1/Endpoint.php | 22 +- AiPlatform/src/V1/EndpointServiceClient.php | 34 - .../src/V1/EndpointServiceGrpcClient.php | 159 - AiPlatform/src/V1/EntityIdSelector.php | 2 +- AiPlatform/src/V1/EntityType.php | 14 +- AiPlatform/src/V1/EnvVar.php | 4 +- AiPlatform/src/V1/ErrorAnalysisAnnotation.php | 6 +- .../AttributedItem.php | 4 +- AiPlatform/src/V1/EvaluatedAnnotation.php | 6 +- .../src/V1/EvaluatedAnnotationExplanation.php | 4 +- AiPlatform/src/V1/Event.php | 8 +- AiPlatform/src/V1/Examples.php | 2 +- .../src/V1/Examples/ExampleGcsSource.php | 4 +- AiPlatform/src/V1/ExamplesOverride.php | 8 +- .../src/V1/ExamplesRestrictionsNamespace.php | 2 +- AiPlatform/src/V1/Execution.php | 20 +- AiPlatform/src/V1/ExplainRequest.php | 8 +- AiPlatform/src/V1/ExplainResponse.php | 2 +- AiPlatform/src/V1/ExplanationMetadata.php | 4 +- .../V1/ExplanationMetadata/InputMetadata.php | 18 +- .../InputMetadata/FeatureValueDomain.php | 8 +- .../InputMetadata/Visualization.php | 12 +- .../V1/ExplanationMetadata/OutputMetadata.php | 2 +- AiPlatform/src/V1/ExplanationParameters.php | 4 +- AiPlatform/src/V1/ExplanationSpec.php | 4 +- AiPlatform/src/V1/ExplanationSpecOverride.php | 6 +- AiPlatform/src/V1/ExportDataConfig.php | 8 +- .../src/V1/ExportDataOperationMetadata.php | 4 +- AiPlatform/src/V1/ExportDataRequest.php | 4 +- AiPlatform/src/V1/ExportDataResponse.php | 2 +- .../ExportFeatureValuesOperationMetadata.php | 2 +- .../src/V1/ExportFeatureValuesRequest.php | 6 +- .../ExportFeatureValuesRequest/FullExport.php | 4 +- .../SnapshotExport.php | 4 +- AiPlatform/src/V1/ExportFilterSplit.php | 6 +- AiPlatform/src/V1/ExportFractionSplit.php | 6 +- .../src/V1/ExportModelOperationMetadata.php | 4 +- .../OutputInfo.php | 4 +- AiPlatform/src/V1/ExportModelRequest.php | 4 +- .../V1/ExportModelRequest/OutputConfig.php | 6 +- ...ExportTensorboardTimeSeriesDataRequest.php | 10 +- ...xportTensorboardTimeSeriesDataResponse.php | 2 +- AiPlatform/src/V1/Feature.php | 18 +- .../src/V1/Feature/MonitoringStatsAnomaly.php | 4 +- AiPlatform/src/V1/FeatureGroup.php | 10 +- AiPlatform/src/V1/FeatureGroup/BigQuery.php | 2 +- .../NoiseSigmaForFeature.php | 4 +- AiPlatform/src/V1/FeatureOnlineStore.php | 14 +- .../src/V1/FeatureOnlineStore/Bigtable.php | 2 +- .../Bigtable/AutoScaling.php | 6 +- .../DedicatedServingEndpoint.php | 2 +- .../FeatureOnlineStoreAdminServiceClient.php | 34 - .../V1/FeatureOnlineStoreServiceClient.php | 34 - .../src/V1/FeatureRegistryServiceClient.php | 34 - AiPlatform/src/V1/FeatureSelector.php | 2 +- AiPlatform/src/V1/FeatureStatsAnomaly.php | 14 +- AiPlatform/src/V1/FeatureValue.php | 2 +- AiPlatform/src/V1/FeatureValue/Metadata.php | 2 +- AiPlatform/src/V1/FeatureView.php | 12 +- .../src/V1/FeatureView/BigQuerySource.php | 2 +- .../V1/FeatureView/FeatureRegistrySource.php | 2 +- .../FeatureRegistrySource/FeatureGroup.php | 2 +- AiPlatform/src/V1/FeatureView/IndexConfig.php | 8 +- .../FeatureView/IndexConfig/TreeAHConfig.php | 2 +- AiPlatform/src/V1/FeatureView/SyncConfig.php | 2 +- AiPlatform/src/V1/FeatureViewSync.php | 10 +- .../src/V1/FeatureViewSync/SyncSummary.php | 4 +- AiPlatform/src/V1/Featurestore.php | 16 +- .../V1/Featurestore/OnlineServingConfig.php | 4 +- .../OnlineServingConfig/Scaling.php | 6 +- .../src/V1/FeaturestoreMonitoringConfig.php | 8 +- .../ImportFeaturesAnalysis.php | 4 +- .../SnapshotAnalysis.php | 6 +- ...FeaturestoreOnlineServingServiceClient.php | 34 - ...urestoreOnlineServingServiceGrpcClient.php | 88 - .../src/V1/FeaturestoreServiceClient.php | 34 - .../src/V1/FeaturestoreServiceGrpcClient.php | 385 -- .../src/V1/FetchFeatureValuesRequest.php | 6 +- .../src/V1/FetchFeatureValuesResponse.php | 2 +- .../FeatureNameValuePair.php | 2 +- AiPlatform/src/V1/FileData.php | 4 +- AiPlatform/src/V1/FilterSplit.php | 6 +- AiPlatform/src/V1/FindNeighborsRequest.php | 6 +- .../src/V1/FindNeighborsRequest/Query.php | 10 +- .../src/V1/FindNeighborsRequest/Query/RRF.php | 2 +- .../NearestNeighbors.php | 2 +- .../src/V1/FindNeighborsResponse/Neighbor.php | 6 +- AiPlatform/src/V1/FractionSplit.php | 6 +- AiPlatform/src/V1/FunctionCall.php | 4 +- AiPlatform/src/V1/FunctionCallingConfig.php | 2 +- AiPlatform/src/V1/FunctionDeclaration.php | 6 +- AiPlatform/src/V1/FunctionResponse.php | 4 +- .../V1/Gapic/DatasetServiceGapicClient.php | 2472 ----------- ...ploymentResourcePoolServiceGapicClient.php | 1129 ----- .../V1/Gapic/EndpointServiceGapicClient.php | 1631 ------- ...tureOnlineStoreAdminServiceGapicClient.php | 1884 -------- .../FeatureOnlineStoreServiceGapicClient.php | 756 ---- .../FeatureRegistryServiceGapicClient.php | 1775 -------- ...restoreOnlineServingServiceGapicClient.php | 829 ---- .../Gapic/FeaturestoreServiceGapicClient.php | 2990 ------------- .../Gapic/GenAiTuningServiceGapicClient.php | 1084 ----- .../Gapic/IndexEndpointServiceGapicClient.php | 1374 ------ .../src/V1/Gapic/IndexServiceGapicClient.php | 1256 ------ .../src/V1/Gapic/JobServiceGapicClient.php | 3852 ----------------- .../V1/Gapic/LlmUtilityServiceGapicClient.php | 820 ---- .../src/V1/Gapic/MatchServiceGapicClient.php | 762 ---- .../V1/Gapic/MetadataServiceGapicClient.php | 3302 -------------- .../V1/Gapic/MigrationServiceGapicClient.php | 1002 ----- .../Gapic/ModelGardenServiceGapicClient.php | 676 --- .../src/V1/Gapic/ModelServiceGapicClient.php | 2396 ---------- .../V1/Gapic/NotebookServiceGapicClient.php | 1740 -------- .../PersistentResourceServiceGapicClient.php | 1206 ------ .../V1/Gapic/PipelineServiceGapicClient.php | 2053 --------- .../V1/Gapic/PredictionServiceGapicClient.php | 1699 -------- .../V1/Gapic/ScheduleServiceGapicClient.php | 1445 ------- .../SpecialistPoolServiceGapicClient.php | 1102 ----- .../Gapic/TensorboardServiceGapicClient.php | 2943 ------------- .../src/V1/Gapic/VizierServiceGapicClient.php | 1735 -------- AiPlatform/src/V1/GcsDestination.php | 2 +- .../src/V1/GenAiTuningServiceClient.php | 34 - AiPlatform/src/V1/GenerateContentRequest.php | 8 +- AiPlatform/src/V1/GenerateContentResponse.php | 4 +- .../PromptFeedback.php | 4 +- .../GenerateContentResponse/UsageMetadata.php | 6 +- AiPlatform/src/V1/GenerationConfig.php | 18 +- .../src/V1/GenericOperationMetadata.php | 4 +- AiPlatform/src/V1/GenieSource.php | 2 +- .../src/V1/GetAnnotationSpecRequest.php | 4 +- AiPlatform/src/V1/GetArtifactRequest.php | 2 +- .../src/V1/GetBatchPredictionJobRequest.php | 2 +- AiPlatform/src/V1/GetContextRequest.php | 2 +- AiPlatform/src/V1/GetCustomJobRequest.php | 2 +- .../src/V1/GetDataLabelingJobRequest.php | 2 +- AiPlatform/src/V1/GetDatasetRequest.php | 4 +- .../src/V1/GetDatasetVersionRequest.php | 4 +- .../V1/GetDeploymentResourcePoolRequest.php | 2 +- AiPlatform/src/V1/GetEndpointRequest.php | 2 +- AiPlatform/src/V1/GetEntityTypeRequest.php | 2 +- AiPlatform/src/V1/GetExecutionRequest.php | 2 +- AiPlatform/src/V1/GetFeatureGroupRequest.php | 2 +- .../src/V1/GetFeatureOnlineStoreRequest.php | 2 +- AiPlatform/src/V1/GetFeatureRequest.php | 2 +- AiPlatform/src/V1/GetFeatureViewRequest.php | 2 +- .../src/V1/GetFeatureViewSyncRequest.php | 2 +- AiPlatform/src/V1/GetFeaturestoreRequest.php | 2 +- .../V1/GetHyperparameterTuningJobRequest.php | 2 +- AiPlatform/src/V1/GetIndexEndpointRequest.php | 2 +- AiPlatform/src/V1/GetIndexRequest.php | 2 +- .../src/V1/GetMetadataSchemaRequest.php | 2 +- AiPlatform/src/V1/GetMetadataStoreRequest.php | 2 +- ...GetModelDeploymentMonitoringJobRequest.php | 2 +- .../src/V1/GetModelEvaluationRequest.php | 2 +- .../src/V1/GetModelEvaluationSliceRequest.php | 2 +- AiPlatform/src/V1/GetModelRequest.php | 2 +- AiPlatform/src/V1/GetNasJobRequest.php | 2 +- .../src/V1/GetNasTrialDetailRequest.php | 2 +- .../src/V1/GetNotebookRuntimeRequest.php | 2 +- .../V1/GetNotebookRuntimeTemplateRequest.php | 2 +- .../src/V1/GetPersistentResourceRequest.php | 2 +- AiPlatform/src/V1/GetPipelineJobRequest.php | 2 +- .../src/V1/GetPublisherModelRequest.php | 6 +- AiPlatform/src/V1/GetScheduleRequest.php | 2 +- .../src/V1/GetSpecialistPoolRequest.php | 2 +- AiPlatform/src/V1/GetStudyRequest.php | 2 +- .../V1/GetTensorboardExperimentRequest.php | 2 +- AiPlatform/src/V1/GetTensorboardRequest.php | 2 +- .../src/V1/GetTensorboardRunRequest.php | 2 +- .../V1/GetTensorboardTimeSeriesRequest.php | 2 +- .../src/V1/GetTrainingPipelineRequest.php | 2 +- AiPlatform/src/V1/GetTrialRequest.php | 2 +- AiPlatform/src/V1/GetTuningJobRequest.php | 2 +- AiPlatform/src/V1/GroundingAttribution.php | 167 - .../src/V1/GroundingAttribution/Web.php | 102 - AiPlatform/src/V1/GroundingMetadata.php | 2 +- AiPlatform/src/V1/HyperparameterTuningJob.php | 28 +- AiPlatform/src/V1/ImportDataConfig.php | 2 +- .../src/V1/ImportDataOperationMetadata.php | 2 +- AiPlatform/src/V1/ImportDataRequest.php | 2 +- .../ImportFeatureValuesOperationMetadata.php | 10 +- .../src/V1/ImportFeatureValuesRequest.php | 10 +- .../FeatureSpec.php | 4 +- .../src/V1/ImportFeatureValuesResponse.php | 8 +- .../src/V1/ImportModelEvaluationRequest.php | 4 +- AiPlatform/src/V1/Index.php | 22 +- AiPlatform/src/V1/IndexDatapoint.php | 6 +- .../src/V1/IndexDatapoint/CrowdingTag.php | 2 +- .../V1/IndexDatapoint/NumericRestriction.php | 4 +- .../src/V1/IndexDatapoint/Restriction.php | 2 +- AiPlatform/src/V1/IndexEndpoint.php | 22 +- .../src/V1/IndexEndpointServiceClient.php | 34 - .../src/V1/IndexEndpointServiceGrpcClient.php | 158 - AiPlatform/src/V1/IndexPrivateEndpoints.php | 4 +- AiPlatform/src/V1/IndexServiceClient.php | 34 - AiPlatform/src/V1/IndexServiceGrpcClient.php | 143 - AiPlatform/src/V1/IndexStats.php | 6 +- AiPlatform/src/V1/InputDataConfig.php | 10 +- .../src/V1/IntegratedGradientsAttribution.php | 6 +- AiPlatform/src/V1/JobServiceClient.php | 34 - AiPlatform/src/V1/JobServiceGrpcClient.php | 617 --- AiPlatform/src/V1/LargeModelReference.php | 2 +- AiPlatform/src/V1/ListAnnotationsRequest.php | 12 +- AiPlatform/src/V1/ListAnnotationsResponse.php | 2 +- AiPlatform/src/V1/ListArtifactsRequest.php | 10 +- AiPlatform/src/V1/ListArtifactsResponse.php | 2 +- .../src/V1/ListBatchPredictionJobsRequest.php | 10 +- .../V1/ListBatchPredictionJobsResponse.php | 2 +- AiPlatform/src/V1/ListContextsRequest.php | 10 +- AiPlatform/src/V1/ListContextsResponse.php | 2 +- AiPlatform/src/V1/ListCustomJobsRequest.php | 10 +- AiPlatform/src/V1/ListCustomJobsResponse.php | 2 +- AiPlatform/src/V1/ListDataItemsRequest.php | 12 +- AiPlatform/src/V1/ListDataItemsResponse.php | 2 +- .../src/V1/ListDataLabelingJobsRequest.php | 12 +- .../src/V1/ListDataLabelingJobsResponse.php | 2 +- .../src/V1/ListDatasetVersionsRequest.php | 12 +- .../src/V1/ListDatasetVersionsResponse.php | 2 +- AiPlatform/src/V1/ListDatasetsRequest.php | 12 +- AiPlatform/src/V1/ListDatasetsResponse.php | 2 +- .../V1/ListDeploymentResourcePoolsRequest.php | 6 +- .../ListDeploymentResourcePoolsResponse.php | 2 +- AiPlatform/src/V1/ListEndpointsRequest.php | 12 +- AiPlatform/src/V1/ListEndpointsResponse.php | 2 +- AiPlatform/src/V1/ListEntityTypesRequest.php | 12 +- AiPlatform/src/V1/ListEntityTypesResponse.php | 2 +- AiPlatform/src/V1/ListExecutionsRequest.php | 10 +- AiPlatform/src/V1/ListExecutionsResponse.php | 2 +- .../src/V1/ListFeatureGroupsRequest.php | 10 +- .../src/V1/ListFeatureGroupsResponse.php | 2 +- .../src/V1/ListFeatureOnlineStoresRequest.php | 10 +- .../V1/ListFeatureOnlineStoresResponse.php | 2 +- .../src/V1/ListFeatureViewSyncsRequest.php | 10 +- .../src/V1/ListFeatureViewSyncsResponse.php | 2 +- AiPlatform/src/V1/ListFeatureViewsRequest.php | 10 +- .../src/V1/ListFeatureViewsResponse.php | 2 +- AiPlatform/src/V1/ListFeaturesRequest.php | 14 +- AiPlatform/src/V1/ListFeaturesResponse.php | 2 +- .../src/V1/ListFeaturestoresRequest.php | 12 +- .../src/V1/ListFeaturestoresResponse.php | 2 +- .../ListHyperparameterTuningJobsRequest.php | 10 +- .../ListHyperparameterTuningJobsResponse.php | 2 +- .../src/V1/ListIndexEndpointsRequest.php | 10 +- .../src/V1/ListIndexEndpointsResponse.php | 2 +- AiPlatform/src/V1/ListIndexesRequest.php | 10 +- AiPlatform/src/V1/ListIndexesResponse.php | 2 +- .../src/V1/ListMetadataSchemasRequest.php | 8 +- .../src/V1/ListMetadataSchemasResponse.php | 2 +- .../src/V1/ListMetadataStoresRequest.php | 6 +- .../src/V1/ListMetadataStoresResponse.php | 2 +- ...stModelDeploymentMonitoringJobsRequest.php | 10 +- ...tModelDeploymentMonitoringJobsResponse.php | 2 +- .../V1/ListModelEvaluationSlicesRequest.php | 10 +- .../V1/ListModelEvaluationSlicesResponse.php | 2 +- .../src/V1/ListModelEvaluationsRequest.php | 10 +- .../src/V1/ListModelEvaluationsResponse.php | 2 +- .../src/V1/ListModelVersionsRequest.php | 12 +- .../src/V1/ListModelVersionsResponse.php | 2 +- AiPlatform/src/V1/ListModelsRequest.php | 12 +- AiPlatform/src/V1/ListModelsResponse.php | 2 +- AiPlatform/src/V1/ListNasJobsRequest.php | 10 +- AiPlatform/src/V1/ListNasJobsResponse.php | 2 +- .../src/V1/ListNasTrialDetailsRequest.php | 6 +- .../src/V1/ListNasTrialDetailsResponse.php | 2 +- .../ListNotebookRuntimeTemplatesRequest.php | 12 +- .../ListNotebookRuntimeTemplatesResponse.php | 2 +- .../src/V1/ListNotebookRuntimesRequest.php | 12 +- .../src/V1/ListNotebookRuntimesResponse.php | 2 +- .../src/V1/ListOptimalTrialsRequest.php | 2 +- .../src/V1/ListPersistentResourcesRequest.php | 6 +- .../V1/ListPersistentResourcesResponse.php | 2 +- AiPlatform/src/V1/ListPipelineJobsRequest.php | 12 +- .../src/V1/ListPipelineJobsResponse.php | 2 +- AiPlatform/src/V1/ListSavedQueriesRequest.php | 12 +- .../src/V1/ListSavedQueriesResponse.php | 2 +- AiPlatform/src/V1/ListSchedulesRequest.php | 10 +- AiPlatform/src/V1/ListSchedulesResponse.php | 2 +- .../src/V1/ListSpecialistPoolsRequest.php | 8 +- .../src/V1/ListSpecialistPoolsResponse.php | 2 +- AiPlatform/src/V1/ListStudiesRequest.php | 6 +- AiPlatform/src/V1/ListStudiesResponse.php | 2 +- .../V1/ListTensorboardExperimentsRequest.php | 12 +- .../V1/ListTensorboardExperimentsResponse.php | 2 +- .../src/V1/ListTensorboardRunsRequest.php | 12 +- .../src/V1/ListTensorboardRunsResponse.php | 2 +- .../V1/ListTensorboardTimeSeriesRequest.php | 12 +- .../V1/ListTensorboardTimeSeriesResponse.php | 2 +- AiPlatform/src/V1/ListTensorboardsRequest.php | 12 +- .../src/V1/ListTensorboardsResponse.php | 2 +- .../src/V1/ListTrainingPipelinesRequest.php | 10 +- .../src/V1/ListTrainingPipelinesResponse.php | 2 +- AiPlatform/src/V1/ListTrialsRequest.php | 6 +- AiPlatform/src/V1/ListTrialsResponse.php | 2 +- AiPlatform/src/V1/ListTuningJobsRequest.php | 8 +- AiPlatform/src/V1/ListTuningJobsResponse.php | 2 +- AiPlatform/src/V1/LlmUtilityServiceClient.php | 34 - AiPlatform/src/V1/LookupStudyRequest.php | 4 +- AiPlatform/src/V1/MachineSpec.php | 8 +- .../src/V1/ManualBatchTuningParameters.php | 2 +- AiPlatform/src/V1/MatchServiceClient.php | 34 - AiPlatform/src/V1/MatchServiceGrpcClient.php | 67 - AiPlatform/src/V1/Measurement.php | 4 +- AiPlatform/src/V1/Measurement/Metric.php | 4 +- .../src/V1/MergeVersionAliasesRequest.php | 2 +- AiPlatform/src/V1/MetadataSchema.php | 12 +- AiPlatform/src/V1/MetadataServiceClient.php | 34 - .../src/V1/MetadataServiceGrpcClient.php | 531 --- AiPlatform/src/V1/MetadataStore.php | 14 +- .../src/V1/MetadataStore/DataplexConfig.php | 2 +- .../V1/MetadataStore/MetadataStoreState.php | 2 +- AiPlatform/src/V1/MigratableResource.php | 4 +- .../V1/MigratableResource/AutomlDataset.php | 4 +- .../src/V1/MigratableResource/AutomlModel.php | 4 +- .../DataLabelingDataset.php | 4 +- .../DataLabelingAnnotatedDataset.php | 4 +- .../MlEngineModelVersion.php | 4 +- .../MigrateAutomlDatasetConfig.php | 4 +- .../MigrateAutomlModelConfig.php | 4 +- .../MigrateDataLabelingDatasetConfig.php | 4 +- ...rateDataLabelingAnnotatedDatasetConfig.php | 2 +- .../MigrateMlEngineModelVersionConfig.php | 6 +- AiPlatform/src/V1/MigrateResourceResponse.php | 2 +- AiPlatform/src/V1/MigrationServiceClient.php | 34 - .../src/V1/MigrationServiceGrpcClient.php | 69 - AiPlatform/src/V1/Model.php | 48 +- AiPlatform/src/V1/Model/DataStats.php | 12 +- AiPlatform/src/V1/Model/ExportFormat.php | 2 +- AiPlatform/src/V1/Model/OriginalModelInfo.php | 2 +- AiPlatform/src/V1/ModelContainerSpec.php | 14 +- ...ModelDeploymentMonitoringBigQueryTable.php | 8 +- .../src/V1/ModelDeploymentMonitoringJob.php | 40 +- .../LatestMonitoringPipelineMetadata.php | 4 +- ...delDeploymentMonitoringObjectiveConfig.php | 4 +- ...odelDeploymentMonitoringScheduleConfig.php | 4 +- AiPlatform/src/V1/ModelEvaluation.php | 18 +- .../ModelEvaluationExplanationSpec.php | 4 +- AiPlatform/src/V1/ModelEvaluationSlice.php | 12 +- .../src/V1/ModelEvaluationSlice/Slice.php | 6 +- .../Slice/SliceSpec/Range.php | 4 +- .../Slice/SliceSpec/SliceConfig.php | 4 +- .../src/V1/ModelGardenServiceClient.php | 34 - AiPlatform/src/V1/ModelGardenSource.php | 2 +- .../src/V1/ModelMonitoringAlertConfig.php | 2 +- .../src/V1/ModelMonitoringObjectiveConfig.php | 8 +- .../ExplanationConfig.php | 4 +- .../ExplanationConfig/ExplanationBaseline.php | 2 +- .../PredictionDriftDetectionConfig.php | 2 +- .../TrainingDataset.php | 6 +- .../TrainingPredictionSkewDetectionConfig.php | 2 +- .../src/V1/ModelMonitoringStatsAnomalies.php | 6 +- .../FeatureHistoricStatsAnomalies.php | 6 +- AiPlatform/src/V1/ModelServiceClient.php | 34 - AiPlatform/src/V1/ModelServiceGrpcClient.php | 311 -- AiPlatform/src/V1/ModelSourceInfo.php | 4 +- .../MutateDeployedIndexOperationMetadata.php | 4 +- .../src/V1/MutateDeployedIndexRequest.php | 4 +- .../src/V1/MutateDeployedIndexResponse.php | 2 +- .../MutateDeployedModelOperationMetadata.php | 2 +- .../src/V1/MutateDeployedModelRequest.php | 6 +- .../src/V1/MutateDeployedModelResponse.php | 2 +- AiPlatform/src/V1/NasJob.php | 22 +- AiPlatform/src/V1/NasJobSpec.php | 4 +- .../V1/NasJobSpec/MultiTrialAlgorithmSpec.php | 8 +- .../MultiTrialAlgorithmSpec/MetricSpec.php | 4 +- .../SearchTrialSpec.php | 8 +- .../TrainTrialSpec.php | 6 +- AiPlatform/src/V1/NasTrial.php | 10 +- AiPlatform/src/V1/NasTrialDetail.php | 8 +- AiPlatform/src/V1/NearestNeighborQuery.php | 6 +- .../V1/NearestNeighborQuery/Parameters.php | 4 +- .../V1/NearestNeighborQuery/StringFilter.php | 2 +- ...NearestNeighborSearchOperationMetadata.php | 2 +- .../ContentValidationStats.php | 10 +- .../RecordError.php | 10 +- .../src/V1/NearestNeighbors/Neighbor.php | 6 +- AiPlatform/src/V1/Neighbor.php | 4 +- AiPlatform/src/V1/NetworkSpec.php | 6 +- AiPlatform/src/V1/NfsMount.php | 6 +- AiPlatform/src/V1/NotebookEucConfig.php | 4 +- .../src/V1/NotebookIdleShutdownConfig.php | 4 +- AiPlatform/src/V1/NotebookRuntime.php | 38 +- AiPlatform/src/V1/NotebookRuntimeTemplate.php | 32 +- .../src/V1/NotebookRuntimeTemplateRef.php | 2 +- AiPlatform/src/V1/NotebookServiceClient.php | 34 - ...useModelDeploymentMonitoringJobRequest.php | 2 +- AiPlatform/src/V1/PauseScheduleRequest.php | 2 +- AiPlatform/src/V1/PersistentDiskSpec.php | 4 +- AiPlatform/src/V1/PersistentResource.php | 38 +- .../V1/PersistentResourceServiceClient.php | 34 - AiPlatform/src/V1/PipelineJob.php | 50 +- .../src/V1/PipelineJob/RuntimeConfig.php | 4 +- AiPlatform/src/V1/PipelineJobDetail.php | 4 +- AiPlatform/src/V1/PipelineServiceClient.php | 34 - .../src/V1/PipelineServiceGrpcClient.php | 213 - AiPlatform/src/V1/PipelineTaskDetail.php | 20 +- .../PipelineTaskDetail/PipelineTaskStatus.php | 6 +- .../ContainerDetail.php | 4 +- .../CustomJobDetail.php | 2 +- .../src/V1/PipelineTemplateMetadata.php | 2 +- AiPlatform/src/V1/Port.php | 2 +- AiPlatform/src/V1/PredefinedSplit.php | 2 +- AiPlatform/src/V1/PredictRequest.php | 4 +- .../PredictRequestResponseLoggingConfig.php | 6 +- AiPlatform/src/V1/PredictResponse.php | 10 +- AiPlatform/src/V1/PredictSchemata.php | 6 +- AiPlatform/src/V1/PredictionServiceClient.php | 34 - .../src/V1/PredictionServiceGrpcClient.php | 101 - AiPlatform/src/V1/Presets.php | 4 +- AiPlatform/src/V1/PrivateEndpoints.php | 8 +- .../src/V1/PrivateServiceConnectConfig.php | 2 +- AiPlatform/src/V1/Probe.php | 4 +- AiPlatform/src/V1/PscAutomatedEndpoints.php | 6 +- AiPlatform/src/V1/PublisherModel.php | 16 +- .../src/V1/PublisherModel/CallToAction.php | 26 +- .../V1/PublisherModel/CallToAction/Deploy.php | 14 +- .../RegionalResourceReferences.php | 8 +- .../CallToAction/ViewRestApi.php | 2 +- .../src/V1/PublisherModel/Documentation.php | 4 +- AiPlatform/src/V1/PurgeArtifactsMetadata.php | 2 +- AiPlatform/src/V1/PurgeArtifactsRequest.php | 6 +- AiPlatform/src/V1/PurgeArtifactsResponse.php | 2 +- AiPlatform/src/V1/PurgeContextsMetadata.php | 2 +- AiPlatform/src/V1/PurgeContextsRequest.php | 6 +- AiPlatform/src/V1/PurgeContextsResponse.php | 2 +- AiPlatform/src/V1/PurgeExecutionsMetadata.php | 2 +- AiPlatform/src/V1/PurgeExecutionsRequest.php | 6 +- AiPlatform/src/V1/PurgeExecutionsResponse.php | 2 +- AiPlatform/src/V1/PythonPackageSpec.php | 4 +- .../QueryArtifactLineageSubgraphRequest.php | 6 +- .../V1/QueryContextLineageSubgraphRequest.php | 2 +- .../src/V1/QueryDeployedModelsRequest.php | 6 +- .../src/V1/QueryDeployedModelsResponse.php | 6 +- .../QueryExecutionInputsAndOutputsRequest.php | 2 +- AiPlatform/src/V1/RawPredictRequest.php | 4 +- AiPlatform/src/V1/RayMetricSpec.php | 2 +- AiPlatform/src/V1/RaySpec.php | 6 +- .../src/V1/ReadFeatureValuesRequest.php | 6 +- .../src/V1/ReadFeatureValuesResponse.php | 4 +- .../ReadFeatureValuesResponse/EntityView.php | 2 +- .../FeatureDescriptor.php | 2 +- .../V1/ReadFeatureValuesResponse/Header.php | 2 +- .../src/V1/ReadIndexDatapointsRequest.php | 4 +- .../src/V1/ReadTensorboardBlobDataRequest.php | 2 +- .../src/V1/ReadTensorboardSizeRequest.php | 2 +- .../src/V1/ReadTensorboardSizeResponse.php | 2 +- .../ReadTensorboardTimeSeriesDataRequest.php | 6 +- .../ReadTensorboardTimeSeriesDataResponse.php | 2 +- .../src/V1/ReadTensorboardUsageRequest.php | 2 +- .../PerUserUsageData.php | 4 +- ...ootPersistentResourceOperationMetadata.php | 4 +- .../V1/RebootPersistentResourceRequest.php | 2 +- .../src/V1/RemoveContextChildrenRequest.php | 2 +- AiPlatform/src/V1/RemoveDatapointsRequest.php | 2 +- AiPlatform/src/V1/ResourcePool.php | 12 +- .../src/V1/ResourcePool/AutoscalingSpec.php | 4 +- AiPlatform/src/V1/ResourceRuntimeSpec.php | 4 +- AiPlatform/src/V1/ResourcesConsumed.php | 2 +- ...RestoreDatasetVersionOperationMetadata.php | 2 +- .../src/V1/RestoreDatasetVersionRequest.php | 2 +- ...umeModelDeploymentMonitoringJobRequest.php | 2 +- AiPlatform/src/V1/ResumeScheduleRequest.php | 4 +- AiPlatform/src/V1/Retrieval.php | 2 +- AiPlatform/src/V1/SafetyRating.php | 12 +- AiPlatform/src/V1/SafetySetting.php | 6 +- AiPlatform/src/V1/SampleConfig.php | 2 +- .../src/V1/SampledShapleyAttribution.php | 2 +- AiPlatform/src/V1/SamplingStrategy.php | 2 +- .../SamplingStrategy/RandomSampleConfig.php | 2 +- AiPlatform/src/V1/SavedQuery.php | 20 +- AiPlatform/src/V1/Scalar.php | 2 +- AiPlatform/src/V1/Schedule.php | 32 +- AiPlatform/src/V1/Schedule/RunResponse.php | 4 +- AiPlatform/src/V1/ScheduleServiceClient.php | 34 - AiPlatform/src/V1/Scheduling.php | 6 +- AiPlatform/src/V1/Schema.php | 34 +- AiPlatform/src/V1/SearchDataItemsRequest.php | 14 +- .../OrderByAnnotation.php | 4 +- AiPlatform/src/V1/SearchDataItemsResponse.php | 2 +- AiPlatform/src/V1/SearchEntryPoint.php | 4 +- AiPlatform/src/V1/SearchFeaturesRequest.php | 8 +- AiPlatform/src/V1/SearchFeaturesResponse.php | 2 +- .../V1/SearchMigratableResourcesRequest.php | 8 +- .../V1/SearchMigratableResourcesResponse.php | 2 +- ...loymentMonitoringStatsAnomaliesRequest.php | 14 +- .../StatsAnomaliesObjective.php | 4 +- ...oymentMonitoringStatsAnomaliesResponse.php | 2 +- .../src/V1/SearchNearestEntitiesRequest.php | 6 +- .../src/V1/SearchNearestEntitiesResponse.php | 2 +- AiPlatform/src/V1/Segment.php | 143 - AiPlatform/src/V1/ServiceAccountSpec.php | 4 +- AiPlatform/src/V1/ShieldedVmConfig.php | 2 +- AiPlatform/src/V1/SmoothGradConfig.php | 2 +- AiPlatform/src/V1/SpecialistPool.php | 6 +- .../src/V1/SpecialistPoolServiceClient.php | 34 - .../V1/SpecialistPoolServiceGrpcClient.php | 115 - .../StartNotebookRuntimeOperationMetadata.php | 4 +- .../src/V1/StartNotebookRuntimeRequest.php | 2 +- AiPlatform/src/V1/StopTrialRequest.php | 2 +- AiPlatform/src/V1/StratifiedSplit.php | 8 +- .../src/V1/StreamDirectPredictRequest.php | 4 +- .../src/V1/StreamDirectPredictResponse.php | 2 +- .../src/V1/StreamDirectRawPredictRequest.php | 6 +- .../src/V1/StreamDirectRawPredictResponse.php | 2 +- AiPlatform/src/V1/StreamRawPredictRequest.php | 4 +- AiPlatform/src/V1/StreamingPredictRequest.php | 4 +- .../src/V1/StreamingPredictResponse.php | 2 +- .../src/V1/StreamingRawPredictRequest.php | 6 +- .../src/V1/StreamingRawPredictResponse.php | 2 +- .../V1/StreamingReadFeatureValuesRequest.php | 4 +- AiPlatform/src/V1/StructFieldValue.php | 4 +- AiPlatform/src/V1/Study.php | 12 +- AiPlatform/src/V1/StudySpec.php | 8 +- .../StudySpec/ConvexAutomatedStoppingSpec.php | 12 +- .../DecayCurveAutomatedStoppingSpec.php | 2 +- .../StudySpec/MedianAutomatedStoppingSpec.php | 2 +- AiPlatform/src/V1/StudySpec/MetricSpec.php | 6 +- .../MetricSpec/SafetyMetricConfig.php | 4 +- AiPlatform/src/V1/StudySpec/ParameterSpec.php | 4 +- .../ParameterSpec/CategoricalValueSpec.php | 2 +- .../ConditionalParameterSpec.php | 2 +- .../ParameterSpec/DiscreteValueSpec.php | 2 +- .../ParameterSpec/DoubleValueSpec.php | 6 +- .../ParameterSpec/IntegerValueSpec.php | 6 +- .../src/V1/StudySpec/StudyStoppingConfig.php | 30 +- AiPlatform/src/V1/SuggestTrialsMetadata.php | 4 +- AiPlatform/src/V1/SuggestTrialsRequest.php | 6 +- AiPlatform/src/V1/SuggestTrialsResponse.php | 6 +- .../src/V1/SupervisedHyperParameters.php | 6 +- .../src/V1/SupervisedTuningDataStats.php | 14 +- .../SupervisedTuningDatasetDistribution.php | 14 +- .../DatasetBucket.php | 6 +- AiPlatform/src/V1/SupervisedTuningSpec.php | 6 +- AiPlatform/src/V1/SyncFeatureViewRequest.php | 2 +- AiPlatform/src/V1/SyncFeatureViewResponse.php | 2 +- AiPlatform/src/V1/TFRecordDestination.php | 2 +- AiPlatform/src/V1/Tensor.php | 4 +- AiPlatform/src/V1/Tensorboard.php | 20 +- AiPlatform/src/V1/TensorboardBlob.php | 4 +- AiPlatform/src/V1/TensorboardExperiment.php | 14 +- AiPlatform/src/V1/TensorboardRun.php | 12 +- .../src/V1/TensorboardServiceClient.php | 34 - .../src/V1/TensorboardServiceGrpcClient.php | 484 --- AiPlatform/src/V1/TensorboardTensor.php | 4 +- AiPlatform/src/V1/TensorboardTimeSeries.php | 20 +- .../src/V1/TensorboardTimeSeries/Metadata.php | 6 +- AiPlatform/src/V1/TimeSeriesData.php | 4 +- AiPlatform/src/V1/TimeSeriesDataPoint.php | 4 +- AiPlatform/src/V1/TimestampSplit.php | 8 +- AiPlatform/src/V1/Tool.php | 4 +- AiPlatform/src/V1/ToolConfig.php | 2 +- AiPlatform/src/V1/TrainingConfig.php | 2 +- AiPlatform/src/V1/TrainingPipeline.php | 32 +- AiPlatform/src/V1/Trial.php | 18 +- AiPlatform/src/V1/Trial/Parameter.php | 4 +- AiPlatform/src/V1/TrialContext.php | 2 +- AiPlatform/src/V1/TunedModel.php | 4 +- AiPlatform/src/V1/TuningJob.php | 24 +- .../src/V1/UndeployIndexOperationMetadata.php | 2 +- AiPlatform/src/V1/UndeployIndexRequest.php | 4 +- .../src/V1/UndeployModelOperationMetadata.php | 2 +- AiPlatform/src/V1/UndeployModelRequest.php | 4 +- AiPlatform/src/V1/UnmanagedContainerModel.php | 6 +- AiPlatform/src/V1/UpdateArtifactRequest.php | 6 +- AiPlatform/src/V1/UpdateContextRequest.php | 6 +- AiPlatform/src/V1/UpdateDatasetRequest.php | 4 +- .../src/V1/UpdateDatasetVersionRequest.php | 4 +- ...eploymentResourcePoolOperationMetadata.php | 2 +- AiPlatform/src/V1/UpdateEndpointRequest.php | 4 +- AiPlatform/src/V1/UpdateEntityTypeRequest.php | 4 +- AiPlatform/src/V1/UpdateExecutionRequest.php | 6 +- ...ateExplanationDatasetOperationMetadata.php | 2 +- .../V1/UpdateExplanationDatasetRequest.php | 4 +- .../UpdateFeatureGroupOperationMetadata.php | 2 +- .../src/V1/UpdateFeatureGroupRequest.php | 4 +- ...ateFeatureOnlineStoreOperationMetadata.php | 2 +- .../V1/UpdateFeatureOnlineStoreRequest.php | 4 +- .../src/V1/UpdateFeatureOperationMetadata.php | 2 +- AiPlatform/src/V1/UpdateFeatureRequest.php | 4 +- .../V1/UpdateFeatureViewOperationMetadata.php | 2 +- .../src/V1/UpdateFeatureViewRequest.php | 4 +- .../UpdateFeaturestoreOperationMetadata.php | 2 +- .../src/V1/UpdateFeaturestoreRequest.php | 4 +- .../src/V1/UpdateIndexEndpointRequest.php | 4 +- .../src/V1/UpdateIndexOperationMetadata.php | 4 +- AiPlatform/src/V1/UpdateIndexRequest.php | 4 +- ...ploymentMonitoringJobOperationMetadata.php | 2 +- ...ateModelDeploymentMonitoringJobRequest.php | 4 +- AiPlatform/src/V1/UpdateModelRequest.php | 4 +- .../UpdateNotebookRuntimeTemplateRequest.php | 4 +- ...atePersistentResourceOperationMetadata.php | 4 +- .../V1/UpdatePersistentResourceRequest.php | 4 +- AiPlatform/src/V1/UpdateScheduleRequest.php | 4 +- .../UpdateSpecialistPoolOperationMetadata.php | 4 +- .../src/V1/UpdateSpecialistPoolRequest.php | 4 +- .../V1/UpdateTensorboardExperimentRequest.php | 4 +- .../V1/UpdateTensorboardOperationMetadata.php | 2 +- .../src/V1/UpdateTensorboardRequest.php | 4 +- .../src/V1/UpdateTensorboardRunRequest.php | 4 +- .../V1/UpdateTensorboardTimeSeriesRequest.php | 4 +- ...pgradeNotebookRuntimeOperationMetadata.php | 4 +- .../src/V1/UpgradeNotebookRuntimeRequest.php | 2 +- .../src/V1/UploadModelOperationMetadata.php | 2 +- AiPlatform/src/V1/UploadModelRequest.php | 10 +- AiPlatform/src/V1/UploadModelResponse.php | 4 +- AiPlatform/src/V1/UpsertDatapointsRequest.php | 4 +- AiPlatform/src/V1/UserActionReference.php | 2 +- AiPlatform/src/V1/VertexAISearch.php | 2 +- AiPlatform/src/V1/VideoMetadata.php | 4 +- AiPlatform/src/V1/VizierServiceClient.php | 34 - AiPlatform/src/V1/VizierServiceGrpcClient.php | 277 -- AiPlatform/src/V1/WorkerPoolSpec.php | 6 +- .../src/V1/WriteFeatureValuesPayload.php | 2 +- .../src/V1/WriteFeatureValuesRequest.php | 2 +- .../WriteTensorboardExperimentDataRequest.php | 2 +- .../src/V1/WriteTensorboardRunDataRequest.php | 2 +- AiPlatform/src/V1/XraiAttribution.php | 6 +- .../V1/Client/DatasetServiceClientTest.php | 548 ++- ...eploymentResourcePoolServiceClientTest.php | 270 +- .../V1/Client/EndpointServiceClientTest.php | 287 +- ...atureOnlineStoreAdminServiceClientTest.php | 517 ++- .../FeatureOnlineStoreServiceClientTest.php | 194 +- .../FeatureRegistryServiceClientTest.php | 347 +- ...urestoreOnlineServingServiceClientTest.php | 229 +- .../Client/FeaturestoreServiceClientTest.php | 618 +-- .../Client/GenAiTuningServiceClientTest.php | 198 +- .../Client/IndexEndpointServiceClientTest.php | 271 +- .../Unit/V1/Client/IndexServiceClientTest.php | 266 +- .../Unit/V1/Client/JobServiceClientTest.php | 1014 +++-- .../V1/Client/LlmUtilityServiceClientTest.php | 149 +- .../Unit/V1/Client/MatchServiceClientTest.php | 152 +- .../V1/Client/MetadataServiceClientTest.php | 849 ++-- .../V1/Client/MigrationServiceClientTest.php | 149 +- .../Client/ModelGardenServiceClientTest.php | 131 +- .../Unit/V1/Client/ModelServiceClientTest.php | 535 +-- .../V1/Client/NotebookServiceClientTest.php | 380 +- .../PersistentResourceServiceClientTest.php | 260 +- .../V1/Client/PipelineServiceClientTest.php | 393 +- .../V1/Client/PredictionServiceClientTest.php | 387 +- .../V1/Client/ScheduleServiceClientTest.php | 268 +- .../SpecialistPoolServiceClientTest.php | 226 +- .../Client/TensorboardServiceClientTest.php | 1099 +++-- .../V1/Client/VizierServiceClientTest.php | 438 +- .../Unit/V1/DatasetServiceClientTest.php | 2181 ---------- ...eploymentResourcePoolServiceClientTest.php | 849 ---- .../Unit/V1/EndpointServiceClientTest.php | 1237 ------ ...atureOnlineStoreAdminServiceClientTest.php | 1568 ------- .../FeatureOnlineStoreServiceClientTest.php | 497 --- .../V1/FeatureRegistryServiceClientTest.php | 1407 ------ ...urestoreOnlineServingServiceClientTest.php | 601 --- .../Unit/V1/FeaturestoreServiceClientTest.php | 2498 ----------- .../Unit/V1/GenAiTuningServiceClientTest.php | 642 --- .../V1/IndexEndpointServiceClientTest.php | 1247 ------ .../tests/Unit/V1/IndexServiceClientTest.php | 1018 ----- .../tests/Unit/V1/JobServiceClientTest.php | 3237 -------------- .../Unit/V1/LlmUtilityServiceClientTest.php | 512 --- .../tests/Unit/V1/MatchServiceClientTest.php | 492 --- .../Unit/V1/MetadataServiceClientTest.php | 2955 ------------- .../Unit/V1/MigrationServiceClientTest.php | 570 --- .../Unit/V1/ModelGardenServiceClientTest.php | 439 -- .../tests/Unit/V1/ModelServiceClientTest.php | 1972 --------- .../Unit/V1/NotebookServiceClientTest.php | 1506 ------- .../PersistentResourceServiceClientTest.php | 1020 ----- .../Unit/V1/PipelineServiceClientTest.php | 1416 ------ .../Unit/V1/PredictionServiceClientTest.php | 1380 ------ .../Unit/V1/ScheduleServiceClientTest.php | 927 ---- .../V1/SpecialistPoolServiceClientTest.php | 901 ---- .../Unit/V1/TensorboardServiceClientTest.php | 2783 ------------ .../tests/Unit/V1/VizierServiceClientTest.php | 1504 ------- 895 files changed, 8944 insertions(+), 91668 deletions(-) delete mode 100644 AiPlatform/src/V1/DatasetServiceClient.php delete mode 100644 AiPlatform/src/V1/DatasetServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/DeploymentResourcePoolServiceClient.php delete mode 100644 AiPlatform/src/V1/EndpointServiceClient.php delete mode 100644 AiPlatform/src/V1/EndpointServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/FeatureOnlineStoreAdminServiceClient.php delete mode 100644 AiPlatform/src/V1/FeatureOnlineStoreServiceClient.php delete mode 100644 AiPlatform/src/V1/FeatureRegistryServiceClient.php delete mode 100644 AiPlatform/src/V1/FeaturestoreOnlineServingServiceClient.php delete mode 100644 AiPlatform/src/V1/FeaturestoreOnlineServingServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/FeaturestoreServiceClient.php delete mode 100644 AiPlatform/src/V1/FeaturestoreServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/Gapic/DatasetServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/DeploymentResourcePoolServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/EndpointServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/FeatureOnlineStoreAdminServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/FeatureOnlineStoreServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/FeatureRegistryServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/FeaturestoreOnlineServingServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/FeaturestoreServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/GenAiTuningServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/IndexEndpointServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/IndexServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/JobServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/LlmUtilityServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/MatchServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/MetadataServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/MigrationServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/ModelGardenServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/ModelServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/NotebookServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/PersistentResourceServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/PipelineServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/PredictionServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/ScheduleServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/SpecialistPoolServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/TensorboardServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/Gapic/VizierServiceGapicClient.php delete mode 100644 AiPlatform/src/V1/GenAiTuningServiceClient.php delete mode 100644 AiPlatform/src/V1/GroundingAttribution.php delete mode 100644 AiPlatform/src/V1/GroundingAttribution/Web.php delete mode 100644 AiPlatform/src/V1/IndexEndpointServiceClient.php delete mode 100644 AiPlatform/src/V1/IndexEndpointServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/IndexServiceClient.php delete mode 100644 AiPlatform/src/V1/IndexServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/JobServiceClient.php delete mode 100644 AiPlatform/src/V1/JobServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/LlmUtilityServiceClient.php delete mode 100644 AiPlatform/src/V1/MatchServiceClient.php delete mode 100644 AiPlatform/src/V1/MatchServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/MetadataServiceClient.php delete mode 100644 AiPlatform/src/V1/MetadataServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/MigrationServiceClient.php delete mode 100644 AiPlatform/src/V1/MigrationServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/ModelGardenServiceClient.php delete mode 100644 AiPlatform/src/V1/ModelServiceClient.php delete mode 100644 AiPlatform/src/V1/ModelServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/NotebookServiceClient.php delete mode 100644 AiPlatform/src/V1/PersistentResourceServiceClient.php delete mode 100644 AiPlatform/src/V1/PipelineServiceClient.php delete mode 100644 AiPlatform/src/V1/PipelineServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/PredictionServiceClient.php delete mode 100644 AiPlatform/src/V1/PredictionServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/ScheduleServiceClient.php delete mode 100644 AiPlatform/src/V1/Segment.php delete mode 100644 AiPlatform/src/V1/SpecialistPoolServiceClient.php delete mode 100644 AiPlatform/src/V1/SpecialistPoolServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/TensorboardServiceClient.php delete mode 100644 AiPlatform/src/V1/TensorboardServiceGrpcClient.php delete mode 100644 AiPlatform/src/V1/VizierServiceClient.php delete mode 100644 AiPlatform/src/V1/VizierServiceGrpcClient.php delete mode 100644 AiPlatform/tests/Unit/V1/DatasetServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/DeploymentResourcePoolServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/EndpointServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/FeatureOnlineStoreAdminServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/FeatureOnlineStoreServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/FeatureRegistryServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/FeaturestoreOnlineServingServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/FeaturestoreServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/GenAiTuningServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/IndexEndpointServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/IndexServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/JobServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/LlmUtilityServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/MatchServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/MetadataServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/MigrationServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/ModelGardenServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/ModelServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/NotebookServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/PersistentResourceServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/PipelineServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/PredictionServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/ScheduleServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/SpecialistPoolServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/TensorboardServiceClientTest.php delete mode 100644 AiPlatform/tests/Unit/V1/VizierServiceClientTest.php diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 49b3491111d7..8163fb98b892 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -26,7 +26,7 @@ "AiPlatform": { "language": "php", "distribution_name": "google/cloud-ai-platform", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-ai-platform/latest", "library_type": "GAPIC_AUTO", "api_shortname": "aiplatform" diff --git a/AiPlatform/.OwlBot.yaml b/AiPlatform/.OwlBot.yaml index 744bf4a83821..9acdd46ecbed 100644 --- a/AiPlatform/.OwlBot.yaml +++ b/AiPlatform/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/aiplatform/v1/.*-php/(.*) - dest: /owl-bot-staging/AiPlatform/v1/$1 + - source: /google/cloud/aiplatform/(v1)/.*-php/(.*) + dest: /owl-bot-staging/AiPlatform/$1/$2 api-name: AiPlatform diff --git a/AiPlatform/README.md b/AiPlatform/README.md index 7dc1b2e628f7..42d54798d22e 100644 --- a/AiPlatform/README.md +++ b/AiPlatform/README.md @@ -30,9 +30,8 @@ on authenticating your client. Once authenticated, you'll be ready to start maki ### Version -This component is considered beta. As such, it should be expected to be mostly -stable and we're working towards a release candidate. We will address issues -and requests with a higher priority. +This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in +any minor or patch releases. We will address issues and requests with the highest priority. ### Next Steps diff --git a/AiPlatform/owlbot.py b/AiPlatform/owlbot.py index b9761c9858b0..49b5f4059fbb 100644 --- a/AiPlatform/owlbot.py +++ b/AiPlatform/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ src=src, dest=dest, copy_excludes=[ - src / "**/[A-Z]*_*.php" + src / "**/[A-Z]*_*.php", ] ) @@ -47,32 +47,6 @@ + "\n", '') -### [START] protoc backwards compatibility fixes - -# roll back to private properties. -s.replace( - "src/**/V*/**/*.php", - r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$", - r"""Generated from protobuf field \1 - */ - private $""") - -# Replace "Unwrapped" with "Value" for method names. -s.replace( - "src/**/V*/**/*.php", - r"public function ([s|g]\w{3,})Unwrapped", - r"public function \1Value" -) - -### [END] protoc backwards compatibility fixes - -# fix relative cloud.google.com links -s.replace( - "src/**/V*/**/*.php", - r"(.{0,})\]\((/.{0,})\)", - r"\1](https://cloud.google.com\2)" -) - # format generated clients subprocess.run([ 'npm', @@ -81,8 +55,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) + '--print-width=120']) diff --git a/AiPlatform/src/V1/ActiveLearningConfig.php b/AiPlatform/src/V1/ActiveLearningConfig.php index 450eeab21754..f9887ff8d0c8 100644 --- a/AiPlatform/src/V1/ActiveLearningConfig.php +++ b/AiPlatform/src/V1/ActiveLearningConfig.php @@ -23,7 +23,7 @@ class ActiveLearningConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.SampleConfig sample_config = 3; */ - private $sample_config = null; + protected $sample_config = null; /** * CMLE training config. For every active learning labeling iteration, system * will train a machine learning model on CMLE. The trained model will be used @@ -31,7 +31,7 @@ class ActiveLearningConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.TrainingConfig training_config = 4; */ - private $training_config = null; + protected $training_config = null; protected $human_labeling_budget; /** diff --git a/AiPlatform/src/V1/AddContextArtifactsAndExecutionsRequest.php b/AiPlatform/src/V1/AddContextArtifactsAndExecutionsRequest.php index 74a8c88f21b6..f48abf80c3d5 100644 --- a/AiPlatform/src/V1/AddContextArtifactsAndExecutionsRequest.php +++ b/AiPlatform/src/V1/AddContextArtifactsAndExecutionsRequest.php @@ -23,7 +23,7 @@ class AddContextArtifactsAndExecutionsRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string context = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $context = ''; + protected $context = ''; /** * The resource names of the Artifacts to attribute to the Context. * Format: diff --git a/AiPlatform/src/V1/AddContextChildrenRequest.php b/AiPlatform/src/V1/AddContextChildrenRequest.php index 07b00a1a0a65..ced1c8790978 100644 --- a/AiPlatform/src/V1/AddContextChildrenRequest.php +++ b/AiPlatform/src/V1/AddContextChildrenRequest.php @@ -23,7 +23,7 @@ class AddContextChildrenRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string context = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $context = ''; + protected $context = ''; /** * The resource names of the child Contexts. * diff --git a/AiPlatform/src/V1/AddExecutionEventsRequest.php b/AiPlatform/src/V1/AddExecutionEventsRequest.php index a5056d2aadc6..91504a57c913 100644 --- a/AiPlatform/src/V1/AddExecutionEventsRequest.php +++ b/AiPlatform/src/V1/AddExecutionEventsRequest.php @@ -24,7 +24,7 @@ class AddExecutionEventsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string execution = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $execution = ''; + protected $execution = ''; /** * The Events to create and add. * diff --git a/AiPlatform/src/V1/AddTrialMeasurementRequest.php b/AiPlatform/src/V1/AddTrialMeasurementRequest.php index 65ee3de9b43c..f2655af971ed 100644 --- a/AiPlatform/src/V1/AddTrialMeasurementRequest.php +++ b/AiPlatform/src/V1/AddTrialMeasurementRequest.php @@ -23,13 +23,13 @@ class AddTrialMeasurementRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string trial_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $trial_name = ''; + protected $trial_name = ''; /** * Required. The measurement to be added to a Trial. * * Generated from protobuf field .google.cloud.aiplatform.v1.Measurement measurement = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $measurement = null; + protected $measurement = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Annotation.php b/AiPlatform/src/V1/Annotation.php index e7c5cd6362c2..e571d303444a 100644 --- a/AiPlatform/src/V1/Annotation.php +++ b/AiPlatform/src/V1/Annotation.php @@ -21,7 +21,7 @@ class Annotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. Google Cloud Storage URI points to a YAML file describing * [payload][google.cloud.aiplatform.v1.Annotation.payload]. The schema is @@ -34,39 +34,39 @@ class Annotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string payload_schema_uri = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $payload_schema_uri = ''; + protected $payload_schema_uri = ''; /** * Required. The schema of the payload can be found in * [payload_schema][google.cloud.aiplatform.v1.Annotation.payload_schema_uri]. * * Generated from protobuf field .google.protobuf.Value payload = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $payload = null; + protected $payload = null; /** * Output only. Timestamp when this Annotation was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Annotation was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. Used to perform consistent read-modify-write updates. If not set, * a blind "overwrite" update happens. * * Generated from protobuf field string etag = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * Output only. The source of the Annotation. * * Generated from protobuf field .google.cloud.aiplatform.v1.UserActionReference annotation_source = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $annotation_source = null; + protected $annotation_source = null; /** * Optional. The labels with user-defined metadata to organize your * Annotations. diff --git a/AiPlatform/src/V1/AnnotationSpec.php b/AiPlatform/src/V1/AnnotationSpec.php index 14a6a3e20511..07c36621fab8 100644 --- a/AiPlatform/src/V1/AnnotationSpec.php +++ b/AiPlatform/src/V1/AnnotationSpec.php @@ -20,7 +20,7 @@ class AnnotationSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The user-defined name of the AnnotationSpec. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -28,26 +28,26 @@ class AnnotationSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Output only. Timestamp when this AnnotationSpec was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when AnnotationSpec was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. Used to perform consistent read-modify-write updates. If not set, * a blind "overwrite" update happens. * * Generated from protobuf field string etag = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/Artifact.php b/AiPlatform/src/V1/Artifact.php index 6db04b11cd63..726926e474ca 100644 --- a/AiPlatform/src/V1/Artifact.php +++ b/AiPlatform/src/V1/Artifact.php @@ -20,28 +20,28 @@ class Artifact extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * User provided display name of the Artifact. * May be up to 128 Unicode characters. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * The uniform resource identifier of the artifact file. * May be empty if there is no actual artifact file. * * Generated from protobuf field string uri = 6; */ - private $uri = ''; + protected $uri = ''; /** * An eTag used to perform consistent read-modify-write updates. If not set, a * blind "overwrite" update happens. * * Generated from protobuf field string etag = 9; */ - private $etag = ''; + protected $etag = ''; /** * The labels with user-defined metadata to organize your Artifacts. * Label keys and values can be no longer than 64 characters @@ -58,13 +58,13 @@ class Artifact extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Artifact was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The state of this Artifact. This is a property of the Artifact, and does * not imply or capture any ongoing process. This property is managed by @@ -73,7 +73,7 @@ class Artifact extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Artifact.State state = 13; */ - private $state = 0; + protected $state = 0; /** * The title of the schema describing the metadata. * Schema title and version is expected to be registered in earlier Create @@ -82,7 +82,7 @@ class Artifact extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string schema_title = 14; */ - private $schema_title = ''; + protected $schema_title = ''; /** * The version of the schema in schema_name to use. * Schema title and version is expected to be registered in earlier Create @@ -91,7 +91,7 @@ class Artifact extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string schema_version = 15; */ - private $schema_version = ''; + protected $schema_version = ''; /** * Properties of the Artifact. * Top level metadata keys' heading and trailing spaces will be trimmed. @@ -99,13 +99,13 @@ class Artifact extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Struct metadata = 16; */ - private $metadata = null; + protected $metadata = null; /** * Description of the Artifact * * Generated from protobuf field string description = 17; */ - private $description = ''; + protected $description = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/AssignNotebookRuntimeOperationMetadata.php b/AiPlatform/src/V1/AssignNotebookRuntimeOperationMetadata.php index 77318886a842..72e3b6bf3dc6 100644 --- a/AiPlatform/src/V1/AssignNotebookRuntimeOperationMetadata.php +++ b/AiPlatform/src/V1/AssignNotebookRuntimeOperationMetadata.php @@ -21,14 +21,14 @@ class AssignNotebookRuntimeOperationMetadata extends \Google\Protobuf\Internal\M * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * A human-readable message that shows the intermediate progress details of * NotebookRuntime. * * Generated from protobuf field string progress_message = 2; */ - private $progress_message = ''; + protected $progress_message = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/AssignNotebookRuntimeRequest.php b/AiPlatform/src/V1/AssignNotebookRuntimeRequest.php index 85624f69347d..c8ea820e441c 100644 --- a/AiPlatform/src/V1/AssignNotebookRuntimeRequest.php +++ b/AiPlatform/src/V1/AssignNotebookRuntimeRequest.php @@ -22,27 +22,27 @@ class AssignNotebookRuntimeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The resource name of the NotebookRuntimeTemplate based on which a * NotebookRuntime will be assigned (reuse or create a new one). * * Generated from protobuf field string notebook_runtime_template = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $notebook_runtime_template = ''; + protected $notebook_runtime_template = ''; /** * Required. Provide runtime specific information (e.g. runtime owner, * notebook id) used for NotebookRuntime assignment. * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookRuntime notebook_runtime = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $notebook_runtime = null; + protected $notebook_runtime = null; /** * Optional. User specified ID for the notebook runtime. * * Generated from protobuf field string notebook_runtime_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $notebook_runtime_id = ''; + protected $notebook_runtime_id = ''; /** * @param string $parent Required. The resource name of the Location to get the NotebookRuntime diff --git a/AiPlatform/src/V1/Attribution.php b/AiPlatform/src/V1/Attribution.php index 841878f65e30..457be211bfdd 100644 --- a/AiPlatform/src/V1/Attribution.php +++ b/AiPlatform/src/V1/Attribution.php @@ -28,7 +28,7 @@ class Attribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double baseline_output_value = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $baseline_output_value = 0.0; + protected $baseline_output_value = 0.0; /** * Output only. Model predicted output on the corresponding [explanation * instance][ExplainRequest.instances]. The field name of the output is @@ -40,7 +40,7 @@ class Attribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double instance_output_value = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $instance_output_value = 0.0; + protected $instance_output_value = 0.0; /** * Output only. Attributions of each explained feature. Features are extracted * from the [prediction @@ -71,7 +71,7 @@ class Attribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value feature_attributions = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $feature_attributions = null; + protected $feature_attributions = null; /** * Output only. The index that locates the explained prediction output. * If the prediction output is a scalar value, output_index is not populated. @@ -94,7 +94,7 @@ class Attribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string output_display_name = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $output_display_name = ''; + protected $output_display_name = ''; /** * Output only. Error of * [feature_attributions][google.cloud.aiplatform.v1.Attribution.feature_attributions] @@ -115,19 +115,19 @@ class Attribution extends \Google\Protobuf\Internal\Message * increasing * [step_count][google.cloud.aiplatform.v1.XraiAttribution.step_count] might * reduce the error. - * See [this introduction](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview) + * See [this introduction](/vertex-ai/docs/explainable-ai/overview) * for more information. * * Generated from protobuf field double approximation_error = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $approximation_error = 0.0; + protected $approximation_error = 0.0; /** * Output only. Name of the explain output. Specified as the key in * [ExplanationMetadata.outputs][google.cloud.aiplatform.v1.ExplanationMetadata.outputs]. * * Generated from protobuf field string output_name = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $output_name = ''; + protected $output_name = ''; /** * Constructor. @@ -215,7 +215,7 @@ class Attribution extends \Google\Protobuf\Internal\Message * increasing * [step_count][google.cloud.aiplatform.v1.XraiAttribution.step_count] might * reduce the error. - * See [this introduction](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview) + * See [this introduction](/vertex-ai/docs/explainable-ai/overview) * for more information. * @type string $output_name * Output only. Name of the explain output. Specified as the key in @@ -487,7 +487,7 @@ public function setOutputDisplayName($var) * increasing * [step_count][google.cloud.aiplatform.v1.XraiAttribution.step_count] might * reduce the error. - * See [this introduction](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview) + * See [this introduction](/vertex-ai/docs/explainable-ai/overview) * for more information. * * Generated from protobuf field double approximation_error = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; @@ -518,7 +518,7 @@ public function getApproximationError() * increasing * [step_count][google.cloud.aiplatform.v1.XraiAttribution.step_count] might * reduce the error. - * See [this introduction](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview) + * See [this introduction](/vertex-ai/docs/explainable-ai/overview) * for more information. * * Generated from protobuf field double approximation_error = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; diff --git a/AiPlatform/src/V1/AutomaticResources.php b/AiPlatform/src/V1/AutomaticResources.php index e67e3d9844f8..19a15f9d5eb8 100644 --- a/AiPlatform/src/V1/AutomaticResources.php +++ b/AiPlatform/src/V1/AutomaticResources.php @@ -27,7 +27,7 @@ class AutomaticResources extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 min_replica_count = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $min_replica_count = 0; + protected $min_replica_count = 0; /** * Immutable. The maximum number of replicas this DeployedModel may be * deployed on when the traffic against it increases. If the requested value @@ -41,7 +41,7 @@ class AutomaticResources extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 max_replica_count = 2 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $max_replica_count = 0; + protected $max_replica_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/AutoscalingMetricSpec.php b/AiPlatform/src/V1/AutoscalingMetricSpec.php index 0d42cb702e6a..68f5244c7a41 100644 --- a/AiPlatform/src/V1/AutoscalingMetricSpec.php +++ b/AiPlatform/src/V1/AutoscalingMetricSpec.php @@ -26,7 +26,7 @@ class AutoscalingMetricSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metric_name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $metric_name = ''; + protected $metric_name = ''; /** * The target resource utilization in percentage (1% - 100%) for the given * metric; once the real usage deviates from the target by a certain @@ -35,7 +35,7 @@ class AutoscalingMetricSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 target = 2; */ - private $target = 0; + protected $target = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/AvroSource.php b/AiPlatform/src/V1/AvroSource.php index cde30965be5b..b0558cc5b603 100644 --- a/AiPlatform/src/V1/AvroSource.php +++ b/AiPlatform/src/V1/AvroSource.php @@ -20,7 +20,7 @@ class AvroSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GcsSource gcs_source = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $gcs_source = null; + protected $gcs_source = null; /** * Constructor. diff --git a/AiPlatform/src/V1/BatchCancelPipelineJobsOperationMetadata.php b/AiPlatform/src/V1/BatchCancelPipelineJobsOperationMetadata.php index 2ec27e5e0f56..6311dfc7eb40 100644 --- a/AiPlatform/src/V1/BatchCancelPipelineJobsOperationMetadata.php +++ b/AiPlatform/src/V1/BatchCancelPipelineJobsOperationMetadata.php @@ -21,7 +21,7 @@ class BatchCancelPipelineJobsOperationMetadata extends \Google\Protobuf\Internal * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/BatchCancelPipelineJobsRequest.php b/AiPlatform/src/V1/BatchCancelPipelineJobsRequest.php index 9d016518eaec..ace5b89bb75f 100644 --- a/AiPlatform/src/V1/BatchCancelPipelineJobsRequest.php +++ b/AiPlatform/src/V1/BatchCancelPipelineJobsRequest.php @@ -22,7 +22,7 @@ class BatchCancelPipelineJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The names of the PipelineJobs to cancel. * A maximum of 32 PipelineJobs can be cancelled in a batch. diff --git a/AiPlatform/src/V1/BatchCreateFeaturesOperationMetadata.php b/AiPlatform/src/V1/BatchCreateFeaturesOperationMetadata.php index 18a0c4a6ebbb..6dabff519c11 100644 --- a/AiPlatform/src/V1/BatchCreateFeaturesOperationMetadata.php +++ b/AiPlatform/src/V1/BatchCreateFeaturesOperationMetadata.php @@ -20,7 +20,7 @@ class BatchCreateFeaturesOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/BatchCreateFeaturesRequest.php b/AiPlatform/src/V1/BatchCreateFeaturesRequest.php index 5ff9f33b43f9..f2115669730b 100644 --- a/AiPlatform/src/V1/BatchCreateFeaturesRequest.php +++ b/AiPlatform/src/V1/BatchCreateFeaturesRequest.php @@ -23,7 +23,7 @@ class BatchCreateFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The request message specifying the Features to create. All * Features must be created under the same parent EntityType. The `parent` diff --git a/AiPlatform/src/V1/BatchCreateTensorboardRunsRequest.php b/AiPlatform/src/V1/BatchCreateTensorboardRunsRequest.php index 745382d56184..ea8f9e456276 100644 --- a/AiPlatform/src/V1/BatchCreateTensorboardRunsRequest.php +++ b/AiPlatform/src/V1/BatchCreateTensorboardRunsRequest.php @@ -25,7 +25,7 @@ class BatchCreateTensorboardRunsRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The request message specifying the TensorboardRuns to create. * A maximum of 1000 TensorboardRuns can be created in a batch. diff --git a/AiPlatform/src/V1/BatchCreateTensorboardTimeSeriesRequest.php b/AiPlatform/src/V1/BatchCreateTensorboardTimeSeriesRequest.php index 221f90e0db8a..4a4baef7fbe0 100644 --- a/AiPlatform/src/V1/BatchCreateTensorboardTimeSeriesRequest.php +++ b/AiPlatform/src/V1/BatchCreateTensorboardTimeSeriesRequest.php @@ -27,7 +27,7 @@ class BatchCreateTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The request message specifying the TensorboardTimeSeries to * create. A maximum of 1000 TensorboardTimeSeries can be created in a batch. diff --git a/AiPlatform/src/V1/BatchDedicatedResources.php b/AiPlatform/src/V1/BatchDedicatedResources.php index 866516f86726..ba3d80f6f880 100644 --- a/AiPlatform/src/V1/BatchDedicatedResources.php +++ b/AiPlatform/src/V1/BatchDedicatedResources.php @@ -21,7 +21,7 @@ class BatchDedicatedResources extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.MachineSpec machine_spec = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; */ - private $machine_spec = null; + protected $machine_spec = null; /** * Immutable. The number of machine replicas used at the start of the batch * operation. If not set, Vertex AI decides starting number, not greater than @@ -29,14 +29,14 @@ class BatchDedicatedResources extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 starting_replica_count = 2 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $starting_replica_count = 0; + protected $starting_replica_count = 0; /** * Immutable. The maximum number of machine replicas the batch operation may * be scaled to. The default value is 10. * * Generated from protobuf field int32 max_replica_count = 3 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $max_replica_count = 0; + protected $max_replica_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/BatchDeletePipelineJobsRequest.php b/AiPlatform/src/V1/BatchDeletePipelineJobsRequest.php index 8d1030a333cb..d3e697f9a6b3 100644 --- a/AiPlatform/src/V1/BatchDeletePipelineJobsRequest.php +++ b/AiPlatform/src/V1/BatchDeletePipelineJobsRequest.php @@ -22,7 +22,7 @@ class BatchDeletePipelineJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The names of the PipelineJobs to delete. * A maximum of 32 PipelineJobs can be deleted in a batch. diff --git a/AiPlatform/src/V1/BatchImportEvaluatedAnnotationsRequest.php b/AiPlatform/src/V1/BatchImportEvaluatedAnnotationsRequest.php index e9b8a358859f..e300b7710e16 100644 --- a/AiPlatform/src/V1/BatchImportEvaluatedAnnotationsRequest.php +++ b/AiPlatform/src/V1/BatchImportEvaluatedAnnotationsRequest.php @@ -23,7 +23,7 @@ class BatchImportEvaluatedAnnotationsRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. Evaluated annotations resource to be imported. * diff --git a/AiPlatform/src/V1/BatchImportEvaluatedAnnotationsResponse.php b/AiPlatform/src/V1/BatchImportEvaluatedAnnotationsResponse.php index b7e21ae9d604..b38ba54de607 100644 --- a/AiPlatform/src/V1/BatchImportEvaluatedAnnotationsResponse.php +++ b/AiPlatform/src/V1/BatchImportEvaluatedAnnotationsResponse.php @@ -21,7 +21,7 @@ class BatchImportEvaluatedAnnotationsResponse extends \Google\Protobuf\Internal\ * * Generated from protobuf field int32 imported_evaluated_annotations_count = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $imported_evaluated_annotations_count = 0; + protected $imported_evaluated_annotations_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/BatchImportModelEvaluationSlicesRequest.php b/AiPlatform/src/V1/BatchImportModelEvaluationSlicesRequest.php index 9f075ba6d72e..a9498d04017e 100644 --- a/AiPlatform/src/V1/BatchImportModelEvaluationSlicesRequest.php +++ b/AiPlatform/src/V1/BatchImportModelEvaluationSlicesRequest.php @@ -23,7 +23,7 @@ class BatchImportModelEvaluationSlicesRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. Model evaluation slice resource to be imported. * diff --git a/AiPlatform/src/V1/BatchMigrateResourcesOperationMetadata.php b/AiPlatform/src/V1/BatchMigrateResourcesOperationMetadata.php index 8d5445bea22c..c0566f257330 100644 --- a/AiPlatform/src/V1/BatchMigrateResourcesOperationMetadata.php +++ b/AiPlatform/src/V1/BatchMigrateResourcesOperationMetadata.php @@ -21,7 +21,7 @@ class BatchMigrateResourcesOperationMetadata extends \Google\Protobuf\Internal\M * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Partial results that reflect the latest migration operation progress. * diff --git a/AiPlatform/src/V1/BatchMigrateResourcesOperationMetadata/PartialResult.php b/AiPlatform/src/V1/BatchMigrateResourcesOperationMetadata/PartialResult.php index b7f919a85ffa..92b74b262b78 100644 --- a/AiPlatform/src/V1/BatchMigrateResourcesOperationMetadata/PartialResult.php +++ b/AiPlatform/src/V1/BatchMigrateResourcesOperationMetadata/PartialResult.php @@ -22,7 +22,7 @@ class PartialResult extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.MigrateResourceRequest request = 1; */ - private $request = null; + protected $request = null; protected $result; /** diff --git a/AiPlatform/src/V1/BatchMigrateResourcesRequest.php b/AiPlatform/src/V1/BatchMigrateResourcesRequest.php index e0097199bc6c..c58534bdd59d 100644 --- a/AiPlatform/src/V1/BatchMigrateResourcesRequest.php +++ b/AiPlatform/src/V1/BatchMigrateResourcesRequest.php @@ -22,7 +22,7 @@ class BatchMigrateResourcesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The request messages specifying the resources to migrate. * They must be in the same location as the destination. diff --git a/AiPlatform/src/V1/BatchPredictionJob.php b/AiPlatform/src/V1/BatchPredictionJob.php index d7febb009361..3c43ceb23356 100644 --- a/AiPlatform/src/V1/BatchPredictionJob.php +++ b/AiPlatform/src/V1/BatchPredictionJob.php @@ -25,13 +25,13 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The user-defined name of this BatchPredictionJob. * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * The name of the Model resource that produces the predictions via this job, * must share the same ancestor Location. @@ -51,14 +51,14 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 3 [(.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * Output only. The version ID of the Model that produces the predictions via * this job. * * Generated from protobuf field string model_version_id = 30 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $model_version_id = ''; + protected $model_version_id = ''; /** * Contains model information necessary to perform batch prediction without * requiring uploading to model registry. @@ -66,7 +66,7 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.UnmanagedContainerModel unmanaged_container_model = 28; */ - private $unmanaged_container_model = null; + protected $unmanaged_container_model = null; /** * Required. Input configuration of the instances on which predictions are * performed. The schema of any single instance may be specified via the @@ -76,14 +76,14 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.BatchPredictionJob.InputConfig input_config = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $input_config = null; + protected $input_config = null; /** * Configuration for how to convert batch prediction input instances to the * prediction instances that are sent to the Model. * * Generated from protobuf field .google.cloud.aiplatform.v1.BatchPredictionJob.InstanceConfig instance_config = 27; */ - private $instance_config = null; + protected $instance_config = null; /** * The parameters that govern the predictions. The schema of the parameters * may be specified via the @@ -93,7 +93,7 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value model_parameters = 5; */ - private $model_parameters = null; + protected $model_parameters = null; /** * Required. The Configuration specifying where output predictions should * be written. @@ -106,7 +106,7 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.BatchPredictionJob.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $output_config = null; + protected $output_config = null; /** * The config of resources used by the Model during the batch prediction. If * the Model @@ -117,7 +117,7 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.BatchDedicatedResources dedicated_resources = 7; */ - private $dedicated_resources = null; + protected $dedicated_resources = null; /** * The service account that the DeployedModel's container runs as. If not * specified, a system generated one will be used, which @@ -128,7 +128,7 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 29; */ - private $service_account = ''; + protected $service_account = ''; /** * Immutable. Parameters configuring the batch behavior. Currently only * applicable when @@ -137,7 +137,7 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ManualBatchTuningParameters manual_batch_tuning_parameters = 8 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $manual_batch_tuning_parameters = null; + protected $manual_batch_tuning_parameters = null; /** * Generate explanation with the batch prediction results. * When set to `true`, the batch prediction output changes based on the @@ -160,7 +160,7 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool generate_explanation = 23; */ - private $generate_explanation = false; + protected $generate_explanation = false; /** * Explanation configuration for this BatchPredictionJob. Can be * specified only if @@ -178,26 +178,26 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationSpec explanation_spec = 25; */ - private $explanation_spec = null; + protected $explanation_spec = null; /** * Output only. Information further describing the output of this job. * * Generated from protobuf field .google.cloud.aiplatform.v1.BatchPredictionJob.OutputInfo output_info = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $output_info = null; + protected $output_info = null; /** * Output only. The detailed state of the job. * * Generated from protobuf field .google.cloud.aiplatform.v1.JobState state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Only populated when the job's state is JOB_STATE_FAILED or * JOB_STATE_CANCELLED. * * Generated from protobuf field .google.rpc.Status error = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Output only. Partial failures encountered. * For example, single files that can't be read. @@ -216,39 +216,39 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ResourcesConsumed resources_consumed = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $resources_consumed = null; + protected $resources_consumed = null; /** * Output only. Statistics on completed and failed prediction instances. * * Generated from protobuf field .google.cloud.aiplatform.v1.CompletionStats completion_stats = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $completion_stats = null; + protected $completion_stats = null; /** * Output only. Time when the BatchPredictionJob was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Time when the BatchPredictionJob for the first time entered * the `JOB_STATE_RUNNING` state. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Time when the BatchPredictionJob entered any of the following * states: `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Time when the BatchPredictionJob was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The labels with user-defined metadata to organize BatchPredictionJobs. * Label keys and values can be no longer than 64 characters @@ -266,7 +266,7 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 24; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * For custom-trained Models and AutoML Tabular Models, the container of the * DeployedModel instances will send `stderr` and `stdout` streams to @@ -277,7 +277,7 @@ class BatchPredictionJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disable_container_logging = 34; */ - private $disable_container_logging = false; + protected $disable_container_logging = false; /** * Constructor. diff --git a/AiPlatform/src/V1/BatchPredictionJob/InputConfig.php b/AiPlatform/src/V1/BatchPredictionJob/InputConfig.php index f210bdd1910e..4885036c77ec 100644 --- a/AiPlatform/src/V1/BatchPredictionJob/InputConfig.php +++ b/AiPlatform/src/V1/BatchPredictionJob/InputConfig.php @@ -26,7 +26,7 @@ class InputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instances_format = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_format = ''; + protected $instances_format = ''; protected $source; /** diff --git a/AiPlatform/src/V1/BatchPredictionJob/InstanceConfig.php b/AiPlatform/src/V1/BatchPredictionJob/InstanceConfig.php index f2411be6b90f..1710f6b9fd3e 100644 --- a/AiPlatform/src/V1/BatchPredictionJob/InstanceConfig.php +++ b/AiPlatform/src/V1/BatchPredictionJob/InstanceConfig.php @@ -57,7 +57,7 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_type = 1; */ - private $instance_type = ''; + protected $instance_type = ''; /** * The name of the field that is considered as a key. * The values identified by the key field is not included in the transformed @@ -76,7 +76,7 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key_field = 2; */ - private $key_field = ''; + protected $key_field = ''; /** * Fields that will be included in the prediction instance that is * sent to the Model. diff --git a/AiPlatform/src/V1/BatchPredictionJob/OutputConfig.php b/AiPlatform/src/V1/BatchPredictionJob/OutputConfig.php index 550659bf09fb..dcbebfa074d9 100644 --- a/AiPlatform/src/V1/BatchPredictionJob/OutputConfig.php +++ b/AiPlatform/src/V1/BatchPredictionJob/OutputConfig.php @@ -26,7 +26,7 @@ class OutputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string predictions_format = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $predictions_format = ''; + protected $predictions_format = ''; protected $destination; /** diff --git a/AiPlatform/src/V1/BatchPredictionJob/OutputInfo.php b/AiPlatform/src/V1/BatchPredictionJob/OutputInfo.php index b62dcd6102e4..387910e4004c 100644 --- a/AiPlatform/src/V1/BatchPredictionJob/OutputInfo.php +++ b/AiPlatform/src/V1/BatchPredictionJob/OutputInfo.php @@ -25,7 +25,7 @@ class OutputInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string bigquery_output_table = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $bigquery_output_table = ''; + protected $bigquery_output_table = ''; protected $output_location; /** diff --git a/AiPlatform/src/V1/BatchReadFeatureValuesOperationMetadata.php b/AiPlatform/src/V1/BatchReadFeatureValuesOperationMetadata.php index 957f2ec81474..1514117ac054 100644 --- a/AiPlatform/src/V1/BatchReadFeatureValuesOperationMetadata.php +++ b/AiPlatform/src/V1/BatchReadFeatureValuesOperationMetadata.php @@ -20,7 +20,7 @@ class BatchReadFeatureValuesOperationMetadata extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/BatchReadFeatureValuesRequest.php b/AiPlatform/src/V1/BatchReadFeatureValuesRequest.php index 19076f9e6365..ab375753fdc3 100644 --- a/AiPlatform/src/V1/BatchReadFeatureValuesRequest.php +++ b/AiPlatform/src/V1/BatchReadFeatureValuesRequest.php @@ -23,13 +23,13 @@ class BatchReadFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string featurestore = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $featurestore = ''; + protected $featurestore = ''; /** * Required. Specifies output location and format. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureValueDestination destination = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $destination = null; + protected $destination = null; /** * When not empty, the specified fields in the *_read_instances source will be * joined as-is in the output, in addition to those fields from the @@ -55,7 +55,7 @@ class BatchReadFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 11 [(.google.api.field_behavior) = OPTIONAL]; */ - private $start_time = null; + protected $start_time = null; protected $read_option; /** diff --git a/AiPlatform/src/V1/BatchReadFeatureValuesRequest/EntityTypeSpec.php b/AiPlatform/src/V1/BatchReadFeatureValuesRequest/EntityTypeSpec.php index dca55c266df8..a23c66b53fed 100644 --- a/AiPlatform/src/V1/BatchReadFeatureValuesRequest/EntityTypeSpec.php +++ b/AiPlatform/src/V1/BatchReadFeatureValuesRequest/EntityTypeSpec.php @@ -24,14 +24,14 @@ class EntityTypeSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_type_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $entity_type_id = ''; + protected $entity_type_id = ''; /** * Required. Selectors choosing which Feature values to read from the * EntityType. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureSelector feature_selector = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_selector = null; + protected $feature_selector = null; /** * Per-Feature settings for the batch read. * diff --git a/AiPlatform/src/V1/BatchReadFeatureValuesRequest/PassThroughField.php b/AiPlatform/src/V1/BatchReadFeatureValuesRequest/PassThroughField.php index 83e57998799f..068c02aeaa5a 100644 --- a/AiPlatform/src/V1/BatchReadFeatureValuesRequest/PassThroughField.php +++ b/AiPlatform/src/V1/BatchReadFeatureValuesRequest/PassThroughField.php @@ -22,7 +22,7 @@ class PassThroughField extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string field_name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $field_name = ''; + protected $field_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/BatchReadTensorboardTimeSeriesDataRequest.php b/AiPlatform/src/V1/BatchReadTensorboardTimeSeriesDataRequest.php index 4f4e4e3a2d4c..e2d1d43e92d3 100644 --- a/AiPlatform/src/V1/BatchReadTensorboardTimeSeriesDataRequest.php +++ b/AiPlatform/src/V1/BatchReadTensorboardTimeSeriesDataRequest.php @@ -26,7 +26,7 @@ class BatchReadTensorboardTimeSeriesDataRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string tensorboard = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $tensorboard = ''; + protected $tensorboard = ''; /** * Required. The resource names of the TensorboardTimeSeries to read data * from. Format: diff --git a/AiPlatform/src/V1/BigQueryDestination.php b/AiPlatform/src/V1/BigQueryDestination.php index e86f4abb37a9..54f26730bb7a 100644 --- a/AiPlatform/src/V1/BigQueryDestination.php +++ b/AiPlatform/src/V1/BigQueryDestination.php @@ -27,7 +27,7 @@ class BigQueryDestination extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string output_uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $output_uri = ''; + protected $output_uri = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/BigQuerySource.php b/AiPlatform/src/V1/BigQuerySource.php index c88341002a1a..21cde2f1e7fc 100644 --- a/AiPlatform/src/V1/BigQuerySource.php +++ b/AiPlatform/src/V1/BigQuerySource.php @@ -22,7 +22,7 @@ class BigQuerySource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $input_uri = ''; + protected $input_uri = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/Blob.php b/AiPlatform/src/V1/Blob.php index 13e490bfab4c..e930d980dc15 100644 --- a/AiPlatform/src/V1/Blob.php +++ b/AiPlatform/src/V1/Blob.php @@ -22,13 +22,13 @@ class Blob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $mime_type = ''; + protected $mime_type = ''; /** * Required. Raw bytes. * * Generated from protobuf field bytes data = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $data = ''; + protected $data = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/BlurBaselineConfig.php b/AiPlatform/src/V1/BlurBaselineConfig.php index f92a00632594..511227fc1dbd 100644 --- a/AiPlatform/src/V1/BlurBaselineConfig.php +++ b/AiPlatform/src/V1/BlurBaselineConfig.php @@ -27,7 +27,7 @@ class BlurBaselineConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float max_blur_sigma = 1; */ - private $max_blur_sigma = 0.0; + protected $max_blur_sigma = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/CancelBatchPredictionJobRequest.php b/AiPlatform/src/V1/CancelBatchPredictionJobRequest.php index e29615360207..5b0d4263f1ee 100644 --- a/AiPlatform/src/V1/CancelBatchPredictionJobRequest.php +++ b/AiPlatform/src/V1/CancelBatchPredictionJobRequest.php @@ -23,7 +23,7 @@ class CancelBatchPredictionJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the BatchPredictionJob to cancel. diff --git a/AiPlatform/src/V1/CancelCustomJobRequest.php b/AiPlatform/src/V1/CancelCustomJobRequest.php index d3d192402e96..25ee68df6bf6 100644 --- a/AiPlatform/src/V1/CancelCustomJobRequest.php +++ b/AiPlatform/src/V1/CancelCustomJobRequest.php @@ -23,7 +23,7 @@ class CancelCustomJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the CustomJob to cancel. diff --git a/AiPlatform/src/V1/CancelDataLabelingJobRequest.php b/AiPlatform/src/V1/CancelDataLabelingJobRequest.php index 79f5eaf19606..e8c568532703 100644 --- a/AiPlatform/src/V1/CancelDataLabelingJobRequest.php +++ b/AiPlatform/src/V1/CancelDataLabelingJobRequest.php @@ -23,7 +23,7 @@ class CancelDataLabelingJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the DataLabelingJob. diff --git a/AiPlatform/src/V1/CancelHyperparameterTuningJobRequest.php b/AiPlatform/src/V1/CancelHyperparameterTuningJobRequest.php index f642062ebf0e..4705d020add8 100644 --- a/AiPlatform/src/V1/CancelHyperparameterTuningJobRequest.php +++ b/AiPlatform/src/V1/CancelHyperparameterTuningJobRequest.php @@ -23,7 +23,7 @@ class CancelHyperparameterTuningJobRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the HyperparameterTuningJob to cancel. diff --git a/AiPlatform/src/V1/CancelNasJobRequest.php b/AiPlatform/src/V1/CancelNasJobRequest.php index aa809c3b32ab..f594cf23a0eb 100644 --- a/AiPlatform/src/V1/CancelNasJobRequest.php +++ b/AiPlatform/src/V1/CancelNasJobRequest.php @@ -23,7 +23,7 @@ class CancelNasJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NasJob to cancel. diff --git a/AiPlatform/src/V1/CancelPipelineJobRequest.php b/AiPlatform/src/V1/CancelPipelineJobRequest.php index 464e7ca3caf3..22cd0124a111 100644 --- a/AiPlatform/src/V1/CancelPipelineJobRequest.php +++ b/AiPlatform/src/V1/CancelPipelineJobRequest.php @@ -23,7 +23,7 @@ class CancelPipelineJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the PipelineJob to cancel. diff --git a/AiPlatform/src/V1/CancelTrainingPipelineRequest.php b/AiPlatform/src/V1/CancelTrainingPipelineRequest.php index 65d23ef5503c..2566bb7d2ba5 100644 --- a/AiPlatform/src/V1/CancelTrainingPipelineRequest.php +++ b/AiPlatform/src/V1/CancelTrainingPipelineRequest.php @@ -23,7 +23,7 @@ class CancelTrainingPipelineRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TrainingPipeline to cancel. diff --git a/AiPlatform/src/V1/CancelTuningJobRequest.php b/AiPlatform/src/V1/CancelTuningJobRequest.php index ef70fd619cf4..446445bd9371 100644 --- a/AiPlatform/src/V1/CancelTuningJobRequest.php +++ b/AiPlatform/src/V1/CancelTuningJobRequest.php @@ -22,7 +22,7 @@ class CancelTuningJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TuningJob to cancel. Format: diff --git a/AiPlatform/src/V1/Candidate.php b/AiPlatform/src/V1/Candidate.php index 6c5da00e5d90..65c4e00b517a 100644 --- a/AiPlatform/src/V1/Candidate.php +++ b/AiPlatform/src/V1/Candidate.php @@ -20,20 +20,20 @@ class Candidate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $index = 0; + protected $index = 0; /** * Output only. Content parts of the candidate. * * Generated from protobuf field .google.cloud.aiplatform.v1.Content content = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $content = null; + protected $content = null; /** * Output only. The reason why the model stopped generating tokens. * If empty, the model has not stopped generating the tokens. * * Generated from protobuf field .google.cloud.aiplatform.v1.Candidate.FinishReason finish_reason = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $finish_reason = 0; + protected $finish_reason = 0; /** * Output only. List of ratings for the safety of a response candidate. * There is at most one rating per category. @@ -47,19 +47,19 @@ class Candidate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string finish_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $finish_message = null; + protected $finish_message = null; /** * Output only. Source attribution of the generated content. * * Generated from protobuf field .google.cloud.aiplatform.v1.CitationMetadata citation_metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $citation_metadata = null; + protected $citation_metadata = null; /** * Output only. Metadata specifies sources used to ground generated content. * * Generated from protobuf field .google.cloud.aiplatform.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $grounding_metadata = null; + protected $grounding_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CheckTrialEarlyStoppingStateMetatdata.php b/AiPlatform/src/V1/CheckTrialEarlyStoppingStateMetatdata.php index 293db41980f5..9a84e406a556 100644 --- a/AiPlatform/src/V1/CheckTrialEarlyStoppingStateMetatdata.php +++ b/AiPlatform/src/V1/CheckTrialEarlyStoppingStateMetatdata.php @@ -22,19 +22,19 @@ class CheckTrialEarlyStoppingStateMetatdata extends \Google\Protobuf\Internal\Me * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * The name of the Study that the Trial belongs to. * * Generated from protobuf field string study = 2; */ - private $study = ''; + protected $study = ''; /** * The Trial name. * * Generated from protobuf field string trial = 3; */ - private $trial = ''; + protected $trial = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/CheckTrialEarlyStoppingStateRequest.php b/AiPlatform/src/V1/CheckTrialEarlyStoppingStateRequest.php index 6ba2069913a4..c27050cd570c 100644 --- a/AiPlatform/src/V1/CheckTrialEarlyStoppingStateRequest.php +++ b/AiPlatform/src/V1/CheckTrialEarlyStoppingStateRequest.php @@ -23,7 +23,7 @@ class CheckTrialEarlyStoppingStateRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string trial_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $trial_name = ''; + protected $trial_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/CheckTrialEarlyStoppingStateResponse.php b/AiPlatform/src/V1/CheckTrialEarlyStoppingStateResponse.php index 032ebb333431..480a948c3d90 100644 --- a/AiPlatform/src/V1/CheckTrialEarlyStoppingStateResponse.php +++ b/AiPlatform/src/V1/CheckTrialEarlyStoppingStateResponse.php @@ -21,7 +21,7 @@ class CheckTrialEarlyStoppingStateResponse extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field bool should_stop = 1; */ - private $should_stop = false; + protected $should_stop = false; /** * Constructor. diff --git a/AiPlatform/src/V1/Citation.php b/AiPlatform/src/V1/Citation.php index 0ffa2191513d..7fc4c4f8df49 100644 --- a/AiPlatform/src/V1/Citation.php +++ b/AiPlatform/src/V1/Citation.php @@ -20,37 +20,37 @@ class Citation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 start_index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_index = 0; + protected $start_index = 0; /** * Output only. End index into the content. * * Generated from protobuf field int32 end_index = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_index = 0; + protected $end_index = 0; /** * Output only. Url reference of the attribution. * * Generated from protobuf field string uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uri = ''; + protected $uri = ''; /** * Output only. Title of the attribution. * * Generated from protobuf field string title = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $title = ''; + protected $title = ''; /** * Output only. License of the attribution. * * Generated from protobuf field string license = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $license = ''; + protected $license = ''; /** * Output only. Publication date of the attribution. * * Generated from protobuf field .google.type.Date publication_date = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $publication_date = null; + protected $publication_date = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Client/DatasetServiceClient.php b/AiPlatform/src/V1/Client/DatasetServiceClient.php index d1f1c8f1ce9d..77f9b2213f5b 100644 --- a/AiPlatform/src/V1/Client/DatasetServiceClient.php +++ b/AiPlatform/src/V1/Client/DatasetServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a * annotation_spec resource. @@ -194,8 +213,12 @@ public function resumeOperation($operationName, $methodName = null) * * @return string The formatted annotation_spec resource. */ - public static function annotationSpecName(string $project, string $location, string $dataset, string $annotationSpec): string - { + public static function annotationSpecName( + string $project, + string $location, + string $dataset, + string $annotationSpec + ): string { return self::getPathTemplate('annotationSpec')->render([ 'project' => $project, 'location' => $location, @@ -255,8 +278,12 @@ public static function datasetName(string $project, string $location, string $da * * @return string The formatted dataset_version resource. */ - public static function datasetVersionName(string $project, string $location, string $dataset, string $datasetVersion): string - { + public static function datasetVersionName( + string $project, + string $location, + string $dataset, + string $datasetVersion + ): string { return self::getPathTemplate('datasetVersion')->render([ 'project' => $project, 'location' => $location, @@ -293,8 +320,12 @@ public static function locationName(string $project, string $location): string * * @return string The formatted saved_query resource. */ - public static function savedQueryName(string $project, string $location, string $dataset, string $savedQuery): string - { + public static function savedQueryName( + string $project, + string $location, + string $dataset, + string $savedQuery + ): string { return self::getPathTemplate('savedQuery')->render([ 'project' => $project, 'location' => $location, @@ -451,8 +482,10 @@ public function createDataset(CreateDatasetRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function createDatasetVersion(CreateDatasetVersionRequest $request, array $callOptions = []): OperationResponse - { + public function createDatasetVersion( + CreateDatasetVersionRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateDatasetVersion', $request, $callOptions)->wait(); } @@ -503,8 +536,10 @@ public function deleteDataset(DeleteDatasetRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function deleteDatasetVersion(DeleteDatasetVersionRequest $request, array $callOptions = []): OperationResponse - { + public function deleteDatasetVersion( + DeleteDatasetVersionRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteDatasetVersion', $request, $callOptions)->wait(); } @@ -815,8 +850,10 @@ public function listSavedQueries(ListSavedQueriesRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function restoreDatasetVersion(RestoreDatasetVersionRequest $request, array $callOptions = []): OperationResponse - { + public function restoreDatasetVersion( + RestoreDatasetVersionRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RestoreDatasetVersion', $request, $callOptions)->wait(); } @@ -1034,8 +1071,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/DeploymentResourcePoolServiceClient.php b/AiPlatform/src/V1/Client/DeploymentResourcePoolServiceClient.php index 336ae5d76cf5..c63faeb2801d 100644 --- a/AiPlatform/src/V1/Client/DeploymentResourcePoolServiceClient.php +++ b/AiPlatform/src/V1/Client/DeploymentResourcePoolServiceClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/deployment_resource_pool_service_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/deployment_resource_pool_service_rest_client_config.php', ], ], ]; @@ -147,12 +146,33 @@ public function getOperationsClient() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a * deployment_resource_pool resource. @@ -163,8 +183,11 @@ public function resumeOperation($operationName, $methodName = null) * * @return string The formatted deployment_resource_pool resource. */ - public static function deploymentResourcePoolName(string $project, string $location, string $deploymentResourcePool): string - { + public static function deploymentResourcePoolName( + string $project, + string $location, + string $deploymentResourcePool + ): string { return self::getPathTemplate('deploymentResourcePool')->render([ 'project' => $project, 'location' => $location, @@ -325,8 +348,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function createDeploymentResourcePool(CreateDeploymentResourcePoolRequest $request, array $callOptions = []): OperationResponse - { + public function createDeploymentResourcePool( + CreateDeploymentResourcePoolRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateDeploymentResourcePool', $request, $callOptions)->wait(); } @@ -353,8 +378,10 @@ public function createDeploymentResourcePool(CreateDeploymentResourcePoolRequest * * @throws ApiException Thrown if the API call fails. */ - public function deleteDeploymentResourcePool(DeleteDeploymentResourcePoolRequest $request, array $callOptions = []): OperationResponse - { + public function deleteDeploymentResourcePool( + DeleteDeploymentResourcePoolRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteDeploymentResourcePool', $request, $callOptions)->wait(); } @@ -380,8 +407,10 @@ public function deleteDeploymentResourcePool(DeleteDeploymentResourcePoolRequest * * @throws ApiException Thrown if the API call fails. */ - public function getDeploymentResourcePool(GetDeploymentResourcePoolRequest $request, array $callOptions = []): DeploymentResourcePool - { + public function getDeploymentResourcePool( + GetDeploymentResourcePoolRequest $request, + array $callOptions = [] + ): DeploymentResourcePool { return $this->startApiCall('GetDeploymentResourcePool', $request, $callOptions)->wait(); } @@ -407,8 +436,10 @@ public function getDeploymentResourcePool(GetDeploymentResourcePoolRequest $requ * * @throws ApiException Thrown if the API call fails. */ - public function listDeploymentResourcePools(ListDeploymentResourcePoolsRequest $request, array $callOptions = []): PagedListResponse - { + public function listDeploymentResourcePools( + ListDeploymentResourcePoolsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListDeploymentResourcePools', $request, $callOptions); } @@ -580,8 +611,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/EndpointServiceClient.php b/AiPlatform/src/V1/Client/EndpointServiceClient.php index ddf837f81fa7..3745f6f09496 100644 --- a/AiPlatform/src/V1/Client/EndpointServiceClient.php +++ b/AiPlatform/src/V1/Client/EndpointServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a * deployment_resource_pool resource. @@ -169,8 +188,11 @@ public function resumeOperation($operationName, $methodName = null) * * @return string The formatted deployment_resource_pool resource. */ - public static function deploymentResourcePoolName(string $project, string $location, string $deploymentResourcePool): string - { + public static function deploymentResourcePoolName( + string $project, + string $location, + string $deploymentResourcePool + ): string { return self::getPathTemplate('deploymentResourcePool')->render([ 'project' => $project, 'location' => $location, @@ -243,8 +265,11 @@ public static function modelName(string $project, string $location, string $mode * * @return string The formatted model_deployment_monitoring_job resource. */ - public static function modelDeploymentMonitoringJobName(string $project, string $location, string $modelDeploymentMonitoringJob): string - { + public static function modelDeploymentMonitoringJobName( + string $project, + string $location, + string $modelDeploymentMonitoringJob + ): string { return self::getPathTemplate('modelDeploymentMonitoringJob')->render([ 'project' => $project, 'location' => $location, @@ -299,8 +324,12 @@ public static function projectLocationEndpointName(string $project, string $loca * * @return string The formatted project_location_publisher_model resource. */ - public static function projectLocationPublisherModelName(string $project, string $location, string $publisher, string $model): string - { + public static function projectLocationPublisherModelName( + string $project, + string $location, + string $publisher, + string $model + ): string { return self::getPathTemplate('projectLocationPublisherModel')->render([ 'project' => $project, 'location' => $location, @@ -760,8 +789,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/FeatureOnlineStoreAdminServiceClient.php b/AiPlatform/src/V1/Client/FeatureOnlineStoreAdminServiceClient.php index c265b4ee04d9..229d9b445503 100644 --- a/AiPlatform/src/V1/Client/FeatureOnlineStoreAdminServiceClient.php +++ b/AiPlatform/src/V1/Client/FeatureOnlineStoreAdminServiceClient.php @@ -1,6 +1,6 @@ self::SERVICE_NAME, 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, 'clientConfig' => __DIR__ . '/../resources/feature_online_store_admin_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/feature_online_store_admin_service_descriptor_config.php', + 'descriptorsConfigPath' => + __DIR__ . '/../resources/feature_online_store_admin_service_descriptor_config.php', 'gcpApiConfigPath' => __DIR__ . '/../resources/feature_online_store_admin_service_grpc_config.json', 'credentialsConfig' => [ 'defaultScopes' => self::$serviceScopes, ], 'transportConfig' => [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/feature_online_store_admin_service_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/feature_online_store_admin_service_rest_client_config.php', ], ], ]; @@ -167,12 +167,33 @@ public function getOperationsClient() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a * feature_online_store resource. @@ -203,8 +224,12 @@ public static function featureOnlineStoreName(string $project, string $location, * * @return string The formatted feature_view resource. */ - public static function featureViewName(string $project, string $location, string $featureOnlineStore, string $featureView): string - { + public static function featureViewName( + string $project, + string $location, + string $featureOnlineStore, + string $featureView + ): string { return self::getPathTemplate('featureView')->render([ 'project' => $project, 'location' => $location, @@ -224,8 +249,12 @@ public static function featureViewName(string $project, string $location, string * * @return string The formatted feature_view_sync resource. */ - public static function featureViewSyncName(string $project, string $location, string $featureOnlineStore, string $featureView): string - { + public static function featureViewSyncName( + string $project, + string $location, + string $featureOnlineStore, + string $featureView + ): string { return self::getPathTemplate('featureViewSync')->render([ 'project' => $project, 'location' => $location, @@ -372,8 +401,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function createFeatureOnlineStore(CreateFeatureOnlineStoreRequest $request, array $callOptions = []): OperationResponse - { + public function createFeatureOnlineStore( + CreateFeatureOnlineStoreRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateFeatureOnlineStore', $request, $callOptions)->wait(); } @@ -427,8 +458,10 @@ public function createFeatureView(CreateFeatureViewRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function deleteFeatureOnlineStore(DeleteFeatureOnlineStoreRequest $request, array $callOptions = []): OperationResponse - { + public function deleteFeatureOnlineStore( + DeleteFeatureOnlineStoreRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteFeatureOnlineStore', $request, $callOptions)->wait(); } @@ -481,8 +514,10 @@ public function deleteFeatureView(DeleteFeatureViewRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function getFeatureOnlineStore(GetFeatureOnlineStoreRequest $request, array $callOptions = []): FeatureOnlineStore - { + public function getFeatureOnlineStore( + GetFeatureOnlineStoreRequest $request, + array $callOptions = [] + ): FeatureOnlineStore { return $this->startApiCall('GetFeatureOnlineStore', $request, $callOptions)->wait(); } @@ -562,8 +597,10 @@ public function getFeatureViewSync(GetFeatureViewSyncRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function listFeatureOnlineStores(ListFeatureOnlineStoresRequest $request, array $callOptions = []): PagedListResponse - { + public function listFeatureOnlineStores( + ListFeatureOnlineStoresRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListFeatureOnlineStores', $request, $callOptions); } @@ -589,8 +626,10 @@ public function listFeatureOnlineStores(ListFeatureOnlineStoresRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function listFeatureViewSyncs(ListFeatureViewSyncsRequest $request, array $callOptions = []): PagedListResponse - { + public function listFeatureViewSyncs( + ListFeatureViewSyncsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListFeatureViewSyncs', $request, $callOptions); } @@ -670,8 +709,10 @@ public function syncFeatureView(SyncFeatureViewRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function updateFeatureOnlineStore(UpdateFeatureOnlineStoreRequest $request, array $callOptions = []): OperationResponse - { + public function updateFeatureOnlineStore( + UpdateFeatureOnlineStoreRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateFeatureOnlineStore', $request, $callOptions)->wait(); } @@ -843,8 +884,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/FeatureOnlineStoreServiceClient.php b/AiPlatform/src/V1/Client/FeatureOnlineStoreServiceClient.php index fc1eeba27c46..500d0fddeeb6 100644 --- a/AiPlatform/src/V1/Client/FeatureOnlineStoreServiceClient.php +++ b/AiPlatform/src/V1/Client/FeatureOnlineStoreServiceClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/feature_online_store_service_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/feature_online_store_service_rest_client_config.php', ], ], ]; @@ -125,8 +124,12 @@ private static function getClientDefaults() * * @return string The formatted feature_view resource. */ - public static function featureViewName(string $project, string $location, string $featureOnlineStore, string $featureView): string - { + public static function featureViewName( + string $project, + string $location, + string $featureOnlineStore, + string $featureView + ): string { return self::getPathTemplate('featureView')->render([ 'project' => $project, 'location' => $location, @@ -252,8 +255,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function fetchFeatureValues(FetchFeatureValuesRequest $request, array $callOptions = []): FetchFeatureValuesResponse - { + public function fetchFeatureValues( + FetchFeatureValuesRequest $request, + array $callOptions = [] + ): FetchFeatureValuesResponse { return $this->startApiCall('FetchFeatureValues', $request, $callOptions)->wait(); } @@ -281,8 +286,10 @@ public function fetchFeatureValues(FetchFeatureValuesRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function searchNearestEntities(SearchNearestEntitiesRequest $request, array $callOptions = []): SearchNearestEntitiesResponse - { + public function searchNearestEntities( + SearchNearestEntitiesRequest $request, + array $callOptions = [] + ): SearchNearestEntitiesResponse { return $this->startApiCall('SearchNearestEntities', $request, $callOptions)->wait(); } @@ -427,8 +434,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/FeatureRegistryServiceClient.php b/AiPlatform/src/V1/Client/FeatureRegistryServiceClient.php index 091f0b57e812..3fce584de365 100644 --- a/AiPlatform/src/V1/Client/FeatureRegistryServiceClient.php +++ b/AiPlatform/src/V1/Client/FeatureRegistryServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a entity_type * resource. @@ -176,8 +195,12 @@ public function resumeOperation($operationName, $methodName = null) * * @return string The formatted entity_type resource. */ - public static function entityTypeName(string $project, string $location, string $featurestore, string $entityType): string - { + public static function entityTypeName( + string $project, + string $location, + string $featurestore, + string $entityType + ): string { return self::getPathTemplate('entityType')->render([ 'project' => $project, 'location' => $location, @@ -198,8 +221,13 @@ public static function entityTypeName(string $project, string $location, string * * @return string The formatted feature resource. */ - public static function featureName(string $project, string $location, string $featurestore, string $entityType, string $feature): string - { + public static function featureName( + string $project, + string $location, + string $featurestore, + string $entityType, + string $feature + ): string { return self::getPathTemplate('feature')->render([ 'project' => $project, 'location' => $location, @@ -256,8 +284,12 @@ public static function locationName(string $project, string $location): string * * @return string The formatted project_location_feature_group_feature resource. */ - public static function projectLocationFeatureGroupFeatureName(string $project, string $location, string $featureGroup, string $feature): string - { + public static function projectLocationFeatureGroupFeatureName( + string $project, + string $location, + string $featureGroup, + string $feature + ): string { return self::getPathTemplate('projectLocationFeatureGroupFeature')->render([ 'project' => $project, 'location' => $location, @@ -278,8 +310,13 @@ public static function projectLocationFeatureGroupFeatureName(string $project, s * * @return string The formatted project_location_featurestore_entity_type_feature resource. */ - public static function projectLocationFeaturestoreEntityTypeFeatureName(string $project, string $location, string $featurestore, string $entityType, string $feature): string - { + public static function projectLocationFeaturestoreEntityTypeFeatureName( + string $project, + string $location, + string $featurestore, + string $entityType, + string $feature + ): string { return self::getPathTemplate('projectLocationFeaturestoreEntityTypeFeature')->render([ 'project' => $project, 'location' => $location, @@ -792,8 +829,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/FeaturestoreOnlineServingServiceClient.php b/AiPlatform/src/V1/Client/FeaturestoreOnlineServingServiceClient.php index 9441f86dae93..9093868c0b76 100644 --- a/AiPlatform/src/V1/Client/FeaturestoreOnlineServingServiceClient.php +++ b/AiPlatform/src/V1/Client/FeaturestoreOnlineServingServiceClient.php @@ -1,6 +1,6 @@ self::SERVICE_NAME, 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, 'clientConfig' => __DIR__ . '/../resources/featurestore_online_serving_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/featurestore_online_serving_service_descriptor_config.php', + 'descriptorsConfigPath' => + __DIR__ . '/../resources/featurestore_online_serving_service_descriptor_config.php', 'gcpApiConfigPath' => __DIR__ . '/../resources/featurestore_online_serving_service_grpc_config.json', 'credentialsConfig' => [ 'defaultScopes' => self::$serviceScopes, ], 'transportConfig' => [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/featurestore_online_serving_service_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/featurestore_online_serving_service_rest_client_config.php', ], ], ]; @@ -127,8 +127,12 @@ private static function getClientDefaults() * * @return string The formatted entity_type resource. */ - public static function entityTypeName(string $project, string $location, string $featurestore, string $entityType): string - { + public static function entityTypeName( + string $project, + string $location, + string $featurestore, + string $entityType + ): string { return self::getPathTemplate('entityType')->render([ 'project' => $project, 'location' => $location, @@ -256,8 +260,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function readFeatureValues(ReadFeatureValuesRequest $request, array $callOptions = []): ReadFeatureValuesResponse - { + public function readFeatureValues( + ReadFeatureValuesRequest $request, + array $callOptions = [] + ): ReadFeatureValuesResponse { return $this->startApiCall('ReadFeatureValues', $request, $callOptions)->wait(); } @@ -280,8 +286,10 @@ public function readFeatureValues(ReadFeatureValuesRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function streamingReadFeatureValues(StreamingReadFeatureValuesRequest $request, array $callOptions = []): ServerStream - { + public function streamingReadFeatureValues( + StreamingReadFeatureValuesRequest $request, + array $callOptions = [] + ): ServerStream { return $this->startApiCall('StreamingReadFeatureValues', $request, $callOptions); } @@ -311,8 +319,10 @@ public function streamingReadFeatureValues(StreamingReadFeatureValuesRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function writeFeatureValues(WriteFeatureValuesRequest $request, array $callOptions = []): WriteFeatureValuesResponse - { + public function writeFeatureValues( + WriteFeatureValuesRequest $request, + array $callOptions = [] + ): WriteFeatureValuesResponse { return $this->startApiCall('WriteFeatureValues', $request, $callOptions)->wait(); } @@ -457,8 +467,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/FeaturestoreServiceClient.php b/AiPlatform/src/V1/Client/FeaturestoreServiceClient.php index c623bbb3673b..e09cb7bd6c86 100644 --- a/AiPlatform/src/V1/Client/FeaturestoreServiceClient.php +++ b/AiPlatform/src/V1/Client/FeaturestoreServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a entity_type * resource. @@ -198,8 +217,12 @@ public function resumeOperation($operationName, $methodName = null) * * @return string The formatted entity_type resource. */ - public static function entityTypeName(string $project, string $location, string $featurestore, string $entityType): string - { + public static function entityTypeName( + string $project, + string $location, + string $featurestore, + string $entityType + ): string { return self::getPathTemplate('entityType')->render([ 'project' => $project, 'location' => $location, @@ -220,8 +243,13 @@ public static function entityTypeName(string $project, string $location, string * * @return string The formatted feature resource. */ - public static function featureName(string $project, string $location, string $featurestore, string $entityType, string $feature): string - { + public static function featureName( + string $project, + string $location, + string $featurestore, + string $entityType, + string $feature + ): string { return self::getPathTemplate('feature')->render([ 'project' => $project, 'location' => $location, @@ -297,8 +325,12 @@ public static function locationName(string $project, string $location): string * * @return string The formatted project_location_feature_group_feature resource. */ - public static function projectLocationFeatureGroupFeatureName(string $project, string $location, string $featureGroup, string $feature): string - { + public static function projectLocationFeatureGroupFeatureName( + string $project, + string $location, + string $featureGroup, + string $feature + ): string { return self::getPathTemplate('projectLocationFeatureGroupFeature')->render([ 'project' => $project, 'location' => $location, @@ -319,8 +351,13 @@ public static function projectLocationFeatureGroupFeatureName(string $project, s * * @return string The formatted project_location_featurestore_entity_type_feature resource. */ - public static function projectLocationFeaturestoreEntityTypeFeatureName(string $project, string $location, string $featurestore, string $entityType, string $feature): string - { + public static function projectLocationFeaturestoreEntityTypeFeatureName( + string $project, + string $location, + string $featurestore, + string $entityType, + string $feature + ): string { return self::getPathTemplate('projectLocationFeaturestoreEntityTypeFeature')->render([ 'project' => $project, 'location' => $location, @@ -486,8 +523,10 @@ public function batchCreateFeatures(BatchCreateFeaturesRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function batchReadFeatureValues(BatchReadFeatureValuesRequest $request, array $callOptions = []): OperationResponse - { + public function batchReadFeatureValues( + BatchReadFeatureValuesRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('BatchReadFeatureValues', $request, $callOptions)->wait(); } @@ -1159,8 +1198,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/GenAiTuningServiceClient.php b/AiPlatform/src/V1/Client/GenAiTuningServiceClient.php index 0e81920e7181..7386de0b23ee 100644 --- a/AiPlatform/src/V1/Client/GenAiTuningServiceClient.php +++ b/AiPlatform/src/V1/Client/GenAiTuningServiceClient.php @@ -94,9 +94,7 @@ final class GenAiTuningServiceClient private const CODEGEN_NAME = 'gapic'; /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; + public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform']; private static function getClientDefaults() { @@ -128,8 +126,12 @@ private static function getClientDefaults() * * @return string The formatted context resource. */ - public static function contextName(string $project, string $location, string $metadataStore, string $context): string - { + public static function contextName( + string $project, + string $location, + string $metadataStore, + string $context + ): string { return self::getPathTemplate('context')->render([ 'project' => $project, 'location' => $location, @@ -223,8 +225,12 @@ public static function projectLocationEndpointName(string $project, string $loca * * @return string The formatted project_location_publisher_model resource. */ - public static function projectLocationPublisherModelName(string $project, string $location, string $publisher, string $model): string - { + public static function projectLocationPublisherModelName( + string $project, + string $location, + string $publisher, + string $model + ): string { return self::getPathTemplate('projectLocationPublisherModel')->render([ 'project' => $project, 'location' => $location, @@ -604,8 +610,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/IndexEndpointServiceClient.php b/AiPlatform/src/V1/Client/IndexEndpointServiceClient.php index 18b9145bf5a9..6d9980bde7cc 100644 --- a/AiPlatform/src/V1/Client/IndexEndpointServiceClient.php +++ b/AiPlatform/src/V1/Client/IndexEndpointServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a index * resource. @@ -666,8 +685,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/IndexServiceClient.php b/AiPlatform/src/V1/Client/IndexServiceClient.php index 91583261f3bb..b5069701c87f 100644 --- a/AiPlatform/src/V1/Client/IndexServiceClient.php +++ b/AiPlatform/src/V1/Client/IndexServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a index * resource. @@ -440,8 +459,10 @@ public function listIndexes(ListIndexesRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function removeDatapoints(RemoveDatapointsRequest $request, array $callOptions = []): RemoveDatapointsResponse - { + public function removeDatapoints( + RemoveDatapointsRequest $request, + array $callOptions = [] + ): RemoveDatapointsResponse { return $this->startApiCall('RemoveDatapoints', $request, $callOptions)->wait(); } @@ -492,8 +513,10 @@ public function updateIndex(UpdateIndexRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function upsertDatapoints(UpsertDatapointsRequest $request, array $callOptions = []): UpsertDatapointsResponse - { + public function upsertDatapoints( + UpsertDatapointsRequest $request, + array $callOptions = [] + ): UpsertDatapointsResponse { return $this->startApiCall('UpsertDatapoints', $request, $callOptions)->wait(); } @@ -633,8 +656,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/JobServiceClient.php b/AiPlatform/src/V1/Client/JobServiceClient.php index 7a68185a9bee..0f36dc668d52 100644 --- a/AiPlatform/src/V1/Client/JobServiceClient.php +++ b/AiPlatform/src/V1/Client/JobServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a * batch_prediction_job resource. @@ -250,8 +271,12 @@ public static function batchPredictionJobName(string $project, string $location, * * @return string The formatted context resource. */ - public static function contextName(string $project, string $location, string $metadataStore, string $context): string - { + public static function contextName( + string $project, + string $location, + string $metadataStore, + string $context + ): string { return self::getPathTemplate('context')->render([ 'project' => $project, 'location' => $location, @@ -346,8 +371,11 @@ public static function endpointName(string $project, string $location, string $e * * @return string The formatted hyperparameter_tuning_job resource. */ - public static function hyperparameterTuningJobName(string $project, string $location, string $hyperparameterTuningJob): string - { + public static function hyperparameterTuningJobName( + string $project, + string $location, + string $hyperparameterTuningJob + ): string { return self::getPathTemplate('hyperparameterTuningJob')->render([ 'project' => $project, 'location' => $location, @@ -401,8 +429,11 @@ public static function modelName(string $project, string $location, string $mode * * @return string The formatted model_deployment_monitoring_job resource. */ - public static function modelDeploymentMonitoringJobName(string $project, string $location, string $modelDeploymentMonitoringJob): string - { + public static function modelDeploymentMonitoringJobName( + string $project, + string $location, + string $modelDeploymentMonitoringJob + ): string { return self::getPathTemplate('modelDeploymentMonitoringJob')->render([ 'project' => $project, 'location' => $location, @@ -440,8 +471,12 @@ public static function nasJobName(string $project, string $location, string $nas * * @return string The formatted nas_trial_detail resource. */ - public static function nasTrialDetailName(string $project, string $location, string $nasJob, string $nasTrialDetail): string - { + public static function nasTrialDetailName( + string $project, + string $location, + string $nasJob, + string $nasTrialDetail + ): string { return self::getPathTemplate('nasTrialDetail')->render([ 'project' => $project, 'location' => $location, @@ -533,8 +568,12 @@ public static function projectLocationEndpointName(string $project, string $loca * * @return string The formatted project_location_publisher_model resource. */ - public static function projectLocationPublisherModelName(string $project, string $location, string $publisher, string $model): string - { + public static function projectLocationPublisherModelName( + string $project, + string $location, + string $publisher, + string $model + ): string { return self::getPathTemplate('projectLocationPublisherModel')->render([ 'project' => $project, 'location' => $location, @@ -825,8 +864,10 @@ public function cancelDataLabelingJob(CancelDataLabelingJobRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function cancelHyperparameterTuningJob(CancelHyperparameterTuningJobRequest $request, array $callOptions = []): void - { + public function cancelHyperparameterTuningJob( + CancelHyperparameterTuningJobRequest $request, + array $callOptions = [] + ): void { $this->startApiCall('CancelHyperparameterTuningJob', $request, $callOptions)->wait(); } @@ -888,8 +929,10 @@ public function cancelNasJob(CancelNasJobRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function createBatchPredictionJob(CreateBatchPredictionJobRequest $request, array $callOptions = []): BatchPredictionJob - { + public function createBatchPredictionJob( + CreateBatchPredictionJobRequest $request, + array $callOptions = [] + ): BatchPredictionJob { return $this->startApiCall('CreateBatchPredictionJob', $request, $callOptions)->wait(); } @@ -941,8 +984,10 @@ public function createCustomJob(CreateCustomJobRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function createDataLabelingJob(CreateDataLabelingJobRequest $request, array $callOptions = []): DataLabelingJob - { + public function createDataLabelingJob( + CreateDataLabelingJobRequest $request, + array $callOptions = [] + ): DataLabelingJob { return $this->startApiCall('CreateDataLabelingJob', $request, $callOptions)->wait(); } @@ -968,8 +1013,10 @@ public function createDataLabelingJob(CreateDataLabelingJobRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function createHyperparameterTuningJob(CreateHyperparameterTuningJobRequest $request, array $callOptions = []): HyperparameterTuningJob - { + public function createHyperparameterTuningJob( + CreateHyperparameterTuningJobRequest $request, + array $callOptions = [] + ): HyperparameterTuningJob { return $this->startApiCall('CreateHyperparameterTuningJob', $request, $callOptions)->wait(); } @@ -996,8 +1043,10 @@ public function createHyperparameterTuningJob(CreateHyperparameterTuningJobReque * * @throws ApiException Thrown if the API call fails. */ - public function createModelDeploymentMonitoringJob(CreateModelDeploymentMonitoringJobRequest $request, array $callOptions = []): ModelDeploymentMonitoringJob - { + public function createModelDeploymentMonitoringJob( + CreateModelDeploymentMonitoringJobRequest $request, + array $callOptions = [] + ): ModelDeploymentMonitoringJob { return $this->startApiCall('CreateModelDeploymentMonitoringJob', $request, $callOptions)->wait(); } @@ -1049,8 +1098,10 @@ public function createNasJob(CreateNasJobRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function deleteBatchPredictionJob(DeleteBatchPredictionJobRequest $request, array $callOptions = []): OperationResponse - { + public function deleteBatchPredictionJob( + DeleteBatchPredictionJobRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteBatchPredictionJob', $request, $callOptions)->wait(); } @@ -1101,8 +1152,10 @@ public function deleteCustomJob(DeleteCustomJobRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function deleteDataLabelingJob(DeleteDataLabelingJobRequest $request, array $callOptions = []): OperationResponse - { + public function deleteDataLabelingJob( + DeleteDataLabelingJobRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteDataLabelingJob', $request, $callOptions)->wait(); } @@ -1128,8 +1181,10 @@ public function deleteDataLabelingJob(DeleteDataLabelingJobRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function deleteHyperparameterTuningJob(DeleteHyperparameterTuningJobRequest $request, array $callOptions = []): OperationResponse - { + public function deleteHyperparameterTuningJob( + DeleteHyperparameterTuningJobRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteHyperparameterTuningJob', $request, $callOptions)->wait(); } @@ -1155,8 +1210,10 @@ public function deleteHyperparameterTuningJob(DeleteHyperparameterTuningJobReque * * @throws ApiException Thrown if the API call fails. */ - public function deleteModelDeploymentMonitoringJob(DeleteModelDeploymentMonitoringJobRequest $request, array $callOptions = []): OperationResponse - { + public function deleteModelDeploymentMonitoringJob( + DeleteModelDeploymentMonitoringJobRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteModelDeploymentMonitoringJob', $request, $callOptions)->wait(); } @@ -1207,8 +1264,10 @@ public function deleteNasJob(DeleteNasJobRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function getBatchPredictionJob(GetBatchPredictionJobRequest $request, array $callOptions = []): BatchPredictionJob - { + public function getBatchPredictionJob( + GetBatchPredictionJobRequest $request, + array $callOptions = [] + ): BatchPredictionJob { return $this->startApiCall('GetBatchPredictionJob', $request, $callOptions)->wait(); } @@ -1286,8 +1345,10 @@ public function getDataLabelingJob(GetDataLabelingJobRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function getHyperparameterTuningJob(GetHyperparameterTuningJobRequest $request, array $callOptions = []): HyperparameterTuningJob - { + public function getHyperparameterTuningJob( + GetHyperparameterTuningJobRequest $request, + array $callOptions = [] + ): HyperparameterTuningJob { return $this->startApiCall('GetHyperparameterTuningJob', $request, $callOptions)->wait(); } @@ -1313,8 +1374,10 @@ public function getHyperparameterTuningJob(GetHyperparameterTuningJobRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function getModelDeploymentMonitoringJob(GetModelDeploymentMonitoringJobRequest $request, array $callOptions = []): ModelDeploymentMonitoringJob - { + public function getModelDeploymentMonitoringJob( + GetModelDeploymentMonitoringJobRequest $request, + array $callOptions = [] + ): ModelDeploymentMonitoringJob { return $this->startApiCall('GetModelDeploymentMonitoringJob', $request, $callOptions)->wait(); } @@ -1391,8 +1454,10 @@ public function getNasTrialDetail(GetNasTrialDetailRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function listBatchPredictionJobs(ListBatchPredictionJobsRequest $request, array $callOptions = []): PagedListResponse - { + public function listBatchPredictionJobs( + ListBatchPredictionJobsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListBatchPredictionJobs', $request, $callOptions); } @@ -1443,8 +1508,10 @@ public function listCustomJobs(ListCustomJobsRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function listDataLabelingJobs(ListDataLabelingJobsRequest $request, array $callOptions = []): PagedListResponse - { + public function listDataLabelingJobs( + ListDataLabelingJobsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListDataLabelingJobs', $request, $callOptions); } @@ -1470,8 +1537,10 @@ public function listDataLabelingJobs(ListDataLabelingJobsRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function listHyperparameterTuningJobs(ListHyperparameterTuningJobsRequest $request, array $callOptions = []): PagedListResponse - { + public function listHyperparameterTuningJobs( + ListHyperparameterTuningJobsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListHyperparameterTuningJobs', $request, $callOptions); } @@ -1497,8 +1566,10 @@ public function listHyperparameterTuningJobs(ListHyperparameterTuningJobsRequest * * @throws ApiException Thrown if the API call fails. */ - public function listModelDeploymentMonitoringJobs(ListModelDeploymentMonitoringJobsRequest $request, array $callOptions = []): PagedListResponse - { + public function listModelDeploymentMonitoringJobs( + ListModelDeploymentMonitoringJobsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListModelDeploymentMonitoringJobs', $request, $callOptions); } @@ -1577,8 +1648,10 @@ public function listNasTrialDetails(ListNasTrialDetailsRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function pauseModelDeploymentMonitoringJob(PauseModelDeploymentMonitoringJobRequest $request, array $callOptions = []): void - { + public function pauseModelDeploymentMonitoringJob( + PauseModelDeploymentMonitoringJobRequest $request, + array $callOptions = [] + ): void { $this->startApiCall('PauseModelDeploymentMonitoringJob', $request, $callOptions)->wait(); } @@ -1604,8 +1677,10 @@ public function pauseModelDeploymentMonitoringJob(PauseModelDeploymentMonitoring * * @throws ApiException Thrown if the API call fails. */ - public function resumeModelDeploymentMonitoringJob(ResumeModelDeploymentMonitoringJobRequest $request, array $callOptions = []): void - { + public function resumeModelDeploymentMonitoringJob( + ResumeModelDeploymentMonitoringJobRequest $request, + array $callOptions = [] + ): void { $this->startApiCall('ResumeModelDeploymentMonitoringJob', $request, $callOptions)->wait(); } @@ -1631,8 +1706,10 @@ public function resumeModelDeploymentMonitoringJob(ResumeModelDeploymentMonitori * * @throws ApiException Thrown if the API call fails. */ - public function searchModelDeploymentMonitoringStatsAnomalies(SearchModelDeploymentMonitoringStatsAnomaliesRequest $request, array $callOptions = []): PagedListResponse - { + public function searchModelDeploymentMonitoringStatsAnomalies( + SearchModelDeploymentMonitoringStatsAnomaliesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('SearchModelDeploymentMonitoringStatsAnomalies', $request, $callOptions); } @@ -1658,8 +1735,10 @@ public function searchModelDeploymentMonitoringStatsAnomalies(SearchModelDeploym * * @throws ApiException Thrown if the API call fails. */ - public function updateModelDeploymentMonitoringJob(UpdateModelDeploymentMonitoringJobRequest $request, array $callOptions = []): OperationResponse - { + public function updateModelDeploymentMonitoringJob( + UpdateModelDeploymentMonitoringJobRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateModelDeploymentMonitoringJob', $request, $callOptions)->wait(); } @@ -1799,8 +1878,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/LlmUtilityServiceClient.php b/AiPlatform/src/V1/Client/LlmUtilityServiceClient.php index b3298d3340cd..8091d6feb51d 100644 --- a/AiPlatform/src/V1/Client/LlmUtilityServiceClient.php +++ b/AiPlatform/src/V1/Client/LlmUtilityServiceClient.php @@ -1,6 +1,6 @@ render([ 'project' => $project, 'location' => $location, @@ -458,8 +460,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/MatchServiceClient.php b/AiPlatform/src/V1/Client/MatchServiceClient.php index 32c1c03a0ebb..54271fc6b982 100644 --- a/AiPlatform/src/V1/Client/MatchServiceClient.php +++ b/AiPlatform/src/V1/Client/MatchServiceClient.php @@ -1,6 +1,6 @@ startApiCall('ReadIndexDatapoints', $request, $callOptions)->wait(); } @@ -418,8 +418,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/MetadataServiceClient.php b/AiPlatform/src/V1/Client/MetadataServiceClient.php index 3beaea425703..3217207f6bfe 100644 --- a/AiPlatform/src/V1/Client/MetadataServiceClient.php +++ b/AiPlatform/src/V1/Client/MetadataServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a artifact * resource. @@ -228,8 +247,12 @@ public function resumeOperation($operationName, $methodName = null) * * @return string The formatted artifact resource. */ - public static function artifactName(string $project, string $location, string $metadataStore, string $artifact): string - { + public static function artifactName( + string $project, + string $location, + string $metadataStore, + string $artifact + ): string { return self::getPathTemplate('artifact')->render([ 'project' => $project, 'location' => $location, @@ -249,8 +272,12 @@ public static function artifactName(string $project, string $location, string $m * * @return string The formatted context resource. */ - public static function contextName(string $project, string $location, string $metadataStore, string $context): string - { + public static function contextName( + string $project, + string $location, + string $metadataStore, + string $context + ): string { return self::getPathTemplate('context')->render([ 'project' => $project, 'location' => $location, @@ -270,8 +297,12 @@ public static function contextName(string $project, string $location, string $me * * @return string The formatted execution resource. */ - public static function executionName(string $project, string $location, string $metadataStore, string $execution): string - { + public static function executionName( + string $project, + string $location, + string $metadataStore, + string $execution + ): string { return self::getPathTemplate('execution')->render([ 'project' => $project, 'location' => $location, @@ -308,8 +339,12 @@ public static function locationName(string $project, string $location): string * * @return string The formatted metadata_schema resource. */ - public static function metadataSchemaName(string $project, string $location, string $metadataStore, string $metadataSchema): string - { + public static function metadataSchemaName( + string $project, + string $location, + string $metadataStore, + string $metadataSchema + ): string { return self::getPathTemplate('metadataSchema')->render([ 'project' => $project, 'location' => $location, @@ -462,8 +497,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function addContextArtifactsAndExecutions(AddContextArtifactsAndExecutionsRequest $request, array $callOptions = []): AddContextArtifactsAndExecutionsResponse - { + public function addContextArtifactsAndExecutions( + AddContextArtifactsAndExecutionsRequest $request, + array $callOptions = [] + ): AddContextArtifactsAndExecutionsResponse { return $this->startApiCall('AddContextArtifactsAndExecutions', $request, $callOptions)->wait(); } @@ -492,8 +529,10 @@ public function addContextArtifactsAndExecutions(AddContextArtifactsAndExecution * * @throws ApiException Thrown if the API call fails. */ - public function addContextChildren(AddContextChildrenRequest $request, array $callOptions = []): AddContextChildrenResponse - { + public function addContextChildren( + AddContextChildrenRequest $request, + array $callOptions = [] + ): AddContextChildrenResponse { return $this->startApiCall('AddContextChildren', $request, $callOptions)->wait(); } @@ -521,8 +560,10 @@ public function addContextChildren(AddContextChildrenRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function addExecutionEvents(AddExecutionEventsRequest $request, array $callOptions = []): AddExecutionEventsResponse - { + public function addExecutionEvents( + AddExecutionEventsRequest $request, + array $callOptions = [] + ): AddExecutionEventsResponse { return $this->startApiCall('AddExecutionEvents', $request, $callOptions)->wait(); } @@ -1122,8 +1163,10 @@ public function purgeExecutions(PurgeExecutionsRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function queryArtifactLineageSubgraph(QueryArtifactLineageSubgraphRequest $request, array $callOptions = []): LineageSubgraph - { + public function queryArtifactLineageSubgraph( + QueryArtifactLineageSubgraphRequest $request, + array $callOptions = [] + ): LineageSubgraph { return $this->startApiCall('QueryArtifactLineageSubgraph', $request, $callOptions)->wait(); } @@ -1150,8 +1193,10 @@ public function queryArtifactLineageSubgraph(QueryArtifactLineageSubgraphRequest * * @throws ApiException Thrown if the API call fails. */ - public function queryContextLineageSubgraph(QueryContextLineageSubgraphRequest $request, array $callOptions = []): LineageSubgraph - { + public function queryContextLineageSubgraph( + QueryContextLineageSubgraphRequest $request, + array $callOptions = [] + ): LineageSubgraph { return $this->startApiCall('QueryContextLineageSubgraph', $request, $callOptions)->wait(); } @@ -1179,8 +1224,10 @@ public function queryContextLineageSubgraph(QueryContextLineageSubgraphRequest $ * * @throws ApiException Thrown if the API call fails. */ - public function queryExecutionInputsAndOutputs(QueryExecutionInputsAndOutputsRequest $request, array $callOptions = []): LineageSubgraph - { + public function queryExecutionInputsAndOutputs( + QueryExecutionInputsAndOutputsRequest $request, + array $callOptions = [] + ): LineageSubgraph { return $this->startApiCall('QueryExecutionInputsAndOutputs', $request, $callOptions)->wait(); } @@ -1208,8 +1255,10 @@ public function queryExecutionInputsAndOutputs(QueryExecutionInputsAndOutputsReq * * @throws ApiException Thrown if the API call fails. */ - public function removeContextChildren(RemoveContextChildrenRequest $request, array $callOptions = []): RemoveContextChildrenResponse - { + public function removeContextChildren( + RemoveContextChildrenRequest $request, + array $callOptions = [] + ): RemoveContextChildrenResponse { return $this->startApiCall('RemoveContextChildren', $request, $callOptions)->wait(); } @@ -1427,8 +1476,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/MigrationServiceClient.php b/AiPlatform/src/V1/Client/MigrationServiceClient.php index 7936c09ed444..3cc077ea428d 100644 --- a/AiPlatform/src/V1/Client/MigrationServiceClient.php +++ b/AiPlatform/src/V1/Client/MigrationServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a * annotated_dataset resource. @@ -363,8 +382,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function batchMigrateResources(BatchMigrateResourcesRequest $request, array $callOptions = []): OperationResponse - { + public function batchMigrateResources( + BatchMigrateResourcesRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('BatchMigrateResources', $request, $callOptions)->wait(); } @@ -392,8 +413,10 @@ public function batchMigrateResources(BatchMigrateResourcesRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function searchMigratableResources(SearchMigratableResourcesRequest $request, array $callOptions = []): PagedListResponse - { + public function searchMigratableResources( + SearchMigratableResourcesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('SearchMigratableResources', $request, $callOptions); } @@ -533,8 +556,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/ModelGardenServiceClient.php b/AiPlatform/src/V1/Client/ModelGardenServiceClient.php index ebe6be378941..67e757a1faca 100644 --- a/AiPlatform/src/V1/Client/ModelGardenServiceClient.php +++ b/AiPlatform/src/V1/Client/ModelGardenServiceClient.php @@ -1,6 +1,6 @@ startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/ModelServiceClient.php b/AiPlatform/src/V1/Client/ModelServiceClient.php index ee8a73d00bda..93678b94d53a 100644 --- a/AiPlatform/src/V1/Client/ModelServiceClient.php +++ b/AiPlatform/src/V1/Client/ModelServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a endpoint * resource. @@ -249,8 +268,12 @@ public static function modelName(string $project, string $location, string $mode * * @return string The formatted model_evaluation resource. */ - public static function modelEvaluationName(string $project, string $location, string $model, string $evaluation): string - { + public static function modelEvaluationName( + string $project, + string $location, + string $model, + string $evaluation + ): string { return self::getPathTemplate('modelEvaluation')->render([ 'project' => $project, 'location' => $location, @@ -271,8 +294,13 @@ public static function modelEvaluationName(string $project, string $location, st * * @return string The formatted model_evaluation_slice resource. */ - public static function modelEvaluationSliceName(string $project, string $location, string $model, string $evaluation, string $slice): string - { + public static function modelEvaluationSliceName( + string $project, + string $location, + string $model, + string $evaluation, + string $slice + ): string { return self::getPathTemplate('modelEvaluationSlice')->render([ 'project' => $project, 'location' => $location, @@ -331,8 +359,12 @@ public static function projectLocationEndpointName(string $project, string $loca * * @return string The formatted project_location_publisher_model resource. */ - public static function projectLocationPublisherModelName(string $project, string $location, string $publisher, string $model): string - { + public static function projectLocationPublisherModelName( + string $project, + string $location, + string $publisher, + string $model + ): string { return self::getPathTemplate('projectLocationPublisherModel')->render([ 'project' => $project, 'location' => $location, @@ -486,8 +518,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function batchImportEvaluatedAnnotations(BatchImportEvaluatedAnnotationsRequest $request, array $callOptions = []): BatchImportEvaluatedAnnotationsResponse - { + public function batchImportEvaluatedAnnotations( + BatchImportEvaluatedAnnotationsRequest $request, + array $callOptions = [] + ): BatchImportEvaluatedAnnotationsResponse { return $this->startApiCall('BatchImportEvaluatedAnnotations', $request, $callOptions)->wait(); } @@ -513,8 +547,10 @@ public function batchImportEvaluatedAnnotations(BatchImportEvaluatedAnnotationsR * * @throws ApiException Thrown if the API call fails. */ - public function batchImportModelEvaluationSlices(BatchImportModelEvaluationSlicesRequest $request, array $callOptions = []): BatchImportModelEvaluationSlicesResponse - { + public function batchImportModelEvaluationSlices( + BatchImportModelEvaluationSlicesRequest $request, + array $callOptions = [] + ): BatchImportModelEvaluationSlicesResponse { return $this->startApiCall('BatchImportModelEvaluationSlices', $request, $callOptions)->wait(); } @@ -716,8 +752,10 @@ public function getModelEvaluation(GetModelEvaluationRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function getModelEvaluationSlice(GetModelEvaluationSliceRequest $request, array $callOptions = []): ModelEvaluationSlice - { + public function getModelEvaluationSlice( + GetModelEvaluationSliceRequest $request, + array $callOptions = [] + ): ModelEvaluationSlice { return $this->startApiCall('GetModelEvaluationSlice', $request, $callOptions)->wait(); } @@ -742,8 +780,10 @@ public function getModelEvaluationSlice(GetModelEvaluationSliceRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function importModelEvaluation(ImportModelEvaluationRequest $request, array $callOptions = []): ModelEvaluation - { + public function importModelEvaluation( + ImportModelEvaluationRequest $request, + array $callOptions = [] + ): ModelEvaluation { return $this->startApiCall('ImportModelEvaluation', $request, $callOptions)->wait(); } @@ -769,8 +809,10 @@ public function importModelEvaluation(ImportModelEvaluationRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function listModelEvaluationSlices(ListModelEvaluationSlicesRequest $request, array $callOptions = []): PagedListResponse - { + public function listModelEvaluationSlices( + ListModelEvaluationSlicesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListModelEvaluationSlices', $request, $callOptions); } @@ -795,8 +837,10 @@ public function listModelEvaluationSlices(ListModelEvaluationSlicesRequest $requ * * @throws ApiException Thrown if the API call fails. */ - public function listModelEvaluations(ListModelEvaluationsRequest $request, array $callOptions = []): PagedListResponse - { + public function listModelEvaluations( + ListModelEvaluationsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListModelEvaluations', $request, $callOptions); } @@ -900,8 +944,10 @@ public function mergeVersionAliases(MergeVersionAliasesRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function updateExplanationDataset(UpdateExplanationDatasetRequest $request, array $callOptions = []): OperationResponse - { + public function updateExplanationDataset( + UpdateExplanationDatasetRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateExplanationDataset', $request, $callOptions)->wait(); } @@ -1093,8 +1139,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/NotebookServiceClient.php b/AiPlatform/src/V1/Client/NotebookServiceClient.php index 35bfadbd57cf..910b3fd32c68 100644 --- a/AiPlatform/src/V1/Client/NotebookServiceClient.php +++ b/AiPlatform/src/V1/Client/NotebookServiceClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -56,6 +55,7 @@ use Google\Cloud\Location\GetLocationRequest; use Google\Cloud\Location\ListLocationsRequest; use Google\Cloud\Location\Location; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -112,9 +112,7 @@ final class NotebookServiceClient private const CODEGEN_NAME = 'gapic'; /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; + public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform']; private $operationsClient; @@ -160,12 +158,33 @@ public function getOperationsClient() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a location * resource. @@ -229,8 +248,11 @@ public static function notebookRuntimeName(string $project, string $location, st * * @return string The formatted notebook_runtime_template resource. */ - public static function notebookRuntimeTemplateName(string $project, string $location, string $notebookRuntimeTemplate): string - { + public static function notebookRuntimeTemplateName( + string $project, + string $location, + string $notebookRuntimeTemplate + ): string { return self::getPathTemplate('notebookRuntimeTemplate')->render([ 'project' => $project, 'location' => $location, @@ -380,8 +402,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function assignNotebookRuntime(AssignNotebookRuntimeRequest $request, array $callOptions = []): OperationResponse - { + public function assignNotebookRuntime( + AssignNotebookRuntimeRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AssignNotebookRuntime', $request, $callOptions)->wait(); } @@ -407,8 +431,10 @@ public function assignNotebookRuntime(AssignNotebookRuntimeRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function createNotebookRuntimeTemplate(CreateNotebookRuntimeTemplateRequest $request, array $callOptions = []): OperationResponse - { + public function createNotebookRuntimeTemplate( + CreateNotebookRuntimeTemplateRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateNotebookRuntimeTemplate', $request, $callOptions)->wait(); } @@ -434,8 +460,10 @@ public function createNotebookRuntimeTemplate(CreateNotebookRuntimeTemplateReque * * @throws ApiException Thrown if the API call fails. */ - public function deleteNotebookRuntime(DeleteNotebookRuntimeRequest $request, array $callOptions = []): OperationResponse - { + public function deleteNotebookRuntime( + DeleteNotebookRuntimeRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteNotebookRuntime', $request, $callOptions)->wait(); } @@ -461,8 +489,10 @@ public function deleteNotebookRuntime(DeleteNotebookRuntimeRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function deleteNotebookRuntimeTemplate(DeleteNotebookRuntimeTemplateRequest $request, array $callOptions = []): OperationResponse - { + public function deleteNotebookRuntimeTemplate( + DeleteNotebookRuntimeTemplateRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteNotebookRuntimeTemplate', $request, $callOptions)->wait(); } @@ -514,8 +544,10 @@ public function getNotebookRuntime(GetNotebookRuntimeRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function getNotebookRuntimeTemplate(GetNotebookRuntimeTemplateRequest $request, array $callOptions = []): NotebookRuntimeTemplate - { + public function getNotebookRuntimeTemplate( + GetNotebookRuntimeTemplateRequest $request, + array $callOptions = [] + ): NotebookRuntimeTemplate { return $this->startApiCall('GetNotebookRuntimeTemplate', $request, $callOptions)->wait(); } @@ -541,8 +573,10 @@ public function getNotebookRuntimeTemplate(GetNotebookRuntimeTemplateRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function listNotebookRuntimeTemplates(ListNotebookRuntimeTemplatesRequest $request, array $callOptions = []): PagedListResponse - { + public function listNotebookRuntimeTemplates( + ListNotebookRuntimeTemplatesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListNotebookRuntimeTemplates', $request, $callOptions); } @@ -567,8 +601,10 @@ public function listNotebookRuntimeTemplates(ListNotebookRuntimeTemplatesRequest * * @throws ApiException Thrown if the API call fails. */ - public function listNotebookRuntimes(ListNotebookRuntimesRequest $request, array $callOptions = []): PagedListResponse - { + public function listNotebookRuntimes( + ListNotebookRuntimesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListNotebookRuntimes', $request, $callOptions); } @@ -593,8 +629,10 @@ public function listNotebookRuntimes(ListNotebookRuntimesRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function startNotebookRuntime(StartNotebookRuntimeRequest $request, array $callOptions = []): OperationResponse - { + public function startNotebookRuntime( + StartNotebookRuntimeRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StartNotebookRuntime', $request, $callOptions)->wait(); } @@ -620,8 +658,10 @@ public function startNotebookRuntime(StartNotebookRuntimeRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function updateNotebookRuntimeTemplate(UpdateNotebookRuntimeTemplateRequest $request, array $callOptions = []): NotebookRuntimeTemplate - { + public function updateNotebookRuntimeTemplate( + UpdateNotebookRuntimeTemplateRequest $request, + array $callOptions = [] + ): NotebookRuntimeTemplate { return $this->startApiCall('UpdateNotebookRuntimeTemplate', $request, $callOptions)->wait(); } @@ -647,8 +687,10 @@ public function updateNotebookRuntimeTemplate(UpdateNotebookRuntimeTemplateReque * * @throws ApiException Thrown if the API call fails. */ - public function upgradeNotebookRuntime(UpgradeNotebookRuntimeRequest $request, array $callOptions = []): OperationResponse - { + public function upgradeNotebookRuntime( + UpgradeNotebookRuntimeRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpgradeNotebookRuntime', $request, $callOptions)->wait(); } @@ -788,8 +830,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/PersistentResourceServiceClient.php b/AiPlatform/src/V1/Client/PersistentResourceServiceClient.php index a259b0d88c2c..95176a9fa93b 100644 --- a/AiPlatform/src/V1/Client/PersistentResourceServiceClient.php +++ b/AiPlatform/src/V1/Client/PersistentResourceServiceClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -50,6 +49,7 @@ use Google\Cloud\Location\GetLocationRequest; use Google\Cloud\Location\ListLocationsRequest; use Google\Cloud\Location\Location; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -101,9 +101,7 @@ final class PersistentResourceServiceClient private const CODEGEN_NAME = 'gapic'; /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; + public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform']; private $operationsClient; @@ -120,7 +118,8 @@ private static function getClientDefaults() ], 'transportConfig' => [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/persistent_resource_service_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/persistent_resource_service_rest_client_config.php', ], ], ]; @@ -149,12 +148,33 @@ public function getOperationsClient() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a location * resource. @@ -328,8 +348,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function createPersistentResource(CreatePersistentResourceRequest $request, array $callOptions = []): OperationResponse - { + public function createPersistentResource( + CreatePersistentResourceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreatePersistentResource', $request, $callOptions)->wait(); } @@ -355,8 +377,10 @@ public function createPersistentResource(CreatePersistentResourceRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function deletePersistentResource(DeletePersistentResourceRequest $request, array $callOptions = []): OperationResponse - { + public function deletePersistentResource( + DeletePersistentResourceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeletePersistentResource', $request, $callOptions)->wait(); } @@ -382,8 +406,10 @@ public function deletePersistentResource(DeletePersistentResourceRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function getPersistentResource(GetPersistentResourceRequest $request, array $callOptions = []): PersistentResource - { + public function getPersistentResource( + GetPersistentResourceRequest $request, + array $callOptions = [] + ): PersistentResource { return $this->startApiCall('GetPersistentResource', $request, $callOptions)->wait(); } @@ -409,8 +435,10 @@ public function getPersistentResource(GetPersistentResourceRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function listPersistentResources(ListPersistentResourcesRequest $request, array $callOptions = []): PagedListResponse - { + public function listPersistentResources( + ListPersistentResourcesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListPersistentResources', $request, $callOptions); } @@ -436,8 +464,10 @@ public function listPersistentResources(ListPersistentResourcesRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function rebootPersistentResource(RebootPersistentResourceRequest $request, array $callOptions = []): OperationResponse - { + public function rebootPersistentResource( + RebootPersistentResourceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RebootPersistentResource', $request, $callOptions)->wait(); } @@ -463,8 +493,10 @@ public function rebootPersistentResource(RebootPersistentResourceRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function updatePersistentResource(UpdatePersistentResourceRequest $request, array $callOptions = []): OperationResponse - { + public function updatePersistentResource( + UpdatePersistentResourceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdatePersistentResource', $request, $callOptions)->wait(); } @@ -609,8 +641,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/PipelineServiceClient.php b/AiPlatform/src/V1/Client/PipelineServiceClient.php index e36aa9ecb153..c28e22b2305a 100644 --- a/AiPlatform/src/V1/Client/PipelineServiceClient.php +++ b/AiPlatform/src/V1/Client/PipelineServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a artifact * resource. @@ -181,8 +200,12 @@ public function resumeOperation($operationName, $methodName = null) * * @return string The formatted artifact resource. */ - public static function artifactName(string $project, string $location, string $metadataStore, string $artifact): string - { + public static function artifactName( + string $project, + string $location, + string $metadataStore, + string $artifact + ): string { return self::getPathTemplate('artifact')->render([ 'project' => $project, 'location' => $location, @@ -202,8 +225,12 @@ public static function artifactName(string $project, string $location, string $m * * @return string The formatted context resource. */ - public static function contextName(string $project, string $location, string $metadataStore, string $context): string - { + public static function contextName( + string $project, + string $location, + string $metadataStore, + string $context + ): string { return self::getPathTemplate('context')->render([ 'project' => $project, 'location' => $location, @@ -261,8 +288,12 @@ public static function endpointName(string $project, string $location, string $e * * @return string The formatted execution resource. */ - public static function executionName(string $project, string $location, string $metadataStore, string $execution): string - { + public static function executionName( + string $project, + string $location, + string $metadataStore, + string $execution + ): string { return self::getPathTemplate('execution')->render([ 'project' => $project, 'location' => $location, @@ -392,8 +423,12 @@ public static function projectLocationEndpointName(string $project, string $loca * * @return string The formatted project_location_publisher_model resource. */ - public static function projectLocationPublisherModelName(string $project, string $location, string $publisher, string $model): string - { + public static function projectLocationPublisherModelName( + string $project, + string $location, + string $publisher, + string $model + ): string { return self::getPathTemplate('projectLocationPublisherModel')->render([ 'project' => $project, 'location' => $location, @@ -557,8 +592,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function batchCancelPipelineJobs(BatchCancelPipelineJobsRequest $request, array $callOptions = []): OperationResponse - { + public function batchCancelPipelineJobs( + BatchCancelPipelineJobsRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('BatchCancelPipelineJobs', $request, $callOptions)->wait(); } @@ -586,8 +623,10 @@ public function batchCancelPipelineJobs(BatchCancelPipelineJobsRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function batchDeletePipelineJobs(BatchDeletePipelineJobsRequest $request, array $callOptions = []): OperationResponse - { + public function batchDeletePipelineJobs( + BatchDeletePipelineJobsRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('BatchDeletePipelineJobs', $request, $callOptions)->wait(); } @@ -714,8 +753,10 @@ public function createPipelineJob(CreatePipelineJobRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function createTrainingPipeline(CreateTrainingPipelineRequest $request, array $callOptions = []): TrainingPipeline - { + public function createTrainingPipeline( + CreateTrainingPipelineRequest $request, + array $callOptions = [] + ): TrainingPipeline { return $this->startApiCall('CreateTrainingPipeline', $request, $callOptions)->wait(); } @@ -767,8 +808,10 @@ public function deletePipelineJob(DeletePipelineJobRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function deleteTrainingPipeline(DeleteTrainingPipelineRequest $request, array $callOptions = []): OperationResponse - { + public function deleteTrainingPipeline( + DeleteTrainingPipelineRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteTrainingPipeline', $request, $callOptions)->wait(); } @@ -872,8 +915,10 @@ public function listPipelineJobs(ListPipelineJobsRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function listTrainingPipelines(ListTrainingPipelinesRequest $request, array $callOptions = []): PagedListResponse - { + public function listTrainingPipelines( + ListTrainingPipelinesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListTrainingPipelines', $request, $callOptions); } @@ -1013,8 +1058,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/PredictionServiceClient.php b/AiPlatform/src/V1/Client/PredictionServiceClient.php index 3862c5ea1be6..4d2425cdeda3 100644 --- a/AiPlatform/src/V1/Client/PredictionServiceClient.php +++ b/AiPlatform/src/V1/Client/PredictionServiceClient.php @@ -1,6 +1,6 @@ render([ 'project' => $project, 'location' => $location, @@ -337,8 +341,10 @@ public function directPredict(DirectPredictRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function directRawPredict(DirectRawPredictRequest $request, array $callOptions = []): DirectRawPredictResponse - { + public function directRawPredict( + DirectRawPredictRequest $request, + array $callOptions = [] + ): DirectRawPredictResponse { return $this->startApiCall('DirectRawPredict', $request, $callOptions)->wait(); } @@ -756,8 +762,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/ScheduleServiceClient.php b/AiPlatform/src/V1/Client/ScheduleServiceClient.php index fbdabbf5342f..4eb20511dc6e 100644 --- a/AiPlatform/src/V1/Client/ScheduleServiceClient.php +++ b/AiPlatform/src/V1/Client/ScheduleServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a artifact * resource. @@ -169,8 +188,12 @@ public function resumeOperation($operationName, $methodName = null) * * @return string The formatted artifact resource. */ - public static function artifactName(string $project, string $location, string $metadataStore, string $artifact): string - { + public static function artifactName( + string $project, + string $location, + string $metadataStore, + string $artifact + ): string { return self::getPathTemplate('artifact')->render([ 'project' => $project, 'location' => $location, @@ -190,8 +213,12 @@ public static function artifactName(string $project, string $location, string $m * * @return string The formatted context resource. */ - public static function contextName(string $project, string $location, string $metadataStore, string $context): string - { + public static function contextName( + string $project, + string $location, + string $metadataStore, + string $context + ): string { return self::getPathTemplate('context')->render([ 'project' => $project, 'location' => $location, @@ -230,8 +257,12 @@ public static function customJobName(string $project, string $location, string $ * * @return string The formatted execution resource. */ - public static function executionName(string $project, string $location, string $metadataStore, string $execution): string - { + public static function executionName( + string $project, + string $location, + string $metadataStore, + string $execution + ): string { return self::getPathTemplate('execution')->render([ 'project' => $project, 'location' => $location, @@ -765,8 +796,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/SpecialistPoolServiceClient.php b/AiPlatform/src/V1/Client/SpecialistPoolServiceClient.php index e2a970b299ff..5c49591a6a63 100644 --- a/AiPlatform/src/V1/Client/SpecialistPoolServiceClient.php +++ b/AiPlatform/src/V1/Client/SpecialistPoolServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a location * resource. @@ -313,8 +332,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function createSpecialistPool(CreateSpecialistPoolRequest $request, array $callOptions = []): OperationResponse - { + public function createSpecialistPool( + CreateSpecialistPoolRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateSpecialistPool', $request, $callOptions)->wait(); } @@ -340,8 +361,10 @@ public function createSpecialistPool(CreateSpecialistPoolRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function deleteSpecialistPool(DeleteSpecialistPoolRequest $request, array $callOptions = []): OperationResponse - { + public function deleteSpecialistPool( + DeleteSpecialistPoolRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteSpecialistPool', $request, $callOptions)->wait(); } @@ -421,8 +444,10 @@ public function listSpecialistPools(ListSpecialistPoolsRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function updateSpecialistPool(UpdateSpecialistPoolRequest $request, array $callOptions = []): OperationResponse - { + public function updateSpecialistPool( + UpdateSpecialistPoolRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateSpecialistPool', $request, $callOptions)->wait(); } @@ -563,8 +588,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/TensorboardServiceClient.php b/AiPlatform/src/V1/Client/TensorboardServiceClient.php index ac0308d2bd44..5b50c06fd7b0 100644 --- a/AiPlatform/src/V1/Client/TensorboardServiceClient.php +++ b/AiPlatform/src/V1/Client/TensorboardServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a location * resource. @@ -262,8 +283,12 @@ public static function tensorboardName(string $project, string $location, string * * @return string The formatted tensorboard_experiment resource. */ - public static function tensorboardExperimentName(string $project, string $location, string $tensorboard, string $experiment): string - { + public static function tensorboardExperimentName( + string $project, + string $location, + string $tensorboard, + string $experiment + ): string { return self::getPathTemplate('tensorboardExperiment')->render([ 'project' => $project, 'location' => $location, @@ -284,8 +309,13 @@ public static function tensorboardExperimentName(string $project, string $locati * * @return string The formatted tensorboard_run resource. */ - public static function tensorboardRunName(string $project, string $location, string $tensorboard, string $experiment, string $run): string - { + public static function tensorboardRunName( + string $project, + string $location, + string $tensorboard, + string $experiment, + string $run + ): string { return self::getPathTemplate('tensorboardRun')->render([ 'project' => $project, 'location' => $location, @@ -308,8 +338,14 @@ public static function tensorboardRunName(string $project, string $location, str * * @return string The formatted tensorboard_time_series resource. */ - public static function tensorboardTimeSeriesName(string $project, string $location, string $tensorboard, string $experiment, string $run, string $timeSeries): string - { + public static function tensorboardTimeSeriesName( + string $project, + string $location, + string $tensorboard, + string $experiment, + string $run, + string $timeSeries + ): string { return self::getPathTemplate('tensorboardTimeSeries')->render([ 'project' => $project, 'location' => $location, @@ -442,8 +478,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function batchCreateTensorboardRuns(BatchCreateTensorboardRunsRequest $request, array $callOptions = []): BatchCreateTensorboardRunsResponse - { + public function batchCreateTensorboardRuns( + BatchCreateTensorboardRunsRequest $request, + array $callOptions = [] + ): BatchCreateTensorboardRunsResponse { return $this->startApiCall('BatchCreateTensorboardRuns', $request, $callOptions)->wait(); } @@ -469,8 +507,10 @@ public function batchCreateTensorboardRuns(BatchCreateTensorboardRunsRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function batchCreateTensorboardTimeSeries(BatchCreateTensorboardTimeSeriesRequest $request, array $callOptions = []): BatchCreateTensorboardTimeSeriesResponse - { + public function batchCreateTensorboardTimeSeries( + BatchCreateTensorboardTimeSeriesRequest $request, + array $callOptions = [] + ): BatchCreateTensorboardTimeSeriesResponse { return $this->startApiCall('BatchCreateTensorboardTimeSeries', $request, $callOptions)->wait(); } @@ -500,8 +540,10 @@ public function batchCreateTensorboardTimeSeries(BatchCreateTensorboardTimeSerie * * @throws ApiException Thrown if the API call fails. */ - public function batchReadTensorboardTimeSeriesData(BatchReadTensorboardTimeSeriesDataRequest $request, array $callOptions = []): BatchReadTensorboardTimeSeriesDataResponse - { + public function batchReadTensorboardTimeSeriesData( + BatchReadTensorboardTimeSeriesDataRequest $request, + array $callOptions = [] + ): BatchReadTensorboardTimeSeriesDataResponse { return $this->startApiCall('BatchReadTensorboardTimeSeriesData', $request, $callOptions)->wait(); } @@ -553,8 +595,10 @@ public function createTensorboard(CreateTensorboardRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function createTensorboardExperiment(CreateTensorboardExperimentRequest $request, array $callOptions = []): TensorboardExperiment - { + public function createTensorboardExperiment( + CreateTensorboardExperimentRequest $request, + array $callOptions = [] + ): TensorboardExperiment { return $this->startApiCall('CreateTensorboardExperiment', $request, $callOptions)->wait(); } @@ -607,8 +651,10 @@ public function createTensorboardRun(CreateTensorboardRunRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function createTensorboardTimeSeries(CreateTensorboardTimeSeriesRequest $request, array $callOptions = []): TensorboardTimeSeries - { + public function createTensorboardTimeSeries( + CreateTensorboardTimeSeriesRequest $request, + array $callOptions = [] + ): TensorboardTimeSeries { return $this->startApiCall('CreateTensorboardTimeSeries', $request, $callOptions)->wait(); } @@ -660,8 +706,10 @@ public function deleteTensorboard(DeleteTensorboardRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function deleteTensorboardExperiment(DeleteTensorboardExperimentRequest $request, array $callOptions = []): OperationResponse - { + public function deleteTensorboardExperiment( + DeleteTensorboardExperimentRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteTensorboardExperiment', $request, $callOptions)->wait(); } @@ -687,8 +735,10 @@ public function deleteTensorboardExperiment(DeleteTensorboardExperimentRequest $ * * @throws ApiException Thrown if the API call fails. */ - public function deleteTensorboardRun(DeleteTensorboardRunRequest $request, array $callOptions = []): OperationResponse - { + public function deleteTensorboardRun( + DeleteTensorboardRunRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteTensorboardRun', $request, $callOptions)->wait(); } @@ -714,8 +764,10 @@ public function deleteTensorboardRun(DeleteTensorboardRunRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function deleteTensorboardTimeSeries(DeleteTensorboardTimeSeriesRequest $request, array $callOptions = []): OperationResponse - { + public function deleteTensorboardTimeSeries( + DeleteTensorboardTimeSeriesRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteTensorboardTimeSeries', $request, $callOptions)->wait(); } @@ -742,8 +794,10 @@ public function deleteTensorboardTimeSeries(DeleteTensorboardTimeSeriesRequest $ * * @throws ApiException Thrown if the API call fails. */ - public function exportTensorboardTimeSeriesData(ExportTensorboardTimeSeriesDataRequest $request, array $callOptions = []): PagedListResponse - { + public function exportTensorboardTimeSeriesData( + ExportTensorboardTimeSeriesDataRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ExportTensorboardTimeSeriesData', $request, $callOptions); } @@ -795,8 +849,10 @@ public function getTensorboard(GetTensorboardRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function getTensorboardExperiment(GetTensorboardExperimentRequest $request, array $callOptions = []): TensorboardExperiment - { + public function getTensorboardExperiment( + GetTensorboardExperimentRequest $request, + array $callOptions = [] + ): TensorboardExperiment { return $this->startApiCall('GetTensorboardExperiment', $request, $callOptions)->wait(); } @@ -848,8 +904,10 @@ public function getTensorboardRun(GetTensorboardRunRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function getTensorboardTimeSeries(GetTensorboardTimeSeriesRequest $request, array $callOptions = []): TensorboardTimeSeries - { + public function getTensorboardTimeSeries( + GetTensorboardTimeSeriesRequest $request, + array $callOptions = [] + ): TensorboardTimeSeries { return $this->startApiCall('GetTensorboardTimeSeries', $request, $callOptions)->wait(); } @@ -875,8 +933,10 @@ public function getTensorboardTimeSeries(GetTensorboardTimeSeriesRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function listTensorboardExperiments(ListTensorboardExperimentsRequest $request, array $callOptions = []): PagedListResponse - { + public function listTensorboardExperiments( + ListTensorboardExperimentsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListTensorboardExperiments', $request, $callOptions); } @@ -929,8 +989,10 @@ public function listTensorboardRuns(ListTensorboardRunsRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function listTensorboardTimeSeries(ListTensorboardTimeSeriesRequest $request, array $callOptions = []): PagedListResponse - { + public function listTensorboardTimeSeries( + ListTensorboardTimeSeriesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListTensorboardTimeSeries', $request, $callOptions); } @@ -980,8 +1042,10 @@ public function listTensorboards(ListTensorboardsRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function readTensorboardBlobData(ReadTensorboardBlobDataRequest $request, array $callOptions = []): ServerStream - { + public function readTensorboardBlobData( + ReadTensorboardBlobDataRequest $request, + array $callOptions = [] + ): ServerStream { return $this->startApiCall('ReadTensorboardBlobData', $request, $callOptions); } @@ -1007,8 +1071,10 @@ public function readTensorboardBlobData(ReadTensorboardBlobDataRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function readTensorboardSize(ReadTensorboardSizeRequest $request, array $callOptions = []): ReadTensorboardSizeResponse - { + public function readTensorboardSize( + ReadTensorboardSizeRequest $request, + array $callOptions = [] + ): ReadTensorboardSizeResponse { return $this->startApiCall('ReadTensorboardSize', $request, $callOptions)->wait(); } @@ -1038,8 +1104,10 @@ public function readTensorboardSize(ReadTensorboardSizeRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function readTensorboardTimeSeriesData(ReadTensorboardTimeSeriesDataRequest $request, array $callOptions = []): ReadTensorboardTimeSeriesDataResponse - { + public function readTensorboardTimeSeriesData( + ReadTensorboardTimeSeriesDataRequest $request, + array $callOptions = [] + ): ReadTensorboardTimeSeriesDataResponse { return $this->startApiCall('ReadTensorboardTimeSeriesData', $request, $callOptions)->wait(); } @@ -1065,8 +1133,10 @@ public function readTensorboardTimeSeriesData(ReadTensorboardTimeSeriesDataReque * * @throws ApiException Thrown if the API call fails. */ - public function readTensorboardUsage(ReadTensorboardUsageRequest $request, array $callOptions = []): ReadTensorboardUsageResponse - { + public function readTensorboardUsage( + ReadTensorboardUsageRequest $request, + array $callOptions = [] + ): ReadTensorboardUsageResponse { return $this->startApiCall('ReadTensorboardUsage', $request, $callOptions)->wait(); } @@ -1118,8 +1188,10 @@ public function updateTensorboard(UpdateTensorboardRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function updateTensorboardExperiment(UpdateTensorboardExperimentRequest $request, array $callOptions = []): TensorboardExperiment - { + public function updateTensorboardExperiment( + UpdateTensorboardExperimentRequest $request, + array $callOptions = [] + ): TensorboardExperiment { return $this->startApiCall('UpdateTensorboardExperiment', $request, $callOptions)->wait(); } @@ -1172,8 +1244,10 @@ public function updateTensorboardRun(UpdateTensorboardRunRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function updateTensorboardTimeSeries(UpdateTensorboardTimeSeriesRequest $request, array $callOptions = []): TensorboardTimeSeries - { + public function updateTensorboardTimeSeries( + UpdateTensorboardTimeSeriesRequest $request, + array $callOptions = [] + ): TensorboardTimeSeries { return $this->startApiCall('UpdateTensorboardTimeSeries', $request, $callOptions)->wait(); } @@ -1200,8 +1274,10 @@ public function updateTensorboardTimeSeries(UpdateTensorboardTimeSeriesRequest $ * * @throws ApiException Thrown if the API call fails. */ - public function writeTensorboardExperimentData(WriteTensorboardExperimentDataRequest $request, array $callOptions = []): WriteTensorboardExperimentDataResponse - { + public function writeTensorboardExperimentData( + WriteTensorboardExperimentDataRequest $request, + array $callOptions = [] + ): WriteTensorboardExperimentDataResponse { return $this->startApiCall('WriteTensorboardExperimentData', $request, $callOptions)->wait(); } @@ -1228,8 +1304,10 @@ public function writeTensorboardExperimentData(WriteTensorboardExperimentDataReq * * @throws ApiException Thrown if the API call fails. */ - public function writeTensorboardRunData(WriteTensorboardRunDataRequest $request, array $callOptions = []): WriteTensorboardRunDataResponse - { + public function writeTensorboardRunData( + WriteTensorboardRunDataRequest $request, + array $callOptions = [] + ): WriteTensorboardRunDataResponse { return $this->startApiCall('WriteTensorboardRunData', $request, $callOptions)->wait(); } @@ -1370,8 +1448,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/Client/VizierServiceClient.php b/AiPlatform/src/V1/Client/VizierServiceClient.php index 44176b14a54f..a252778d3fd1 100644 --- a/AiPlatform/src/V1/Client/VizierServiceClient.php +++ b/AiPlatform/src/V1/Client/VizierServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a custom_job * resource. @@ -408,8 +427,10 @@ public function addTrialMeasurement(AddTrialMeasurementRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function checkTrialEarlyStoppingState(CheckTrialEarlyStoppingStateRequest $request, array $callOptions = []): OperationResponse - { + public function checkTrialEarlyStoppingState( + CheckTrialEarlyStoppingStateRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CheckTrialEarlyStoppingState', $request, $callOptions)->wait(); } @@ -616,8 +637,10 @@ public function getTrial(GetTrialRequest $request, array $callOptions = []): Tri * * @throws ApiException Thrown if the API call fails. */ - public function listOptimalTrials(ListOptimalTrialsRequest $request, array $callOptions = []): ListOptimalTrialsResponse - { + public function listOptimalTrials( + ListOptimalTrialsRequest $request, + array $callOptions = [] + ): ListOptimalTrialsResponse { return $this->startApiCall('ListOptimalTrials', $request, $callOptions)->wait(); } @@ -893,8 +916,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/AiPlatform/src/V1/CompleteTrialRequest.php b/AiPlatform/src/V1/CompleteTrialRequest.php index d47f9f07da29..4690f368b311 100644 --- a/AiPlatform/src/V1/CompleteTrialRequest.php +++ b/AiPlatform/src/V1/CompleteTrialRequest.php @@ -23,7 +23,7 @@ class CompleteTrialRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. If provided, it will be used as the completed Trial's * final_measurement; Otherwise, the service will auto-select a @@ -31,21 +31,21 @@ class CompleteTrialRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Measurement final_measurement = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $final_measurement = null; + protected $final_measurement = null; /** * Optional. True if the Trial cannot be run with the given Parameter, and * final_measurement will be ignored. * * Generated from protobuf field bool trial_infeasible = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $trial_infeasible = false; + protected $trial_infeasible = false; /** * Optional. A human readable reason why the trial was infeasible. This should * only be provided if `trial_infeasible` is true. * * Generated from protobuf field string infeasible_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $infeasible_reason = ''; + protected $infeasible_reason = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/CompletionStats.php b/AiPlatform/src/V1/CompletionStats.php index b130f6ba0eaf..a48d0f14ba2b 100644 --- a/AiPlatform/src/V1/CompletionStats.php +++ b/AiPlatform/src/V1/CompletionStats.php @@ -21,13 +21,13 @@ class CompletionStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 successful_count = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $successful_count = 0; + protected $successful_count = 0; /** * Output only. The number of entities for which any error was encountered. * * Generated from protobuf field int64 failed_count = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $failed_count = 0; + protected $failed_count = 0; /** * Output only. In cases when enough errors are encountered a job, pipeline, * or operation may be failed as a whole. Below is the number of entities for @@ -37,7 +37,7 @@ class CompletionStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 incomplete_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $incomplete_count = 0; + protected $incomplete_count = 0; /** * Output only. The number of the successful forecast points that are * generated by the forecasting model. This is ONLY used by the forecasting @@ -45,7 +45,7 @@ class CompletionStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 successful_forecast_point_count = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $successful_forecast_point_count = 0; + protected $successful_forecast_point_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/ComputeTokensRequest.php b/AiPlatform/src/V1/ComputeTokensRequest.php index 5f3ff77f5ccb..2c791dfaac28 100644 --- a/AiPlatform/src/V1/ComputeTokensRequest.php +++ b/AiPlatform/src/V1/ComputeTokensRequest.php @@ -21,7 +21,7 @@ class ComputeTokensRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Required. The instances that are the input to token computing API call. * Schema is identical to the prediction schema of the text model, even for diff --git a/AiPlatform/src/V1/ContainerRegistryDestination.php b/AiPlatform/src/V1/ContainerRegistryDestination.php index 3c6afefd6418..58fbb4c19983 100644 --- a/AiPlatform/src/V1/ContainerRegistryDestination.php +++ b/AiPlatform/src/V1/ContainerRegistryDestination.php @@ -27,7 +27,7 @@ class ContainerRegistryDestination extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string output_uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $output_uri = ''; + protected $output_uri = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ContainerSpec.php b/AiPlatform/src/V1/ContainerSpec.php index 432a29a38c2b..52f22956c176 100644 --- a/AiPlatform/src/V1/ContainerSpec.php +++ b/AiPlatform/src/V1/ContainerSpec.php @@ -21,7 +21,7 @@ class ContainerSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string image_uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $image_uri = ''; + protected $image_uri = ''; /** * The command to be invoked when the container is started. * It overrides the entrypoint instruction in Dockerfile when provided. diff --git a/AiPlatform/src/V1/Content.php b/AiPlatform/src/V1/Content.php index 4fa8104dbe4b..cac84e11bbd1 100644 --- a/AiPlatform/src/V1/Content.php +++ b/AiPlatform/src/V1/Content.php @@ -25,7 +25,7 @@ class Content extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string role = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $role = ''; + protected $role = ''; /** * Required. Ordered `Parts` that constitute a single message. Parts may have * different IANA MIME types. diff --git a/AiPlatform/src/V1/Context.php b/AiPlatform/src/V1/Context.php index 08bfb5954f63..5350832124f1 100644 --- a/AiPlatform/src/V1/Context.php +++ b/AiPlatform/src/V1/Context.php @@ -20,21 +20,21 @@ class Context extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $name = ''; + protected $name = ''; /** * User provided display name of the Context. * May be up to 128 Unicode characters. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * An eTag used to perform consistent read-modify-write updates. If not set, a * blind "overwrite" update happens. * * Generated from protobuf field string etag = 8; */ - private $etag = ''; + protected $etag = ''; /** * The labels with user-defined metadata to organize your Contexts. * Label keys and values can be no longer than 64 characters @@ -51,13 +51,13 @@ class Context extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Context was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. A list of resource names of Contexts that are parents of this * Context. A Context may have at most 10 parent_contexts. @@ -73,7 +73,7 @@ class Context extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string schema_title = 13; */ - private $schema_title = ''; + protected $schema_title = ''; /** * The version of the schema in schema_name to use. * Schema title and version is expected to be registered in earlier Create @@ -82,7 +82,7 @@ class Context extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string schema_version = 14; */ - private $schema_version = ''; + protected $schema_version = ''; /** * Properties of the Context. * Top level metadata keys' heading and trailing spaces will be trimmed. @@ -90,13 +90,13 @@ class Context extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Struct metadata = 15; */ - private $metadata = null; + protected $metadata = null; /** * Description of the Context * * Generated from protobuf field string description = 16; */ - private $description = ''; + protected $description = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/CopyModelOperationMetadata.php b/AiPlatform/src/V1/CopyModelOperationMetadata.php index 8ea99dfbeb2b..96560fa2b4a5 100644 --- a/AiPlatform/src/V1/CopyModelOperationMetadata.php +++ b/AiPlatform/src/V1/CopyModelOperationMetadata.php @@ -22,7 +22,7 @@ class CopyModelOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CopyModelRequest.php b/AiPlatform/src/V1/CopyModelRequest.php index 8df450ef2b00..c194bc851e77 100644 --- a/AiPlatform/src/V1/CopyModelRequest.php +++ b/AiPlatform/src/V1/CopyModelRequest.php @@ -22,7 +22,7 @@ class CopyModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The resource name of the Model to copy. That Model must be in the * same Project. Format: @@ -30,14 +30,14 @@ class CopyModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string source_model = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $source_model = ''; + protected $source_model = ''; /** * Customer-managed encryption key options. If this is set, * then the Model copy will be encrypted with the provided encryption key. * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 3; */ - private $encryption_spec = null; + protected $encryption_spec = null; protected $destination_model; /** diff --git a/AiPlatform/src/V1/CopyModelResponse.php b/AiPlatform/src/V1/CopyModelResponse.php index 08068028c89d..b7009c3497ea 100644 --- a/AiPlatform/src/V1/CopyModelResponse.php +++ b/AiPlatform/src/V1/CopyModelResponse.php @@ -23,13 +23,13 @@ class CopyModelResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 1 [(.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * Output only. The version ID of the model that is copied. * * Generated from protobuf field string model_version_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $model_version_id = ''; + protected $model_version_id = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/CountTokensRequest.php b/AiPlatform/src/V1/CountTokensRequest.php index 5259380af986..6a602f612b16 100644 --- a/AiPlatform/src/V1/CountTokensRequest.php +++ b/AiPlatform/src/V1/CountTokensRequest.php @@ -22,7 +22,7 @@ class CountTokensRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Required. The name of the publisher model requested to serve the * prediction. Format: @@ -30,7 +30,7 @@ class CountTokensRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $model = ''; + protected $model = ''; /** * Required. The instances that are the input to token counting call. * Schema is identical to the prediction schema of the underlying model. diff --git a/AiPlatform/src/V1/CountTokensResponse.php b/AiPlatform/src/V1/CountTokensResponse.php index e98664712b04..b2b0f04d3679 100644 --- a/AiPlatform/src/V1/CountTokensResponse.php +++ b/AiPlatform/src/V1/CountTokensResponse.php @@ -20,14 +20,14 @@ class CountTokensResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 total_tokens = 1; */ - private $total_tokens = 0; + protected $total_tokens = 0; /** * The total number of billable characters counted across all instances from * the request. * * Generated from protobuf field int32 total_billable_characters = 2; */ - private $total_billable_characters = 0; + protected $total_billable_characters = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateArtifactRequest.php b/AiPlatform/src/V1/CreateArtifactRequest.php index 9a63b32035fe..101d30793506 100644 --- a/AiPlatform/src/V1/CreateArtifactRequest.php +++ b/AiPlatform/src/V1/CreateArtifactRequest.php @@ -24,13 +24,13 @@ class CreateArtifactRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Artifact to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Artifact artifact = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $artifact = null; + protected $artifact = null; /** * The {artifact} portion of the resource name with the format: * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}` @@ -42,7 +42,7 @@ class CreateArtifactRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string artifact_id = 3; */ - private $artifact_id = ''; + protected $artifact_id = ''; /** * @param string $parent Required. The resource name of the MetadataStore where the Artifact should diff --git a/AiPlatform/src/V1/CreateBatchPredictionJobRequest.php b/AiPlatform/src/V1/CreateBatchPredictionJobRequest.php index f548ae5ca89e..5d648b95312a 100644 --- a/AiPlatform/src/V1/CreateBatchPredictionJobRequest.php +++ b/AiPlatform/src/V1/CreateBatchPredictionJobRequest.php @@ -22,13 +22,13 @@ class CreateBatchPredictionJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The BatchPredictionJob to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.BatchPredictionJob batch_prediction_job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $batch_prediction_job = null; + protected $batch_prediction_job = null; /** * @param string $parent Required. The resource name of the Location to create the diff --git a/AiPlatform/src/V1/CreateContextRequest.php b/AiPlatform/src/V1/CreateContextRequest.php index ce85b97e63e8..136459c0e04e 100644 --- a/AiPlatform/src/V1/CreateContextRequest.php +++ b/AiPlatform/src/V1/CreateContextRequest.php @@ -23,13 +23,13 @@ class CreateContextRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Context to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Context context = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $context = null; + protected $context = null; /** * The {context} portion of the resource name with the format: * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`. @@ -41,7 +41,7 @@ class CreateContextRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string context_id = 3; */ - private $context_id = ''; + protected $context_id = ''; /** * @param string $parent Required. The resource name of the MetadataStore where the Context should diff --git a/AiPlatform/src/V1/CreateCustomJobRequest.php b/AiPlatform/src/V1/CreateCustomJobRequest.php index 7071ebb47479..b277cb82d0c0 100644 --- a/AiPlatform/src/V1/CreateCustomJobRequest.php +++ b/AiPlatform/src/V1/CreateCustomJobRequest.php @@ -22,13 +22,13 @@ class CreateCustomJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The CustomJob to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.CustomJob custom_job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $custom_job = null; + protected $custom_job = null; /** * @param string $parent Required. The resource name of the Location to create the CustomJob in. diff --git a/AiPlatform/src/V1/CreateDataLabelingJobRequest.php b/AiPlatform/src/V1/CreateDataLabelingJobRequest.php index 250577a6634f..606b44afff62 100644 --- a/AiPlatform/src/V1/CreateDataLabelingJobRequest.php +++ b/AiPlatform/src/V1/CreateDataLabelingJobRequest.php @@ -22,13 +22,13 @@ class CreateDataLabelingJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The DataLabelingJob to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.DataLabelingJob data_labeling_job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $data_labeling_job = null; + protected $data_labeling_job = null; /** * @param string $parent Required. The parent of the DataLabelingJob. diff --git a/AiPlatform/src/V1/CreateDatasetOperationMetadata.php b/AiPlatform/src/V1/CreateDatasetOperationMetadata.php index 9bc9cc07a5bf..a4f1442b8b58 100644 --- a/AiPlatform/src/V1/CreateDatasetOperationMetadata.php +++ b/AiPlatform/src/V1/CreateDatasetOperationMetadata.php @@ -21,7 +21,7 @@ class CreateDatasetOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateDatasetRequest.php b/AiPlatform/src/V1/CreateDatasetRequest.php index 6efd0d33f276..56909d8b33e7 100644 --- a/AiPlatform/src/V1/CreateDatasetRequest.php +++ b/AiPlatform/src/V1/CreateDatasetRequest.php @@ -22,13 +22,13 @@ class CreateDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Dataset to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Dataset dataset = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $dataset = null; + protected $dataset = null; /** * @param string $parent Required. The resource name of the Location to create the Dataset in. diff --git a/AiPlatform/src/V1/CreateDatasetVersionOperationMetadata.php b/AiPlatform/src/V1/CreateDatasetVersionOperationMetadata.php index 26f53577a250..42a9dfce633b 100644 --- a/AiPlatform/src/V1/CreateDatasetVersionOperationMetadata.php +++ b/AiPlatform/src/V1/CreateDatasetVersionOperationMetadata.php @@ -21,7 +21,7 @@ class CreateDatasetVersionOperationMetadata extends \Google\Protobuf\Internal\Me * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateDatasetVersionRequest.php b/AiPlatform/src/V1/CreateDatasetVersionRequest.php index a8cdb399abc5..d52bc548f697 100644 --- a/AiPlatform/src/V1/CreateDatasetVersionRequest.php +++ b/AiPlatform/src/V1/CreateDatasetVersionRequest.php @@ -23,7 +23,7 @@ class CreateDatasetVersionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The version to be created. The same CMEK policies with the * original Dataset will be applied the dataset version. So here we don't need @@ -31,7 +31,7 @@ class CreateDatasetVersionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DatasetVersion dataset_version = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $dataset_version = null; + protected $dataset_version = null; /** * @param string $parent Required. The name of the Dataset resource. diff --git a/AiPlatform/src/V1/CreateDeploymentResourcePoolOperationMetadata.php b/AiPlatform/src/V1/CreateDeploymentResourcePoolOperationMetadata.php index 07c992a074c1..b3a73f8363b7 100644 --- a/AiPlatform/src/V1/CreateDeploymentResourcePoolOperationMetadata.php +++ b/AiPlatform/src/V1/CreateDeploymentResourcePoolOperationMetadata.php @@ -20,7 +20,7 @@ class CreateDeploymentResourcePoolOperationMetadata extends \Google\Protobuf\Int * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateDeploymentResourcePoolRequest.php b/AiPlatform/src/V1/CreateDeploymentResourcePoolRequest.php index 22ecd50d0853..b2159a3fb47d 100644 --- a/AiPlatform/src/V1/CreateDeploymentResourcePoolRequest.php +++ b/AiPlatform/src/V1/CreateDeploymentResourcePoolRequest.php @@ -21,13 +21,13 @@ class CreateDeploymentResourcePoolRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The DeploymentResourcePool to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.DeploymentResourcePool deployment_resource_pool = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployment_resource_pool = null; + protected $deployment_resource_pool = null; /** * Required. The ID to use for the DeploymentResourcePool, which * will become the final component of the DeploymentResourcePool's resource @@ -37,7 +37,7 @@ class CreateDeploymentResourcePoolRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string deployment_resource_pool_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployment_resource_pool_id = ''; + protected $deployment_resource_pool_id = ''; /** * @param string $parent Required. The parent location resource where this DeploymentResourcePool diff --git a/AiPlatform/src/V1/CreateEndpointOperationMetadata.php b/AiPlatform/src/V1/CreateEndpointOperationMetadata.php index 19f0de9900e0..2541cb6f4554 100644 --- a/AiPlatform/src/V1/CreateEndpointOperationMetadata.php +++ b/AiPlatform/src/V1/CreateEndpointOperationMetadata.php @@ -21,7 +21,7 @@ class CreateEndpointOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateEndpointRequest.php b/AiPlatform/src/V1/CreateEndpointRequest.php index 6951d70cca0e..7b06487c5ec6 100644 --- a/AiPlatform/src/V1/CreateEndpointRequest.php +++ b/AiPlatform/src/V1/CreateEndpointRequest.php @@ -22,13 +22,13 @@ class CreateEndpointRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Endpoint to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Endpoint endpoint = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $endpoint = null; + protected $endpoint = null; /** * Immutable. The ID to use for endpoint, which will become the final * component of the endpoint resource name. @@ -44,7 +44,7 @@ class CreateEndpointRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint_id = 4 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $endpoint_id = ''; + protected $endpoint_id = ''; /** * @param string $parent Required. The resource name of the Location to create the Endpoint in. diff --git a/AiPlatform/src/V1/CreateEntityTypeOperationMetadata.php b/AiPlatform/src/V1/CreateEntityTypeOperationMetadata.php index 2b6efae59a28..cdd88cbab3d7 100644 --- a/AiPlatform/src/V1/CreateEntityTypeOperationMetadata.php +++ b/AiPlatform/src/V1/CreateEntityTypeOperationMetadata.php @@ -20,7 +20,7 @@ class CreateEntityTypeOperationMetadata extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateEntityTypeRequest.php b/AiPlatform/src/V1/CreateEntityTypeRequest.php index 697677bdebf0..33de6a198416 100644 --- a/AiPlatform/src/V1/CreateEntityTypeRequest.php +++ b/AiPlatform/src/V1/CreateEntityTypeRequest.php @@ -23,13 +23,13 @@ class CreateEntityTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The EntityType to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.EntityType entity_type = 2; */ - private $entity_type = null; + protected $entity_type = null; /** * Required. The ID to use for the EntityType, which will become the final * component of the EntityType's resource name. @@ -39,7 +39,7 @@ class CreateEntityTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_type_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $entity_type_id = ''; + protected $entity_type_id = ''; /** * @param string $parent Required. The resource name of the Featurestore to create EntityTypes. diff --git a/AiPlatform/src/V1/CreateExecutionRequest.php b/AiPlatform/src/V1/CreateExecutionRequest.php index 91ac38f25ce4..d1cdc202c321 100644 --- a/AiPlatform/src/V1/CreateExecutionRequest.php +++ b/AiPlatform/src/V1/CreateExecutionRequest.php @@ -24,13 +24,13 @@ class CreateExecutionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Execution to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $execution = null; + protected $execution = null; /** * The {execution} portion of the resource name with the format: * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}` @@ -43,7 +43,7 @@ class CreateExecutionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string execution_id = 3; */ - private $execution_id = ''; + protected $execution_id = ''; /** * @param string $parent Required. The resource name of the MetadataStore where the Execution should diff --git a/AiPlatform/src/V1/CreateFeatureGroupOperationMetadata.php b/AiPlatform/src/V1/CreateFeatureGroupOperationMetadata.php index ba561350a538..4f2674eccbec 100644 --- a/AiPlatform/src/V1/CreateFeatureGroupOperationMetadata.php +++ b/AiPlatform/src/V1/CreateFeatureGroupOperationMetadata.php @@ -20,7 +20,7 @@ class CreateFeatureGroupOperationMetadata extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateFeatureGroupRequest.php b/AiPlatform/src/V1/CreateFeatureGroupRequest.php index 13c6eb258287..499466d08850 100644 --- a/AiPlatform/src/V1/CreateFeatureGroupRequest.php +++ b/AiPlatform/src/V1/CreateFeatureGroupRequest.php @@ -23,13 +23,13 @@ class CreateFeatureGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The FeatureGroup to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureGroup feature_group = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_group = null; + protected $feature_group = null; /** * Required. The ID to use for this FeatureGroup, which will become the final * component of the FeatureGroup's resource name. @@ -39,7 +39,7 @@ class CreateFeatureGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_group_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_group_id = ''; + protected $feature_group_id = ''; /** * @param string $parent Required. The resource name of the Location to create FeatureGroups. diff --git a/AiPlatform/src/V1/CreateFeatureOnlineStoreOperationMetadata.php b/AiPlatform/src/V1/CreateFeatureOnlineStoreOperationMetadata.php index ad71a018d8c7..3b46d3c6c144 100644 --- a/AiPlatform/src/V1/CreateFeatureOnlineStoreOperationMetadata.php +++ b/AiPlatform/src/V1/CreateFeatureOnlineStoreOperationMetadata.php @@ -20,7 +20,7 @@ class CreateFeatureOnlineStoreOperationMetadata extends \Google\Protobuf\Interna * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateFeatureOnlineStoreRequest.php b/AiPlatform/src/V1/CreateFeatureOnlineStoreRequest.php index 5a11795e7297..2e8f2f2c7493 100644 --- a/AiPlatform/src/V1/CreateFeatureOnlineStoreRequest.php +++ b/AiPlatform/src/V1/CreateFeatureOnlineStoreRequest.php @@ -23,13 +23,13 @@ class CreateFeatureOnlineStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The FeatureOnlineStore to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureOnlineStore feature_online_store = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_online_store = null; + protected $feature_online_store = null; /** * Required. The ID to use for this FeatureOnlineStore, which will become the * final component of the FeatureOnlineStore's resource name. @@ -39,7 +39,7 @@ class CreateFeatureOnlineStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_online_store_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_online_store_id = ''; + protected $feature_online_store_id = ''; /** * @param string $parent Required. The resource name of the Location to create FeatureOnlineStores. diff --git a/AiPlatform/src/V1/CreateFeatureOperationMetadata.php b/AiPlatform/src/V1/CreateFeatureOperationMetadata.php index 78c1535a8d88..6f4fb7c00ee0 100644 --- a/AiPlatform/src/V1/CreateFeatureOperationMetadata.php +++ b/AiPlatform/src/V1/CreateFeatureOperationMetadata.php @@ -20,7 +20,7 @@ class CreateFeatureOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateFeatureRequest.php b/AiPlatform/src/V1/CreateFeatureRequest.php index 7f1bef81f3af..3088d4e892ec 100644 --- a/AiPlatform/src/V1/CreateFeatureRequest.php +++ b/AiPlatform/src/V1/CreateFeatureRequest.php @@ -27,13 +27,13 @@ class CreateFeatureRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Feature to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Feature feature = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature = null; + protected $feature = null; /** * Required. The ID to use for the Feature, which will become the final * component of the Feature's resource name. @@ -43,7 +43,7 @@ class CreateFeatureRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_id = ''; + protected $feature_id = ''; /** * @param string $parent Required. The resource name of the EntityType or FeatureGroup to create a diff --git a/AiPlatform/src/V1/CreateFeatureViewOperationMetadata.php b/AiPlatform/src/V1/CreateFeatureViewOperationMetadata.php index 7174e458fce5..9afadfee20b9 100644 --- a/AiPlatform/src/V1/CreateFeatureViewOperationMetadata.php +++ b/AiPlatform/src/V1/CreateFeatureViewOperationMetadata.php @@ -20,7 +20,7 @@ class CreateFeatureViewOperationMetadata extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateFeatureViewRequest.php b/AiPlatform/src/V1/CreateFeatureViewRequest.php index cfd003e0d168..d7c4f8746c39 100644 --- a/AiPlatform/src/V1/CreateFeatureViewRequest.php +++ b/AiPlatform/src/V1/CreateFeatureViewRequest.php @@ -23,13 +23,13 @@ class CreateFeatureViewRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The FeatureView to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureView feature_view = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_view = null; + protected $feature_view = null; /** * Required. The ID to use for the FeatureView, which will become the final * component of the FeatureView's resource name. @@ -39,7 +39,7 @@ class CreateFeatureViewRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_view_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_view_id = ''; + protected $feature_view_id = ''; /** * Immutable. If set to true, one on demand sync will be run immediately, * regardless whether the @@ -48,7 +48,7 @@ class CreateFeatureViewRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool run_sync_immediately = 4 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $run_sync_immediately = false; + protected $run_sync_immediately = false; /** * @param string $parent Required. The resource name of the FeatureOnlineStore to create diff --git a/AiPlatform/src/V1/CreateFeaturestoreOperationMetadata.php b/AiPlatform/src/V1/CreateFeaturestoreOperationMetadata.php index c0661eeb5c32..cfbfb6e717be 100644 --- a/AiPlatform/src/V1/CreateFeaturestoreOperationMetadata.php +++ b/AiPlatform/src/V1/CreateFeaturestoreOperationMetadata.php @@ -20,7 +20,7 @@ class CreateFeaturestoreOperationMetadata extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateFeaturestoreRequest.php b/AiPlatform/src/V1/CreateFeaturestoreRequest.php index 4db5693dc86e..65a3c26fa649 100644 --- a/AiPlatform/src/V1/CreateFeaturestoreRequest.php +++ b/AiPlatform/src/V1/CreateFeaturestoreRequest.php @@ -23,13 +23,13 @@ class CreateFeaturestoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Featurestore to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Featurestore featurestore = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $featurestore = null; + protected $featurestore = null; /** * Required. The ID to use for this Featurestore, which will become the final * component of the Featurestore's resource name. @@ -39,7 +39,7 @@ class CreateFeaturestoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string featurestore_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $featurestore_id = ''; + protected $featurestore_id = ''; /** * @param string $parent Required. The resource name of the Location to create Featurestores. diff --git a/AiPlatform/src/V1/CreateHyperparameterTuningJobRequest.php b/AiPlatform/src/V1/CreateHyperparameterTuningJobRequest.php index c80b9d782b4c..bbc29fe3a679 100644 --- a/AiPlatform/src/V1/CreateHyperparameterTuningJobRequest.php +++ b/AiPlatform/src/V1/CreateHyperparameterTuningJobRequest.php @@ -23,13 +23,13 @@ class CreateHyperparameterTuningJobRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The HyperparameterTuningJob to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.HyperparameterTuningJob hyperparameter_tuning_job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $hyperparameter_tuning_job = null; + protected $hyperparameter_tuning_job = null; /** * @param string $parent Required. The resource name of the Location to create the diff --git a/AiPlatform/src/V1/CreateIndexEndpointOperationMetadata.php b/AiPlatform/src/V1/CreateIndexEndpointOperationMetadata.php index 4241a1e50ae2..c87e3c1abf76 100644 --- a/AiPlatform/src/V1/CreateIndexEndpointOperationMetadata.php +++ b/AiPlatform/src/V1/CreateIndexEndpointOperationMetadata.php @@ -21,7 +21,7 @@ class CreateIndexEndpointOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateIndexEndpointRequest.php b/AiPlatform/src/V1/CreateIndexEndpointRequest.php index 7529d1a09cfa..6649ba6db0a6 100644 --- a/AiPlatform/src/V1/CreateIndexEndpointRequest.php +++ b/AiPlatform/src/V1/CreateIndexEndpointRequest.php @@ -22,13 +22,13 @@ class CreateIndexEndpointRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The IndexEndpoint to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.IndexEndpoint index_endpoint = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $index_endpoint = null; + protected $index_endpoint = null; /** * @param string $parent Required. The resource name of the Location to create the IndexEndpoint in. diff --git a/AiPlatform/src/V1/CreateIndexOperationMetadata.php b/AiPlatform/src/V1/CreateIndexOperationMetadata.php index a7fc3000b237..a7d66dd9462f 100644 --- a/AiPlatform/src/V1/CreateIndexOperationMetadata.php +++ b/AiPlatform/src/V1/CreateIndexOperationMetadata.php @@ -21,13 +21,13 @@ class CreateIndexOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * The operation metadata with regard to Matching Engine Index operation. * * Generated from protobuf field .google.cloud.aiplatform.v1.NearestNeighborSearchOperationMetadata nearest_neighbor_search_operation_metadata = 2; */ - private $nearest_neighbor_search_operation_metadata = null; + protected $nearest_neighbor_search_operation_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateIndexRequest.php b/AiPlatform/src/V1/CreateIndexRequest.php index 70b4a7f579e4..eb6fa1d4e365 100644 --- a/AiPlatform/src/V1/CreateIndexRequest.php +++ b/AiPlatform/src/V1/CreateIndexRequest.php @@ -22,13 +22,13 @@ class CreateIndexRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Index to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Index index = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $index = null; + protected $index = null; /** * @param string $parent Required. The resource name of the Location to create the Index in. diff --git a/AiPlatform/src/V1/CreateMetadataSchemaRequest.php b/AiPlatform/src/V1/CreateMetadataSchemaRequest.php index cdadababb269..f0730dff1318 100644 --- a/AiPlatform/src/V1/CreateMetadataSchemaRequest.php +++ b/AiPlatform/src/V1/CreateMetadataSchemaRequest.php @@ -23,13 +23,13 @@ class CreateMetadataSchemaRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The MetadataSchema to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.MetadataSchema metadata_schema = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $metadata_schema = null; + protected $metadata_schema = null; /** * The {metadata_schema} portion of the resource name with the format: * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/metadataSchemas/{metadataschema}` @@ -42,7 +42,7 @@ class CreateMetadataSchemaRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metadata_schema_id = 3; */ - private $metadata_schema_id = ''; + protected $metadata_schema_id = ''; /** * @param string $parent Required. The resource name of the MetadataStore where the MetadataSchema diff --git a/AiPlatform/src/V1/CreateMetadataStoreOperationMetadata.php b/AiPlatform/src/V1/CreateMetadataStoreOperationMetadata.php index 0c39b85b8c78..8a2e4b516b29 100644 --- a/AiPlatform/src/V1/CreateMetadataStoreOperationMetadata.php +++ b/AiPlatform/src/V1/CreateMetadataStoreOperationMetadata.php @@ -21,7 +21,7 @@ class CreateMetadataStoreOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateMetadataStoreRequest.php b/AiPlatform/src/V1/CreateMetadataStoreRequest.php index 1b3f676ae7d7..e6296df82838 100644 --- a/AiPlatform/src/V1/CreateMetadataStoreRequest.php +++ b/AiPlatform/src/V1/CreateMetadataStoreRequest.php @@ -23,13 +23,13 @@ class CreateMetadataStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The MetadataStore to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.MetadataStore metadata_store = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $metadata_store = null; + protected $metadata_store = null; /** * The {metadatastore} portion of the resource name with the format: * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` @@ -42,7 +42,7 @@ class CreateMetadataStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metadata_store_id = 3; */ - private $metadata_store_id = ''; + protected $metadata_store_id = ''; /** * @param string $parent Required. The resource name of the Location where the MetadataStore should diff --git a/AiPlatform/src/V1/CreateModelDeploymentMonitoringJobRequest.php b/AiPlatform/src/V1/CreateModelDeploymentMonitoringJobRequest.php index e28913d4eaf3..42753eba208e 100644 --- a/AiPlatform/src/V1/CreateModelDeploymentMonitoringJobRequest.php +++ b/AiPlatform/src/V1/CreateModelDeploymentMonitoringJobRequest.php @@ -22,13 +22,13 @@ class CreateModelDeploymentMonitoringJobRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The ModelDeploymentMonitoringJob to create * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob model_deployment_monitoring_job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $model_deployment_monitoring_job = null; + protected $model_deployment_monitoring_job = null; /** * @param string $parent Required. The parent of the ModelDeploymentMonitoringJob. diff --git a/AiPlatform/src/V1/CreateNasJobRequest.php b/AiPlatform/src/V1/CreateNasJobRequest.php index 9d25d3c7b909..12c1010b4376 100644 --- a/AiPlatform/src/V1/CreateNasJobRequest.php +++ b/AiPlatform/src/V1/CreateNasJobRequest.php @@ -22,13 +22,13 @@ class CreateNasJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The NasJob to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.NasJob nas_job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $nas_job = null; + protected $nas_job = null; /** * @param string $parent Required. The resource name of the Location to create the NasJob in. diff --git a/AiPlatform/src/V1/CreateNotebookRuntimeTemplateOperationMetadata.php b/AiPlatform/src/V1/CreateNotebookRuntimeTemplateOperationMetadata.php index ebe3d31c4744..37373db16dbe 100644 --- a/AiPlatform/src/V1/CreateNotebookRuntimeTemplateOperationMetadata.php +++ b/AiPlatform/src/V1/CreateNotebookRuntimeTemplateOperationMetadata.php @@ -21,7 +21,7 @@ class CreateNotebookRuntimeTemplateOperationMetadata extends \Google\Protobuf\In * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateNotebookRuntimeTemplateRequest.php b/AiPlatform/src/V1/CreateNotebookRuntimeTemplateRequest.php index 3f98a973d495..3ca52baacf6f 100644 --- a/AiPlatform/src/V1/CreateNotebookRuntimeTemplateRequest.php +++ b/AiPlatform/src/V1/CreateNotebookRuntimeTemplateRequest.php @@ -22,19 +22,19 @@ class CreateNotebookRuntimeTemplateRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The NotebookRuntimeTemplate to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookRuntimeTemplate notebook_runtime_template = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $notebook_runtime_template = null; + protected $notebook_runtime_template = null; /** * Optional. User specified ID for the notebook runtime template. * * Generated from protobuf field string notebook_runtime_template_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $notebook_runtime_template_id = ''; + protected $notebook_runtime_template_id = ''; /** * @param string $parent Required. The resource name of the Location to create the diff --git a/AiPlatform/src/V1/CreatePersistentResourceOperationMetadata.php b/AiPlatform/src/V1/CreatePersistentResourceOperationMetadata.php index 77f013958a4d..b963a2703371 100644 --- a/AiPlatform/src/V1/CreatePersistentResourceOperationMetadata.php +++ b/AiPlatform/src/V1/CreatePersistentResourceOperationMetadata.php @@ -20,13 +20,13 @@ class CreatePersistentResourceOperationMetadata extends \Google\Protobuf\Interna * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Progress Message for Create LRO * * Generated from protobuf field string progress_message = 2; */ - private $progress_message = ''; + protected $progress_message = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/CreatePersistentResourceRequest.php b/AiPlatform/src/V1/CreatePersistentResourceRequest.php index 394dde330e1d..4010dc35ad9a 100644 --- a/AiPlatform/src/V1/CreatePersistentResourceRequest.php +++ b/AiPlatform/src/V1/CreatePersistentResourceRequest.php @@ -22,13 +22,13 @@ class CreatePersistentResourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The PersistentResource to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.PersistentResource persistent_resource = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $persistent_resource = null; + protected $persistent_resource = null; /** * Required. The ID to use for the PersistentResource, which become the final * component of the PersistentResource's resource name. @@ -37,7 +37,7 @@ class CreatePersistentResourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string persistent_resource_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $persistent_resource_id = ''; + protected $persistent_resource_id = ''; /** * @param string $parent Required. The resource name of the Location to create the diff --git a/AiPlatform/src/V1/CreatePipelineJobRequest.php b/AiPlatform/src/V1/CreatePipelineJobRequest.php index a200921e44d6..3f82ca54660f 100644 --- a/AiPlatform/src/V1/CreatePipelineJobRequest.php +++ b/AiPlatform/src/V1/CreatePipelineJobRequest.php @@ -22,13 +22,13 @@ class CreatePipelineJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The PipelineJob to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineJob pipeline_job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $pipeline_job = null; + protected $pipeline_job = null; /** * The ID to use for the PipelineJob, which will become the final component of * the PipelineJob name. If not provided, an ID will be automatically @@ -38,7 +38,7 @@ class CreatePipelineJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string pipeline_job_id = 3; */ - private $pipeline_job_id = ''; + protected $pipeline_job_id = ''; /** * @param string $parent Required. The resource name of the Location to create the PipelineJob in. diff --git a/AiPlatform/src/V1/CreateRegistryFeatureOperationMetadata.php b/AiPlatform/src/V1/CreateRegistryFeatureOperationMetadata.php index 8f9bd4e0e2ed..bd41c4b8e253 100644 --- a/AiPlatform/src/V1/CreateRegistryFeatureOperationMetadata.php +++ b/AiPlatform/src/V1/CreateRegistryFeatureOperationMetadata.php @@ -20,7 +20,7 @@ class CreateRegistryFeatureOperationMetadata extends \Google\Protobuf\Internal\M * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateScheduleRequest.php b/AiPlatform/src/V1/CreateScheduleRequest.php index 30eabe624afc..1eedb9122b64 100644 --- a/AiPlatform/src/V1/CreateScheduleRequest.php +++ b/AiPlatform/src/V1/CreateScheduleRequest.php @@ -22,13 +22,13 @@ class CreateScheduleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Schedule to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Schedule schedule = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $schedule = null; + protected $schedule = null; /** * @param string $parent Required. The resource name of the Location to create the Schedule in. diff --git a/AiPlatform/src/V1/CreateSpecialistPoolOperationMetadata.php b/AiPlatform/src/V1/CreateSpecialistPoolOperationMetadata.php index 73fc051fbce3..09d7fb3f3f32 100644 --- a/AiPlatform/src/V1/CreateSpecialistPoolOperationMetadata.php +++ b/AiPlatform/src/V1/CreateSpecialistPoolOperationMetadata.php @@ -21,7 +21,7 @@ class CreateSpecialistPoolOperationMetadata extends \Google\Protobuf\Internal\Me * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateSpecialistPoolRequest.php b/AiPlatform/src/V1/CreateSpecialistPoolRequest.php index b62126b820b4..99819c0e077d 100644 --- a/AiPlatform/src/V1/CreateSpecialistPoolRequest.php +++ b/AiPlatform/src/V1/CreateSpecialistPoolRequest.php @@ -22,13 +22,13 @@ class CreateSpecialistPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The SpecialistPool to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.SpecialistPool specialist_pool = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $specialist_pool = null; + protected $specialist_pool = null; /** * @param string $parent Required. The parent Project name for the new SpecialistPool. diff --git a/AiPlatform/src/V1/CreateStudyRequest.php b/AiPlatform/src/V1/CreateStudyRequest.php index e5a2a16b5865..44171412c6f6 100644 --- a/AiPlatform/src/V1/CreateStudyRequest.php +++ b/AiPlatform/src/V1/CreateStudyRequest.php @@ -22,13 +22,13 @@ class CreateStudyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Study configuration used to create the Study. * * Generated from protobuf field .google.cloud.aiplatform.v1.Study study = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $study = null; + protected $study = null; /** * @param string $parent Required. The resource name of the Location to create the CustomJob in. diff --git a/AiPlatform/src/V1/CreateTensorboardExperimentRequest.php b/AiPlatform/src/V1/CreateTensorboardExperimentRequest.php index 8ffe522a768b..26fcd906e9ec 100644 --- a/AiPlatform/src/V1/CreateTensorboardExperimentRequest.php +++ b/AiPlatform/src/V1/CreateTensorboardExperimentRequest.php @@ -23,13 +23,13 @@ class CreateTensorboardExperimentRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The TensorboardExperiment to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.TensorboardExperiment tensorboard_experiment = 2; */ - private $tensorboard_experiment = null; + protected $tensorboard_experiment = null; /** * Required. The ID to use for the Tensorboard experiment, which becomes the * final component of the Tensorboard experiment's resource name. @@ -38,7 +38,7 @@ class CreateTensorboardExperimentRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string tensorboard_experiment_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard_experiment_id = ''; + protected $tensorboard_experiment_id = ''; /** * @param string $parent Required. The resource name of the Tensorboard to create the diff --git a/AiPlatform/src/V1/CreateTensorboardOperationMetadata.php b/AiPlatform/src/V1/CreateTensorboardOperationMetadata.php index 4032025394dd..d616c1223d86 100644 --- a/AiPlatform/src/V1/CreateTensorboardOperationMetadata.php +++ b/AiPlatform/src/V1/CreateTensorboardOperationMetadata.php @@ -20,7 +20,7 @@ class CreateTensorboardOperationMetadata extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CreateTensorboardRequest.php b/AiPlatform/src/V1/CreateTensorboardRequest.php index 2883cad8443a..c90005dce05d 100644 --- a/AiPlatform/src/V1/CreateTensorboardRequest.php +++ b/AiPlatform/src/V1/CreateTensorboardRequest.php @@ -22,13 +22,13 @@ class CreateTensorboardRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Tensorboard to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Tensorboard tensorboard = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard = null; + protected $tensorboard = null; /** * @param string $parent Required. The resource name of the Location to create the Tensorboard in. diff --git a/AiPlatform/src/V1/CreateTensorboardRunRequest.php b/AiPlatform/src/V1/CreateTensorboardRunRequest.php index f8e8e906fed0..4e6f6e0f97ac 100644 --- a/AiPlatform/src/V1/CreateTensorboardRunRequest.php +++ b/AiPlatform/src/V1/CreateTensorboardRunRequest.php @@ -23,13 +23,13 @@ class CreateTensorboardRunRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The TensorboardRun to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.TensorboardRun tensorboard_run = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard_run = null; + protected $tensorboard_run = null; /** * Required. The ID to use for the Tensorboard run, which becomes the final * component of the Tensorboard run's resource name. @@ -38,7 +38,7 @@ class CreateTensorboardRunRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string tensorboard_run_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard_run_id = ''; + protected $tensorboard_run_id = ''; /** * @param string $parent Required. The resource name of the TensorboardExperiment to create the diff --git a/AiPlatform/src/V1/CreateTensorboardTimeSeriesRequest.php b/AiPlatform/src/V1/CreateTensorboardTimeSeriesRequest.php index ea596b317977..083318647e35 100644 --- a/AiPlatform/src/V1/CreateTensorboardTimeSeriesRequest.php +++ b/AiPlatform/src/V1/CreateTensorboardTimeSeriesRequest.php @@ -24,7 +24,7 @@ class CreateTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The user specified unique ID to use for the * TensorboardTimeSeries, which becomes the final component of the @@ -33,13 +33,13 @@ class CreateTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string tensorboard_time_series_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $tensorboard_time_series_id = ''; + protected $tensorboard_time_series_id = ''; /** * Required. The TensorboardTimeSeries to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.TensorboardTimeSeries tensorboard_time_series = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard_time_series = null; + protected $tensorboard_time_series = null; /** * @param string $parent Required. The resource name of the TensorboardRun to create the diff --git a/AiPlatform/src/V1/CreateTrainingPipelineRequest.php b/AiPlatform/src/V1/CreateTrainingPipelineRequest.php index 6062188d7cec..e7ee7ee5ed66 100644 --- a/AiPlatform/src/V1/CreateTrainingPipelineRequest.php +++ b/AiPlatform/src/V1/CreateTrainingPipelineRequest.php @@ -22,13 +22,13 @@ class CreateTrainingPipelineRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The TrainingPipeline to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.TrainingPipeline training_pipeline = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $training_pipeline = null; + protected $training_pipeline = null; /** * @param string $parent Required. The resource name of the Location to create the TrainingPipeline diff --git a/AiPlatform/src/V1/CreateTrialRequest.php b/AiPlatform/src/V1/CreateTrialRequest.php index d14fc9105ba4..d2551167761d 100644 --- a/AiPlatform/src/V1/CreateTrialRequest.php +++ b/AiPlatform/src/V1/CreateTrialRequest.php @@ -22,13 +22,13 @@ class CreateTrialRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The Trial to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Trial trial = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $trial = null; + protected $trial = null; /** * @param string $parent Required. The resource name of the Study to create the Trial in. diff --git a/AiPlatform/src/V1/CreateTuningJobRequest.php b/AiPlatform/src/V1/CreateTuningJobRequest.php index 2b013f8c374e..345c2afa06f0 100644 --- a/AiPlatform/src/V1/CreateTuningJobRequest.php +++ b/AiPlatform/src/V1/CreateTuningJobRequest.php @@ -22,13 +22,13 @@ class CreateTuningJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The TuningJob to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.TuningJob tuning_job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $tuning_job = null; + protected $tuning_job = null; /** * @param string $parent Required. The resource name of the Location to create the TuningJob in. diff --git a/AiPlatform/src/V1/CsvDestination.php b/AiPlatform/src/V1/CsvDestination.php index bcdfe510d0d5..70c7a3eafe6e 100644 --- a/AiPlatform/src/V1/CsvDestination.php +++ b/AiPlatform/src/V1/CsvDestination.php @@ -20,7 +20,7 @@ class CsvDestination extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GcsDestination gcs_destination = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $gcs_destination = null; + protected $gcs_destination = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CsvSource.php b/AiPlatform/src/V1/CsvSource.php index ec93fefa9877..9831670ed928 100644 --- a/AiPlatform/src/V1/CsvSource.php +++ b/AiPlatform/src/V1/CsvSource.php @@ -20,7 +20,7 @@ class CsvSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GcsSource gcs_source = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $gcs_source = null; + protected $gcs_source = null; /** * Constructor. diff --git a/AiPlatform/src/V1/CustomJob.php b/AiPlatform/src/V1/CustomJob.php index 5b32c0a03113..116820996d64 100644 --- a/AiPlatform/src/V1/CustomJob.php +++ b/AiPlatform/src/V1/CustomJob.php @@ -23,7 +23,7 @@ class CustomJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The display name of the CustomJob. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -31,52 +31,52 @@ class CustomJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Required. Job spec. * * Generated from protobuf field .google.cloud.aiplatform.v1.CustomJobSpec job_spec = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $job_spec = null; + protected $job_spec = null; /** * Output only. The detailed state of the job. * * Generated from protobuf field .google.cloud.aiplatform.v1.JobState state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Time when the CustomJob was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Time when the CustomJob for the first time entered the * `JOB_STATE_RUNNING` state. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Time when the CustomJob entered any of the following states: * `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Time when the CustomJob was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. Only populated when job's state is `JOB_STATE_FAILED` or * `JOB_STATE_CANCELLED`. * * Generated from protobuf field .google.rpc.Status error = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * The labels with user-defined metadata to organize CustomJobs. * Label keys and values can be no longer than 64 characters @@ -94,7 +94,7 @@ class CustomJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 12; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Output only. URIs for accessing [interactive * shells](https://cloud.google.com/vertex-ai/docs/training/monitor-debug-interactive-shell) diff --git a/AiPlatform/src/V1/CustomJobSpec.php b/AiPlatform/src/V1/CustomJobSpec.php index d4226496f917..5cb74488ed68 100644 --- a/AiPlatform/src/V1/CustomJobSpec.php +++ b/AiPlatform/src/V1/CustomJobSpec.php @@ -25,7 +25,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string persistent_resource_id = 14 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $persistent_resource_id = ''; + protected $persistent_resource_id = ''; /** * Required. The spec of the worker pools including machine type and Docker * image. All worker pools except the first one are optional and can be @@ -39,7 +39,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Scheduling scheduling = 3; */ - private $scheduling = null; + protected $scheduling = null; /** * Specifies the service account for workload run-as account. * Users submitting jobs must have act-as permission on this run-as account. @@ -49,12 +49,12 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 4; */ - private $service_account = ''; + protected $service_account = ''; /** * Optional. The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the Job + * [network](/compute/docs/networks-and-firewalls#networks) to which the Job * should be peered. For example, `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. @@ -65,7 +65,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $network = ''; + protected $network = ''; /** * Optional. A list of names for the reserved ip ranges under the VPC network * that can be used for this job. @@ -97,7 +97,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GcsDestination base_output_directory = 6; */ - private $base_output_directory = null; + protected $base_output_directory = null; /** * The ID of the location to store protected artifacts. e.g. us-central1. * Populate only when the location is different than CustomJob location. @@ -106,7 +106,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string protected_artifact_location_id = 19; */ - private $protected_artifact_location_id = ''; + protected $protected_artifact_location_id = ''; /** * Optional. The name of a Vertex AI * [Tensorboard][google.cloud.aiplatform.v1.Tensorboard] resource to which @@ -115,7 +115,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string tensorboard = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $tensorboard = ''; + protected $tensorboard = ''; /** * Optional. Whether you want Vertex AI to enable [interactive shell * access](https://cloud.google.com/vertex-ai/docs/training/monitor-debug-interactive-shell) @@ -130,7 +130,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_web_access = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $enable_web_access = false; + protected $enable_web_access = false; /** * Optional. Whether you want Vertex AI to enable access to the customized * dashboard in training chief container. @@ -144,7 +144,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_dashboard_access = 16 [(.google.api.field_behavior) = OPTIONAL]; */ - private $enable_dashboard_access = false; + protected $enable_dashboard_access = false; /** * Optional. The Experiment associated with this job. * Format: @@ -152,7 +152,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string experiment = 17 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $experiment = ''; + protected $experiment = ''; /** * Optional. The Experiment Run associated with this job. * Format: @@ -160,7 +160,7 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string experiment_run = 18 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $experiment_run = ''; + protected $experiment_run = ''; /** * Optional. The name of the Model resources for which to generate a mapping * to artifact URIs. Applicable only to some of the Google-provided custom @@ -206,9 +206,9 @@ class CustomJobSpec extends \Google\Protobuf\Internal\Message * for the CustomJob's project is used. * @type string $network * Optional. The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the Job + * [network](/compute/docs/networks-and-firewalls#networks) to which the Job * should be peered. For example, `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. @@ -437,9 +437,9 @@ public function setServiceAccount($var) /** * Optional. The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the Job + * [network](/compute/docs/networks-and-firewalls#networks) to which the Job * should be peered. For example, `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. @@ -458,9 +458,9 @@ public function getNetwork() /** * Optional. The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the Job + * [network](/compute/docs/networks-and-firewalls#networks) to which the Job * should be peered. For example, `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. diff --git a/AiPlatform/src/V1/DataItem.php b/AiPlatform/src/V1/DataItem.php index 86e3d6f4d46f..91a3e21374be 100644 --- a/AiPlatform/src/V1/DataItem.php +++ b/AiPlatform/src/V1/DataItem.php @@ -21,19 +21,19 @@ class DataItem extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Timestamp when this DataItem was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this DataItem was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. The labels with user-defined metadata to organize your DataItems. * Label keys and values can be no longer than 64 characters @@ -56,14 +56,14 @@ class DataItem extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value payload = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $payload = null; + protected $payload = null; /** * Optional. Used to perform consistent read-modify-write updates. If not set, * a blind "overwrite" update happens. * * Generated from protobuf field string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DataItemView.php b/AiPlatform/src/V1/DataItemView.php index bd744a29067b..fa12a0e7d8ad 100644 --- a/AiPlatform/src/V1/DataItemView.php +++ b/AiPlatform/src/V1/DataItemView.php @@ -20,7 +20,7 @@ class DataItemView extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DataItem data_item = 1; */ - private $data_item = null; + protected $data_item = null; /** * The Annotations on the DataItem. If too many Annotations should be returned * for the DataItem, this field will be truncated per annotations_limit in @@ -39,7 +39,7 @@ class DataItemView extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool has_truncated_annotations = 3; */ - private $has_truncated_annotations = false; + protected $has_truncated_annotations = false; /** * Constructor. diff --git a/AiPlatform/src/V1/DataLabelingJob.php b/AiPlatform/src/V1/DataLabelingJob.php index a8758ee78a71..c416d3c5caa9 100644 --- a/AiPlatform/src/V1/DataLabelingJob.php +++ b/AiPlatform/src/V1/DataLabelingJob.php @@ -21,7 +21,7 @@ class DataLabelingJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The user-defined name of the DataLabelingJob. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -30,7 +30,7 @@ class DataLabelingJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Required. Dataset resource names. Right now we only support labeling from a * single Dataset. Format: @@ -56,7 +56,7 @@ class DataLabelingJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 labeler_count = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $labeler_count = 0; + protected $labeler_count = 0; /** * Required. The Google Cloud Storage location of the instruction pdf. This * pdf is shared with labelers, and provides detailed description on how to @@ -64,7 +64,7 @@ class DataLabelingJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instruction_uri = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $instruction_uri = ''; + protected $instruction_uri = ''; /** * Required. Points to a YAML file stored on Google Cloud Storage describing * the config for a specific type of DataLabelingJob. The schema files that @@ -74,52 +74,52 @@ class DataLabelingJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string inputs_schema_uri = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $inputs_schema_uri = ''; + protected $inputs_schema_uri = ''; /** * Required. Input config parameters for the DataLabelingJob. * * Generated from protobuf field .google.protobuf.Value inputs = 7 [(.google.api.field_behavior) = REQUIRED]; */ - private $inputs = null; + protected $inputs = null; /** * Output only. The detailed state of the job. * * Generated from protobuf field .google.cloud.aiplatform.v1.JobState state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Current labeling job progress percentage scaled in interval * [0, 100], indicating the percentage of DataItems that has been finished. * * Generated from protobuf field int32 labeling_progress = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $labeling_progress = 0; + protected $labeling_progress = 0; /** * Output only. Estimated cost(in US dollars) that the DataLabelingJob has * incurred to date. * * Generated from protobuf field .google.type.Money current_spend = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $current_spend = null; + protected $current_spend = null; /** * Output only. Timestamp when this DataLabelingJob was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this DataLabelingJob was updated most recently. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. DataLabelingJob errors. It is only populated when job's state * is `JOB_STATE_FAILED` or `JOB_STATE_CANCELLED`. * * Generated from protobuf field .google.rpc.Status error = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * The labels with user-defined metadata to organize your DataLabelingJobs. * Label keys and values can be no longer than 64 characters @@ -149,7 +149,7 @@ class DataLabelingJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 20; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Parameters that configure the active learning pipeline. Active learning * will label the data incrementally via several iterations. For every @@ -157,7 +157,7 @@ class DataLabelingJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ActiveLearningConfig active_learning_config = 21; */ - private $active_learning_config = null; + protected $active_learning_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Dataset.php b/AiPlatform/src/V1/Dataset.php index 9f0d45c6ef89..2167b87a67bd 100644 --- a/AiPlatform/src/V1/Dataset.php +++ b/AiPlatform/src/V1/Dataset.php @@ -20,7 +20,7 @@ class Dataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The user-defined name of the Dataset. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -28,13 +28,13 @@ class Dataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * The description of the Dataset. * * Generated from protobuf field string description = 16; */ - private $description = ''; + protected $description = ''; /** * Required. Points to a YAML file stored on Google Cloud Storage describing * additional information about the Dataset. The schema is defined as an @@ -43,39 +43,39 @@ class Dataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metadata_schema_uri = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $metadata_schema_uri = ''; + protected $metadata_schema_uri = ''; /** * Required. Additional information about the Dataset. * * Generated from protobuf field .google.protobuf.Value metadata = 8 [(.google.api.field_behavior) = REQUIRED]; */ - private $metadata = null; + protected $metadata = null; /** * Output only. The number of DataItems in this Dataset. Only apply for * non-structured Dataset. * * Generated from protobuf field int64 data_item_count = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $data_item_count = 0; + protected $data_item_count = 0; /** * Output only. Timestamp when this Dataset was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Dataset was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Used to perform consistent read-modify-write updates. If not set, a blind * "overwrite" update happens. * * Generated from protobuf field string etag = 6; */ - private $etag = ''; + protected $etag = ''; /** * The labels with user-defined metadata to organize your Datasets. * Label keys and values can be no longer than 64 characters @@ -112,7 +112,7 @@ class Dataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 11; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Output only. The resource name of the Artifact that was created in * MetadataStore when creating the Dataset. The Artifact resource name pattern @@ -121,14 +121,14 @@ class Dataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metadata_artifact = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $metadata_artifact = ''; + protected $metadata_artifact = ''; /** * Optional. Reference to the public base model last used by the dataset. Only * set for prompt datasets. * * Generated from protobuf field string model_reference = 18 [(.google.api.field_behavior) = OPTIONAL]; */ - private $model_reference = ''; + protected $model_reference = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DatasetServiceClient.php b/AiPlatform/src/V1/DatasetServiceClient.php deleted file mode 100644 index b8f0e177540c..000000000000 --- a/AiPlatform/src/V1/DatasetServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/CreateDataset', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets a Dataset. - * @param \Google\Cloud\AIPlatform\V1\GetDatasetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetDataset(\Google\Cloud\AIPlatform\V1\GetDatasetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/GetDataset', - $argument, - ['\Google\Cloud\AIPlatform\V1\Dataset', 'decode'], - $metadata, $options); - } - - /** - * Updates a Dataset. - * @param \Google\Cloud\AIPlatform\V1\UpdateDatasetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateDataset(\Google\Cloud\AIPlatform\V1\UpdateDatasetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/UpdateDataset', - $argument, - ['\Google\Cloud\AIPlatform\V1\Dataset', 'decode'], - $metadata, $options); - } - - /** - * Lists Datasets in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListDatasetsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListDatasets(\Google\Cloud\AIPlatform\V1\ListDatasetsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/ListDatasets', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListDatasetsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a Dataset. - * @param \Google\Cloud\AIPlatform\V1\DeleteDatasetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteDataset(\Google\Cloud\AIPlatform\V1\DeleteDatasetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/DeleteDataset', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Imports data into a Dataset. - * @param \Google\Cloud\AIPlatform\V1\ImportDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ImportData(\Google\Cloud\AIPlatform\V1\ImportDataRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/ImportData', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Exports data from a Dataset. - * @param \Google\Cloud\AIPlatform\V1\ExportDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ExportData(\Google\Cloud\AIPlatform\V1\ExportDataRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/ExportData', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists DataItems in a Dataset. - * @param \Google\Cloud\AIPlatform\V1\ListDataItemsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListDataItems(\Google\Cloud\AIPlatform\V1\ListDataItemsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/ListDataItems', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListDataItemsResponse', 'decode'], - $metadata, $options); - } - - /** - * Searches DataItems in a Dataset. - * @param \Google\Cloud\AIPlatform\V1\SearchDataItemsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SearchDataItems(\Google\Cloud\AIPlatform\V1\SearchDataItemsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/SearchDataItems', - $argument, - ['\Google\Cloud\AIPlatform\V1\SearchDataItemsResponse', 'decode'], - $metadata, $options); - } - - /** - * Lists SavedQueries in a Dataset. - * @param \Google\Cloud\AIPlatform\V1\ListSavedQueriesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListSavedQueries(\Google\Cloud\AIPlatform\V1\ListSavedQueriesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/ListSavedQueries', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListSavedQueriesResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets an AnnotationSpec. - * @param \Google\Cloud\AIPlatform\V1\GetAnnotationSpecRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAnnotationSpec(\Google\Cloud\AIPlatform\V1\GetAnnotationSpecRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/GetAnnotationSpec', - $argument, - ['\Google\Cloud\AIPlatform\V1\AnnotationSpec', 'decode'], - $metadata, $options); - } - - /** - * Lists Annotations belongs to a dataitem - * @param \Google\Cloud\AIPlatform\V1\ListAnnotationsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListAnnotations(\Google\Cloud\AIPlatform\V1\ListAnnotationsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.DatasetService/ListAnnotations', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListAnnotationsResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/DatasetVersion.php b/AiPlatform/src/V1/DatasetVersion.php index 40fd0fb30c0c..ef3f8046726b 100644 --- a/AiPlatform/src/V1/DatasetVersion.php +++ b/AiPlatform/src/V1/DatasetVersion.php @@ -20,32 +20,32 @@ class DatasetVersion extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Timestamp when this DatasetVersion was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this DatasetVersion was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Used to perform consistent read-modify-write updates. If not set, a blind * "overwrite" update happens. * * Generated from protobuf field string etag = 3; */ - private $etag = ''; + protected $etag = ''; /** * Output only. Name of the associated BigQuery dataset. * * Generated from protobuf field string big_query_dataset_name = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $big_query_dataset_name = ''; + protected $big_query_dataset_name = ''; /** * The user-defined name of the DatasetVersion. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -53,20 +53,20 @@ class DatasetVersion extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 7; */ - private $display_name = ''; + protected $display_name = ''; /** * Required. Output only. Additional information about the DatasetVersion. * * Generated from protobuf field .google.protobuf.Value metadata = 8 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = REQUIRED]; */ - private $metadata = null; + protected $metadata = null; /** * Output only. Reference to the public base model last used by the dataset * version. Only set for prompt dataset versions. * * Generated from protobuf field string model_reference = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $model_reference = ''; + protected $model_reference = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DedicatedResources.php b/AiPlatform/src/V1/DedicatedResources.php index 688d97ceac5d..fb3935c5e29e 100644 --- a/AiPlatform/src/V1/DedicatedResources.php +++ b/AiPlatform/src/V1/DedicatedResources.php @@ -22,7 +22,7 @@ class DedicatedResources extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.MachineSpec machine_spec = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; */ - private $machine_spec = null; + protected $machine_spec = null; /** * Required. Immutable. The minimum number of machine replicas this * DeployedModel will be always deployed on. This value must be greater than @@ -33,7 +33,7 @@ class DedicatedResources extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 min_replica_count = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; */ - private $min_replica_count = 0; + protected $min_replica_count = 0; /** * Immutable. The maximum number of replicas this DeployedModel may be * deployed on when the traffic against it increases. If the requested value @@ -51,7 +51,7 @@ class DedicatedResources extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 max_replica_count = 3 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $max_replica_count = 0; + protected $max_replica_count = 0; /** * Immutable. The metric specifications that overrides a resource * utilization metric (CPU utilization, accelerator's duty cycle, and so on) diff --git a/AiPlatform/src/V1/DeleteArtifactRequest.php b/AiPlatform/src/V1/DeleteArtifactRequest.php index d857b6bc21ca..69049a86d5d5 100644 --- a/AiPlatform/src/V1/DeleteArtifactRequest.php +++ b/AiPlatform/src/V1/DeleteArtifactRequest.php @@ -23,7 +23,7 @@ class DeleteArtifactRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. The etag of the Artifact to delete. * If this is provided, it must match the server's etag. Otherwise, the @@ -31,7 +31,7 @@ class DeleteArtifactRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The resource name of the Artifact to delete. diff --git a/AiPlatform/src/V1/DeleteBatchPredictionJobRequest.php b/AiPlatform/src/V1/DeleteBatchPredictionJobRequest.php index 0e175e40b871..93c65b3bac11 100644 --- a/AiPlatform/src/V1/DeleteBatchPredictionJobRequest.php +++ b/AiPlatform/src/V1/DeleteBatchPredictionJobRequest.php @@ -23,7 +23,7 @@ class DeleteBatchPredictionJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the BatchPredictionJob resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteContextRequest.php b/AiPlatform/src/V1/DeleteContextRequest.php index 5d0e4ed05656..8f9511ceaaea 100644 --- a/AiPlatform/src/V1/DeleteContextRequest.php +++ b/AiPlatform/src/V1/DeleteContextRequest.php @@ -23,14 +23,14 @@ class DeleteContextRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * The force deletion semantics is still undefined. * Users should not use this field. * * Generated from protobuf field bool force = 2; */ - private $force = false; + protected $force = false; /** * Optional. The etag of the Context to delete. * If this is provided, it must match the server's etag. Otherwise, the @@ -38,7 +38,7 @@ class DeleteContextRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The resource name of the Context to delete. diff --git a/AiPlatform/src/V1/DeleteCustomJobRequest.php b/AiPlatform/src/V1/DeleteCustomJobRequest.php index 48f65b9a342a..dfed82fefc6c 100644 --- a/AiPlatform/src/V1/DeleteCustomJobRequest.php +++ b/AiPlatform/src/V1/DeleteCustomJobRequest.php @@ -23,7 +23,7 @@ class DeleteCustomJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the CustomJob resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteDataLabelingJobRequest.php b/AiPlatform/src/V1/DeleteDataLabelingJobRequest.php index eff40bb0df88..9dd7c2d0b6de 100644 --- a/AiPlatform/src/V1/DeleteDataLabelingJobRequest.php +++ b/AiPlatform/src/V1/DeleteDataLabelingJobRequest.php @@ -23,7 +23,7 @@ class DeleteDataLabelingJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the DataLabelingJob to be deleted. diff --git a/AiPlatform/src/V1/DeleteDatasetRequest.php b/AiPlatform/src/V1/DeleteDatasetRequest.php index 63310eff6146..7741c711a0ed 100644 --- a/AiPlatform/src/V1/DeleteDatasetRequest.php +++ b/AiPlatform/src/V1/DeleteDatasetRequest.php @@ -23,7 +23,7 @@ class DeleteDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the Dataset to delete. diff --git a/AiPlatform/src/V1/DeleteDatasetVersionRequest.php b/AiPlatform/src/V1/DeleteDatasetVersionRequest.php index 3e5c365e96a9..d4018dd2848e 100644 --- a/AiPlatform/src/V1/DeleteDatasetVersionRequest.php +++ b/AiPlatform/src/V1/DeleteDatasetVersionRequest.php @@ -23,7 +23,7 @@ class DeleteDatasetVersionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the Dataset version to delete. diff --git a/AiPlatform/src/V1/DeleteDeploymentResourcePoolRequest.php b/AiPlatform/src/V1/DeleteDeploymentResourcePoolRequest.php index 9090687d97c9..486d65c04286 100644 --- a/AiPlatform/src/V1/DeleteDeploymentResourcePoolRequest.php +++ b/AiPlatform/src/V1/DeleteDeploymentResourcePoolRequest.php @@ -22,7 +22,7 @@ class DeleteDeploymentResourcePoolRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the DeploymentResourcePool to delete. diff --git a/AiPlatform/src/V1/DeleteEndpointRequest.php b/AiPlatform/src/V1/DeleteEndpointRequest.php index 84b554a9a7f2..598ba0620f61 100644 --- a/AiPlatform/src/V1/DeleteEndpointRequest.php +++ b/AiPlatform/src/V1/DeleteEndpointRequest.php @@ -23,7 +23,7 @@ class DeleteEndpointRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Endpoint resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteEntityTypeRequest.php b/AiPlatform/src/V1/DeleteEntityTypeRequest.php index 8d2916a61b58..092391e1e127 100644 --- a/AiPlatform/src/V1/DeleteEntityTypeRequest.php +++ b/AiPlatform/src/V1/DeleteEntityTypeRequest.php @@ -22,14 +22,14 @@ class DeleteEntityTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * If set to true, any Features for this EntityType will also be deleted. * (Otherwise, the request will only work if the EntityType has no Features.) * * Generated from protobuf field bool force = 2; */ - private $force = false; + protected $force = false; /** * @param string $name Required. The name of the EntityType to be deleted. diff --git a/AiPlatform/src/V1/DeleteExecutionRequest.php b/AiPlatform/src/V1/DeleteExecutionRequest.php index f82ab6f07078..cbd51947ca28 100644 --- a/AiPlatform/src/V1/DeleteExecutionRequest.php +++ b/AiPlatform/src/V1/DeleteExecutionRequest.php @@ -23,7 +23,7 @@ class DeleteExecutionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. The etag of the Execution to delete. * If this is provided, it must match the server's etag. Otherwise, the @@ -31,7 +31,7 @@ class DeleteExecutionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The resource name of the Execution to delete. diff --git a/AiPlatform/src/V1/DeleteFeatureGroupRequest.php b/AiPlatform/src/V1/DeleteFeatureGroupRequest.php index ca5dc0851a28..0cb4f265ddfa 100644 --- a/AiPlatform/src/V1/DeleteFeatureGroupRequest.php +++ b/AiPlatform/src/V1/DeleteFeatureGroupRequest.php @@ -23,7 +23,7 @@ class DeleteFeatureGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * If set to true, any Features under this FeatureGroup * will also be deleted. (Otherwise, the request will only work if the @@ -31,7 +31,7 @@ class DeleteFeatureGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool force = 2; */ - private $force = false; + protected $force = false; /** * @param string $name Required. The name of the FeatureGroup to be deleted. diff --git a/AiPlatform/src/V1/DeleteFeatureOnlineStoreRequest.php b/AiPlatform/src/V1/DeleteFeatureOnlineStoreRequest.php index 34c4f5474622..5fdd65765b87 100644 --- a/AiPlatform/src/V1/DeleteFeatureOnlineStoreRequest.php +++ b/AiPlatform/src/V1/DeleteFeatureOnlineStoreRequest.php @@ -23,7 +23,7 @@ class DeleteFeatureOnlineStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * If set to true, any FeatureViews and Features for this FeatureOnlineStore * will also be deleted. (Otherwise, the request will only work if the @@ -31,7 +31,7 @@ class DeleteFeatureOnlineStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool force = 2; */ - private $force = false; + protected $force = false; /** * @param string $name Required. The name of the FeatureOnlineStore to be deleted. diff --git a/AiPlatform/src/V1/DeleteFeatureRequest.php b/AiPlatform/src/V1/DeleteFeatureRequest.php index 4c0dd9c61b5b..e9e03c983ee1 100644 --- a/AiPlatform/src/V1/DeleteFeatureRequest.php +++ b/AiPlatform/src/V1/DeleteFeatureRequest.php @@ -26,7 +26,7 @@ class DeleteFeatureRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Features to be deleted. diff --git a/AiPlatform/src/V1/DeleteFeatureValuesOperationMetadata.php b/AiPlatform/src/V1/DeleteFeatureValuesOperationMetadata.php index 5ddb4bbccc35..63ba9f807d6c 100644 --- a/AiPlatform/src/V1/DeleteFeatureValuesOperationMetadata.php +++ b/AiPlatform/src/V1/DeleteFeatureValuesOperationMetadata.php @@ -20,7 +20,7 @@ class DeleteFeatureValuesOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DeleteFeatureValuesRequest.php b/AiPlatform/src/V1/DeleteFeatureValuesRequest.php index e27ce15977e5..19b97fb35222 100644 --- a/AiPlatform/src/V1/DeleteFeatureValuesRequest.php +++ b/AiPlatform/src/V1/DeleteFeatureValuesRequest.php @@ -23,7 +23,7 @@ class DeleteFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_type = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $entity_type = ''; + protected $entity_type = ''; protected $DeleteOption; /** diff --git a/AiPlatform/src/V1/DeleteFeatureValuesRequest/SelectEntity.php b/AiPlatform/src/V1/DeleteFeatureValuesRequest/SelectEntity.php index 7803ac465b7f..b218906c71d4 100644 --- a/AiPlatform/src/V1/DeleteFeatureValuesRequest/SelectEntity.php +++ b/AiPlatform/src/V1/DeleteFeatureValuesRequest/SelectEntity.php @@ -23,7 +23,7 @@ class SelectEntity extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EntityIdSelector entity_id_selector = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $entity_id_selector = null; + protected $entity_id_selector = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DeleteFeatureValuesRequest/SelectTimeRangeAndFeature.php b/AiPlatform/src/V1/DeleteFeatureValuesRequest/SelectTimeRangeAndFeature.php index bb55bd270154..cc2a81a50fe1 100644 --- a/AiPlatform/src/V1/DeleteFeatureValuesRequest/SelectTimeRangeAndFeature.php +++ b/AiPlatform/src/V1/DeleteFeatureValuesRequest/SelectTimeRangeAndFeature.php @@ -26,14 +26,14 @@ class SelectTimeRangeAndFeature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.type.Interval time_range = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $time_range = null; + protected $time_range = null; /** * Required. Selectors choosing which feature values to be deleted from the * EntityType. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureSelector feature_selector = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_selector = null; + protected $feature_selector = null; /** * If set, data will not be deleted from online storage. * When time range is older than the data in online storage, setting this to @@ -41,7 +41,7 @@ class SelectTimeRangeAndFeature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool skip_online_storage_delete = 3; */ - private $skip_online_storage_delete = false; + protected $skip_online_storage_delete = false; /** * Constructor. diff --git a/AiPlatform/src/V1/DeleteFeatureValuesResponse/SelectEntity.php b/AiPlatform/src/V1/DeleteFeatureValuesResponse/SelectEntity.php index 92bfa3d129ca..399caacdff1a 100644 --- a/AiPlatform/src/V1/DeleteFeatureValuesResponse/SelectEntity.php +++ b/AiPlatform/src/V1/DeleteFeatureValuesResponse/SelectEntity.php @@ -22,14 +22,14 @@ class SelectEntity extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 offline_storage_deleted_entity_row_count = 1; */ - private $offline_storage_deleted_entity_row_count = 0; + protected $offline_storage_deleted_entity_row_count = 0; /** * The count of deleted entities in the online storage. * Each entity ID corresponds to one entity. * * Generated from protobuf field int64 online_storage_deleted_entity_count = 2; */ - private $online_storage_deleted_entity_count = 0; + protected $online_storage_deleted_entity_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/DeleteFeatureValuesResponse/SelectTimeRangeAndFeature.php b/AiPlatform/src/V1/DeleteFeatureValuesResponse/SelectTimeRangeAndFeature.php index 0dc5452a0345..faa02a70a00c 100644 --- a/AiPlatform/src/V1/DeleteFeatureValuesResponse/SelectTimeRangeAndFeature.php +++ b/AiPlatform/src/V1/DeleteFeatureValuesResponse/SelectTimeRangeAndFeature.php @@ -21,7 +21,7 @@ class SelectTimeRangeAndFeature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 impacted_feature_count = 1; */ - private $impacted_feature_count = 0; + protected $impacted_feature_count = 0; /** * The count of modified entity rows in the offline storage. * Each row corresponds to the combination of an entity ID and a timestamp. @@ -31,7 +31,7 @@ class SelectTimeRangeAndFeature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 offline_storage_modified_entity_row_count = 2; */ - private $offline_storage_modified_entity_row_count = 0; + protected $offline_storage_modified_entity_row_count = 0; /** * The count of modified entities in the online storage. * Each entity ID corresponds to one entity. @@ -40,7 +40,7 @@ class SelectTimeRangeAndFeature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 online_storage_modified_entity_count = 3; */ - private $online_storage_modified_entity_count = 0; + protected $online_storage_modified_entity_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/DeleteFeatureViewRequest.php b/AiPlatform/src/V1/DeleteFeatureViewRequest.php index fc8fdac76994..11a935f82552 100644 --- a/AiPlatform/src/V1/DeleteFeatureViewRequest.php +++ b/AiPlatform/src/V1/DeleteFeatureViewRequest.php @@ -22,7 +22,7 @@ class DeleteFeatureViewRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the FeatureView to be deleted. diff --git a/AiPlatform/src/V1/DeleteFeaturestoreRequest.php b/AiPlatform/src/V1/DeleteFeaturestoreRequest.php index d69834106c16..8a70176fcb87 100644 --- a/AiPlatform/src/V1/DeleteFeaturestoreRequest.php +++ b/AiPlatform/src/V1/DeleteFeaturestoreRequest.php @@ -23,7 +23,7 @@ class DeleteFeaturestoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * If set to true, any EntityTypes and Features for this Featurestore will * also be deleted. (Otherwise, the request will only work if the Featurestore @@ -31,7 +31,7 @@ class DeleteFeaturestoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool force = 2; */ - private $force = false; + protected $force = false; /** * @param string $name Required. The name of the Featurestore to be deleted. diff --git a/AiPlatform/src/V1/DeleteHyperparameterTuningJobRequest.php b/AiPlatform/src/V1/DeleteHyperparameterTuningJobRequest.php index dbd254a1a85f..284f7482f6fb 100644 --- a/AiPlatform/src/V1/DeleteHyperparameterTuningJobRequest.php +++ b/AiPlatform/src/V1/DeleteHyperparameterTuningJobRequest.php @@ -23,7 +23,7 @@ class DeleteHyperparameterTuningJobRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the HyperparameterTuningJob resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteIndexEndpointRequest.php b/AiPlatform/src/V1/DeleteIndexEndpointRequest.php index 94407adef835..fb6aeef6104d 100644 --- a/AiPlatform/src/V1/DeleteIndexEndpointRequest.php +++ b/AiPlatform/src/V1/DeleteIndexEndpointRequest.php @@ -23,7 +23,7 @@ class DeleteIndexEndpointRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the IndexEndpoint resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteIndexRequest.php b/AiPlatform/src/V1/DeleteIndexRequest.php index 230927104fe3..418d40a7f0e9 100644 --- a/AiPlatform/src/V1/DeleteIndexRequest.php +++ b/AiPlatform/src/V1/DeleteIndexRequest.php @@ -23,7 +23,7 @@ class DeleteIndexRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Index resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteMetadataStoreOperationMetadata.php b/AiPlatform/src/V1/DeleteMetadataStoreOperationMetadata.php index 38acca76eee8..c8b6e4005039 100644 --- a/AiPlatform/src/V1/DeleteMetadataStoreOperationMetadata.php +++ b/AiPlatform/src/V1/DeleteMetadataStoreOperationMetadata.php @@ -21,7 +21,7 @@ class DeleteMetadataStoreOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DeleteMetadataStoreRequest.php b/AiPlatform/src/V1/DeleteMetadataStoreRequest.php index 2b2918ac9371..1ff107a40ef7 100644 --- a/AiPlatform/src/V1/DeleteMetadataStoreRequest.php +++ b/AiPlatform/src/V1/DeleteMetadataStoreRequest.php @@ -23,7 +23,7 @@ class DeleteMetadataStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Deprecated: Field is no longer supported. * diff --git a/AiPlatform/src/V1/DeleteModelDeploymentMonitoringJobRequest.php b/AiPlatform/src/V1/DeleteModelDeploymentMonitoringJobRequest.php index 9e52b0710897..3497dadbb97e 100644 --- a/AiPlatform/src/V1/DeleteModelDeploymentMonitoringJobRequest.php +++ b/AiPlatform/src/V1/DeleteModelDeploymentMonitoringJobRequest.php @@ -23,7 +23,7 @@ class DeleteModelDeploymentMonitoringJobRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the model monitoring job to delete. diff --git a/AiPlatform/src/V1/DeleteModelRequest.php b/AiPlatform/src/V1/DeleteModelRequest.php index f7092269cd3d..1faeb4d0ff54 100644 --- a/AiPlatform/src/V1/DeleteModelRequest.php +++ b/AiPlatform/src/V1/DeleteModelRequest.php @@ -22,7 +22,7 @@ class DeleteModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Model resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteModelVersionRequest.php b/AiPlatform/src/V1/DeleteModelVersionRequest.php index e14050649e00..594e38fefb09 100644 --- a/AiPlatform/src/V1/DeleteModelVersionRequest.php +++ b/AiPlatform/src/V1/DeleteModelVersionRequest.php @@ -23,7 +23,7 @@ class DeleteModelVersionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the model version to be deleted, with a version ID diff --git a/AiPlatform/src/V1/DeleteNasJobRequest.php b/AiPlatform/src/V1/DeleteNasJobRequest.php index d5a8900afe0f..3fc52e5916c0 100644 --- a/AiPlatform/src/V1/DeleteNasJobRequest.php +++ b/AiPlatform/src/V1/DeleteNasJobRequest.php @@ -23,7 +23,7 @@ class DeleteNasJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NasJob resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteNotebookRuntimeRequest.php b/AiPlatform/src/V1/DeleteNotebookRuntimeRequest.php index a0c67218a3d0..82e4d93ff2a7 100644 --- a/AiPlatform/src/V1/DeleteNotebookRuntimeRequest.php +++ b/AiPlatform/src/V1/DeleteNotebookRuntimeRequest.php @@ -24,7 +24,7 @@ class DeleteNotebookRuntimeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NotebookRuntime resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteNotebookRuntimeTemplateRequest.php b/AiPlatform/src/V1/DeleteNotebookRuntimeTemplateRequest.php index 27c1e29a1fe3..72f20a0d917d 100644 --- a/AiPlatform/src/V1/DeleteNotebookRuntimeTemplateRequest.php +++ b/AiPlatform/src/V1/DeleteNotebookRuntimeTemplateRequest.php @@ -23,7 +23,7 @@ class DeleteNotebookRuntimeTemplateRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NotebookRuntimeTemplate resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteOperationMetadata.php b/AiPlatform/src/V1/DeleteOperationMetadata.php index 9e860917c5d7..550d06373645 100644 --- a/AiPlatform/src/V1/DeleteOperationMetadata.php +++ b/AiPlatform/src/V1/DeleteOperationMetadata.php @@ -20,7 +20,7 @@ class DeleteOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DeletePersistentResourceRequest.php b/AiPlatform/src/V1/DeletePersistentResourceRequest.php index 07814ad2f199..0ff38cba1d08 100644 --- a/AiPlatform/src/V1/DeletePersistentResourceRequest.php +++ b/AiPlatform/src/V1/DeletePersistentResourceRequest.php @@ -23,7 +23,7 @@ class DeletePersistentResourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the PersistentResource to be deleted. diff --git a/AiPlatform/src/V1/DeletePipelineJobRequest.php b/AiPlatform/src/V1/DeletePipelineJobRequest.php index 0d2aa8653a21..b20e5935e894 100644 --- a/AiPlatform/src/V1/DeletePipelineJobRequest.php +++ b/AiPlatform/src/V1/DeletePipelineJobRequest.php @@ -23,7 +23,7 @@ class DeletePipelineJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the PipelineJob resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteSavedQueryRequest.php b/AiPlatform/src/V1/DeleteSavedQueryRequest.php index fcf11f962a97..c11454383354 100644 --- a/AiPlatform/src/V1/DeleteSavedQueryRequest.php +++ b/AiPlatform/src/V1/DeleteSavedQueryRequest.php @@ -23,7 +23,7 @@ class DeleteSavedQueryRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the SavedQuery to delete. diff --git a/AiPlatform/src/V1/DeleteScheduleRequest.php b/AiPlatform/src/V1/DeleteScheduleRequest.php index c527b2d1dfc8..ea69f30d7497 100644 --- a/AiPlatform/src/V1/DeleteScheduleRequest.php +++ b/AiPlatform/src/V1/DeleteScheduleRequest.php @@ -23,7 +23,7 @@ class DeleteScheduleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Schedule resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteSpecialistPoolRequest.php b/AiPlatform/src/V1/DeleteSpecialistPoolRequest.php index 03d4d29cb2b4..4f480e345c69 100644 --- a/AiPlatform/src/V1/DeleteSpecialistPoolRequest.php +++ b/AiPlatform/src/V1/DeleteSpecialistPoolRequest.php @@ -22,7 +22,7 @@ class DeleteSpecialistPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * If set to true, any specialist managers in this SpecialistPool will also be * deleted. (Otherwise, the request will only work if the SpecialistPool has @@ -30,7 +30,7 @@ class DeleteSpecialistPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool force = 2; */ - private $force = false; + protected $force = false; /** * @param string $name Required. The resource name of the SpecialistPool to delete. Format: diff --git a/AiPlatform/src/V1/DeleteStudyRequest.php b/AiPlatform/src/V1/DeleteStudyRequest.php index 7a1c8d45729d..64b41f042682 100644 --- a/AiPlatform/src/V1/DeleteStudyRequest.php +++ b/AiPlatform/src/V1/DeleteStudyRequest.php @@ -22,7 +22,7 @@ class DeleteStudyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Study resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteTensorboardExperimentRequest.php b/AiPlatform/src/V1/DeleteTensorboardExperimentRequest.php index 74d93933146e..f35a73540e67 100644 --- a/AiPlatform/src/V1/DeleteTensorboardExperimentRequest.php +++ b/AiPlatform/src/V1/DeleteTensorboardExperimentRequest.php @@ -23,7 +23,7 @@ class DeleteTensorboardExperimentRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TensorboardExperiment to be deleted. diff --git a/AiPlatform/src/V1/DeleteTensorboardRequest.php b/AiPlatform/src/V1/DeleteTensorboardRequest.php index 929acfb4813f..a7230c9e783a 100644 --- a/AiPlatform/src/V1/DeleteTensorboardRequest.php +++ b/AiPlatform/src/V1/DeleteTensorboardRequest.php @@ -23,7 +23,7 @@ class DeleteTensorboardRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Tensorboard to be deleted. diff --git a/AiPlatform/src/V1/DeleteTensorboardRunRequest.php b/AiPlatform/src/V1/DeleteTensorboardRunRequest.php index e1a6162b3673..f63d3f04fde3 100644 --- a/AiPlatform/src/V1/DeleteTensorboardRunRequest.php +++ b/AiPlatform/src/V1/DeleteTensorboardRunRequest.php @@ -23,7 +23,7 @@ class DeleteTensorboardRunRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TensorboardRun to be deleted. diff --git a/AiPlatform/src/V1/DeleteTensorboardTimeSeriesRequest.php b/AiPlatform/src/V1/DeleteTensorboardTimeSeriesRequest.php index 1e87b470b1fe..489585d7153b 100644 --- a/AiPlatform/src/V1/DeleteTensorboardTimeSeriesRequest.php +++ b/AiPlatform/src/V1/DeleteTensorboardTimeSeriesRequest.php @@ -23,7 +23,7 @@ class DeleteTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TensorboardTimeSeries to be deleted. diff --git a/AiPlatform/src/V1/DeleteTrainingPipelineRequest.php b/AiPlatform/src/V1/DeleteTrainingPipelineRequest.php index 325eb62c8069..544aa735599d 100644 --- a/AiPlatform/src/V1/DeleteTrainingPipelineRequest.php +++ b/AiPlatform/src/V1/DeleteTrainingPipelineRequest.php @@ -23,7 +23,7 @@ class DeleteTrainingPipelineRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TrainingPipeline resource to be deleted. diff --git a/AiPlatform/src/V1/DeleteTrialRequest.php b/AiPlatform/src/V1/DeleteTrialRequest.php index ead0e8325dce..a392aa91f814 100644 --- a/AiPlatform/src/V1/DeleteTrialRequest.php +++ b/AiPlatform/src/V1/DeleteTrialRequest.php @@ -23,7 +23,7 @@ class DeleteTrialRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The Trial's name. diff --git a/AiPlatform/src/V1/DeployIndexOperationMetadata.php b/AiPlatform/src/V1/DeployIndexOperationMetadata.php index ba34ad66e859..359d23294621 100644 --- a/AiPlatform/src/V1/DeployIndexOperationMetadata.php +++ b/AiPlatform/src/V1/DeployIndexOperationMetadata.php @@ -21,13 +21,13 @@ class DeployIndexOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * The unique index id specified by user * * Generated from protobuf field string deployed_index_id = 2; */ - private $deployed_index_id = ''; + protected $deployed_index_id = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DeployIndexRequest.php b/AiPlatform/src/V1/DeployIndexRequest.php index f4bc5c752263..d47467ec9876 100644 --- a/AiPlatform/src/V1/DeployIndexRequest.php +++ b/AiPlatform/src/V1/DeployIndexRequest.php @@ -23,13 +23,13 @@ class DeployIndexRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string index_endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $index_endpoint = ''; + protected $index_endpoint = ''; /** * Required. The DeployedIndex to be created within the IndexEndpoint. * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedIndex deployed_index = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployed_index = null; + protected $deployed_index = null; /** * @param string $indexEndpoint Required. The name of the IndexEndpoint resource into which to deploy an diff --git a/AiPlatform/src/V1/DeployIndexResponse.php b/AiPlatform/src/V1/DeployIndexResponse.php index f2daf055334c..fc3b10e89fb9 100644 --- a/AiPlatform/src/V1/DeployIndexResponse.php +++ b/AiPlatform/src/V1/DeployIndexResponse.php @@ -21,7 +21,7 @@ class DeployIndexResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedIndex deployed_index = 1; */ - private $deployed_index = null; + protected $deployed_index = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DeployModelOperationMetadata.php b/AiPlatform/src/V1/DeployModelOperationMetadata.php index 26b8fa2d3fe7..96c212eb21e1 100644 --- a/AiPlatform/src/V1/DeployModelOperationMetadata.php +++ b/AiPlatform/src/V1/DeployModelOperationMetadata.php @@ -21,7 +21,7 @@ class DeployModelOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DeployModelRequest.php b/AiPlatform/src/V1/DeployModelRequest.php index e4b3ecbc9ab0..e044c3fef64d 100644 --- a/AiPlatform/src/V1/DeployModelRequest.php +++ b/AiPlatform/src/V1/DeployModelRequest.php @@ -23,7 +23,7 @@ class DeployModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Required. The DeployedModel to be created within the Endpoint. Note that * [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] @@ -33,7 +33,7 @@ class DeployModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedModel deployed_model = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployed_model = null; + protected $deployed_model = null; /** * A map from a DeployedModel's ID to the percentage of this Endpoint's * traffic that should be forwarded to that DeployedModel. diff --git a/AiPlatform/src/V1/DeployModelResponse.php b/AiPlatform/src/V1/DeployModelResponse.php index 1080f654257d..affc801ec33e 100644 --- a/AiPlatform/src/V1/DeployModelResponse.php +++ b/AiPlatform/src/V1/DeployModelResponse.php @@ -21,7 +21,7 @@ class DeployModelResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedModel deployed_model = 1; */ - private $deployed_model = null; + protected $deployed_model = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DeployedIndex.php b/AiPlatform/src/V1/DeployedIndex.php index bf99aebf90a4..ea468ed0facc 100644 --- a/AiPlatform/src/V1/DeployedIndex.php +++ b/AiPlatform/src/V1/DeployedIndex.php @@ -23,27 +23,27 @@ class DeployedIndex extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $id = ''; + protected $id = ''; /** * Required. The name of the Index this is the deployment of. * We may refer to this Index as the DeployedIndex's "original" Index. * * Generated from protobuf field string index = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $index = ''; + protected $index = ''; /** * The display name of the DeployedIndex. If not provided upon creation, * the Index's display_name is used. * * Generated from protobuf field string display_name = 3; */ - private $display_name = ''; + protected $display_name = ''; /** * Output only. Timestamp when the DeployedIndex was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Provides paths for users to send requests directly to the * deployed index services running on Cloud via private services access. This @@ -52,7 +52,7 @@ class DeployedIndex extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.IndexPrivateEndpoints private_endpoints = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $private_endpoints = null; + protected $private_endpoints = null; /** * Output only. The DeployedIndex may depend on various data on its original * Index. Additionally when certain changes to the original Index are being @@ -71,7 +71,7 @@ class DeployedIndex extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp index_sync_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $index_sync_time = null; + protected $index_sync_time = null; /** * Optional. A description of resources that the DeployedIndex uses, which to * large degree are decided by Vertex AI, and optionally allows only a modest @@ -83,7 +83,7 @@ class DeployedIndex extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.AutomaticResources automatic_resources = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $automatic_resources = null; + protected $automatic_resources = null; /** * Optional. A description of resources that are dedicated to the * DeployedIndex, and that need a higher degree of manual configuration. The @@ -102,7 +102,7 @@ class DeployedIndex extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DedicatedResources dedicated_resources = 16 [(.google.api.field_behavior) = OPTIONAL]; */ - private $dedicated_resources = null; + protected $dedicated_resources = null; /** * Optional. If true, private endpoint's access logs are sent to Cloud * Logging. @@ -114,13 +114,13 @@ class DeployedIndex extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_access_logging = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $enable_access_logging = false; + protected $enable_access_logging = false; /** * Optional. If set, the authentication is enabled for the private endpoint. * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedIndexAuthConfig deployed_index_auth_config = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $deployed_index_auth_config = null; + protected $deployed_index_auth_config = null; /** * Optional. A list of reserved ip ranges under the VPC network that can be * used for this DeployedIndex. @@ -150,7 +150,7 @@ class DeployedIndex extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string deployment_group = 11 [(.google.api.field_behavior) = OPTIONAL]; */ - private $deployment_group = ''; + protected $deployment_group = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DeployedIndexAuthConfig.php b/AiPlatform/src/V1/DeployedIndexAuthConfig.php index 13adc2527f8c..fb9017e62156 100644 --- a/AiPlatform/src/V1/DeployedIndexAuthConfig.php +++ b/AiPlatform/src/V1/DeployedIndexAuthConfig.php @@ -20,7 +20,7 @@ class DeployedIndexAuthConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedIndexAuthConfig.AuthProvider auth_provider = 1; */ - private $auth_provider = null; + protected $auth_provider = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DeployedIndexRef.php b/AiPlatform/src/V1/DeployedIndexRef.php index 34125e3e6e9c..a27c56b931f1 100644 --- a/AiPlatform/src/V1/DeployedIndexRef.php +++ b/AiPlatform/src/V1/DeployedIndexRef.php @@ -20,19 +20,19 @@ class DeployedIndexRef extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string index_endpoint = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { */ - private $index_endpoint = ''; + protected $index_endpoint = ''; /** * Immutable. The ID of the DeployedIndex in the above IndexEndpoint. * * Generated from protobuf field string deployed_index_id = 2 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $deployed_index_id = ''; + protected $deployed_index_id = ''; /** * Output only. The display name of the DeployedIndex. * * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $display_name = ''; + protected $display_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DeployedModel.php b/AiPlatform/src/V1/DeployedModel.php index 69f82c77f246..13ddf1690b1d 100644 --- a/AiPlatform/src/V1/DeployedModel.php +++ b/AiPlatform/src/V1/DeployedModel.php @@ -22,7 +22,7 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $id = ''; + protected $id = ''; /** * Required. The resource name of the Model that this is the deployment of. * Note that the Model may be in a different location than the DeployedModel's @@ -36,26 +36,26 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * Output only. The version ID of the model that is deployed. * * Generated from protobuf field string model_version_id = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $model_version_id = ''; + protected $model_version_id = ''; /** * The display name of the DeployedModel. If not provided upon creation, * the Model's display_name is used. * * Generated from protobuf field string display_name = 3; */ - private $display_name = ''; + protected $display_name = ''; /** * Output only. Timestamp when the DeployedModel was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Explanation configuration for this DeployedModel. * When deploying a Model using @@ -76,7 +76,7 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationSpec explanation_spec = 9; */ - private $explanation_spec = null; + protected $explanation_spec = null; /** * If true, deploy the model without explainable feature, regardless the * existence of @@ -86,7 +86,7 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disable_explanations = 19; */ - private $disable_explanations = false; + protected $disable_explanations = false; /** * The service account that the DeployedModel's container runs as. Specify the * email address of the service account. If this service account is not @@ -97,7 +97,7 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 11; */ - private $service_account = ''; + protected $service_account = ''; /** * For custom-trained Models and AutoML Tabular Models, the container of the * DeployedModel instances will send `stderr` and `stdout` streams to @@ -108,7 +108,7 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disable_container_logging = 15; */ - private $disable_container_logging = false; + protected $disable_container_logging = false; /** * If true, online prediction access logs are sent to Cloud * Logging. @@ -120,7 +120,7 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_access_logging = 13; */ - private $enable_access_logging = false; + protected $enable_access_logging = false; /** * Output only. Provide paths for users to send predict/explain/health * requests directly to the deployed model services running on Cloud via @@ -129,7 +129,7 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PrivateEndpoints private_endpoints = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $private_endpoints = null; + protected $private_endpoints = null; protected $prediction_resources; /** diff --git a/AiPlatform/src/V1/DeployedModelRef.php b/AiPlatform/src/V1/DeployedModelRef.php index 66a57224b63c..1f270de80921 100644 --- a/AiPlatform/src/V1/DeployedModelRef.php +++ b/AiPlatform/src/V1/DeployedModelRef.php @@ -20,13 +20,13 @@ class DeployedModelRef extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Immutable. An ID of a DeployedModel in the above Endpoint. * * Generated from protobuf field string deployed_model_id = 2 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $deployed_model_id = ''; + protected $deployed_model_id = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DeploymentResourcePool.php b/AiPlatform/src/V1/DeploymentResourcePool.php index 5f9f3994863a..5eda0269b80f 100644 --- a/AiPlatform/src/V1/DeploymentResourcePool.php +++ b/AiPlatform/src/V1/DeploymentResourcePool.php @@ -23,14 +23,14 @@ class DeploymentResourcePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $name = ''; + protected $name = ''; /** * Required. The underlying DedicatedResources that the DeploymentResourcePool * uses. * * Generated from protobuf field .google.cloud.aiplatform.v1.DedicatedResources dedicated_resources = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $dedicated_resources = null; + protected $dedicated_resources = null; /** * Customer-managed encryption key spec for a DeploymentResourcePool. If set, * this DeploymentResourcePool will be secured by this key. Endpoints and the @@ -38,7 +38,7 @@ class DeploymentResourcePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 5; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * The service account that the DeploymentResourcePool's container(s) run as. * Specify the email address of the service account. If this service account @@ -49,7 +49,7 @@ class DeploymentResourcePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 6; */ - private $service_account = ''; + protected $service_account = ''; /** * If the DeploymentResourcePool is deployed with custom-trained Models or * AutoML Tabular Models, the container(s) of the DeploymentResourcePool will @@ -60,13 +60,13 @@ class DeploymentResourcePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disable_container_logging = 7; */ - private $disable_container_logging = false; + protected $disable_container_logging = false; /** * Output only. Timestamp when this DeploymentResourcePool was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DeploymentResourcePoolServiceClient.php b/AiPlatform/src/V1/DeploymentResourcePoolServiceClient.php deleted file mode 100644 index ff5614e88ff9..000000000000 --- a/AiPlatform/src/V1/DeploymentResourcePoolServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -string feature_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_id = ''; + protected $feature_id = ''; /** * Specify the field name in the export destination. If not specified, * Feature ID is used. * * Generated from protobuf field string destination_field = 2; */ - private $destination_field = ''; + protected $destination_field = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DirectPredictRequest.php b/AiPlatform/src/V1/DirectPredictRequest.php index 6bde21b5e0d7..7bbbeb3d74e1 100644 --- a/AiPlatform/src/V1/DirectPredictRequest.php +++ b/AiPlatform/src/V1/DirectPredictRequest.php @@ -23,7 +23,7 @@ class DirectPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * The prediction input. * @@ -35,7 +35,7 @@ class DirectPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Tensor parameters = 3; */ - private $parameters = null; + protected $parameters = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DirectPredictResponse.php b/AiPlatform/src/V1/DirectPredictResponse.php index 35a747ce3736..fc07726eb0db 100644 --- a/AiPlatform/src/V1/DirectPredictResponse.php +++ b/AiPlatform/src/V1/DirectPredictResponse.php @@ -27,7 +27,7 @@ class DirectPredictResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Tensor parameters = 2; */ - private $parameters = null; + protected $parameters = null; /** * Constructor. diff --git a/AiPlatform/src/V1/DirectRawPredictRequest.php b/AiPlatform/src/V1/DirectRawPredictRequest.php index d4737fd0641a..742455145cb6 100644 --- a/AiPlatform/src/V1/DirectRawPredictRequest.php +++ b/AiPlatform/src/V1/DirectRawPredictRequest.php @@ -23,7 +23,7 @@ class DirectRawPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Fully qualified name of the API method being invoked to perform * predictions. @@ -34,13 +34,13 @@ class DirectRawPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string method_name = 2; */ - private $method_name = ''; + protected $method_name = ''; /** * The prediction input. * * Generated from protobuf field bytes input = 3; */ - private $input = ''; + protected $input = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DirectRawPredictResponse.php b/AiPlatform/src/V1/DirectRawPredictResponse.php index 4c32343e0a84..7c10eea0fc0f 100644 --- a/AiPlatform/src/V1/DirectRawPredictResponse.php +++ b/AiPlatform/src/V1/DirectRawPredictResponse.php @@ -21,7 +21,7 @@ class DirectRawPredictResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes output = 1; */ - private $output = ''; + protected $output = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/DiskSpec.php b/AiPlatform/src/V1/DiskSpec.php index 344bd8321c66..8d4b509db5ee 100644 --- a/AiPlatform/src/V1/DiskSpec.php +++ b/AiPlatform/src/V1/DiskSpec.php @@ -22,13 +22,13 @@ class DiskSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string boot_disk_type = 1; */ - private $boot_disk_type = ''; + protected $boot_disk_type = ''; /** * Size in GB of the boot disk (default is 100GB). * * Generated from protobuf field int32 boot_disk_size_gb = 2; */ - private $boot_disk_size_gb = 0; + protected $boot_disk_size_gb = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/EncryptionSpec.php b/AiPlatform/src/V1/EncryptionSpec.php index f1f011da3b0a..61554ec16fe9 100644 --- a/AiPlatform/src/V1/EncryptionSpec.php +++ b/AiPlatform/src/V1/EncryptionSpec.php @@ -25,7 +25,7 @@ class EncryptionSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string kms_key_name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $kms_key_name = ''; + protected $kms_key_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/Endpoint.php b/AiPlatform/src/V1/Endpoint.php index 70cd2309a29f..a56e116cba33 100644 --- a/AiPlatform/src/V1/Endpoint.php +++ b/AiPlatform/src/V1/Endpoint.php @@ -21,7 +21,7 @@ class Endpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The display name of the Endpoint. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -29,13 +29,13 @@ class Endpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * The description of the Endpoint. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Output only. The models deployed in this Endpoint. * To add or remove DeployedModels use @@ -64,7 +64,7 @@ class Endpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 6; */ - private $etag = ''; + protected $etag = ''; /** * The labels with user-defined metadata to organize your Endpoints. * Label keys and values can be no longer than 64 characters @@ -80,13 +80,13 @@ class Endpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Endpoint was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Customer-managed encryption key spec for an Endpoint. If set, this * Endpoint and all sub-resources of this Endpoint will be secured by @@ -94,7 +94,7 @@ class Endpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 10; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Optional. The full name of the Google Compute Engine * [network](https://cloud.google.com//compute/docs/networks-and-firewalls#networks) @@ -112,7 +112,7 @@ class Endpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $network = ''; + protected $network = ''; /** * Deprecated: If true, expose the Endpoint via private service connect. * Only one of the fields, @@ -132,7 +132,7 @@ class Endpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PrivateServiceConnectConfig private_service_connect_config = 21 [(.google.api.field_behavior) = OPTIONAL]; */ - private $private_service_connect_config = null; + protected $private_service_connect_config = null; /** * Output only. Resource name of the Model Monitoring job associated with this * Endpoint if monitoring is enabled by @@ -142,13 +142,13 @@ class Endpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model_deployment_monitoring_job = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $model_deployment_monitoring_job = ''; + protected $model_deployment_monitoring_job = ''; /** * Configures the request-response logging for online prediction. * * Generated from protobuf field .google.cloud.aiplatform.v1.PredictRequestResponseLoggingConfig predict_request_response_logging_config = 18; */ - private $predict_request_response_logging_config = null; + protected $predict_request_response_logging_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/EndpointServiceClient.php b/AiPlatform/src/V1/EndpointServiceClient.php deleted file mode 100644 index 3b6cad40ef2f..000000000000 --- a/AiPlatform/src/V1/EndpointServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.EndpointService/CreateEndpoint', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets an Endpoint. - * @param \Google\Cloud\AIPlatform\V1\GetEndpointRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetEndpoint(\Google\Cloud\AIPlatform\V1\GetEndpointRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.EndpointService/GetEndpoint', - $argument, - ['\Google\Cloud\AIPlatform\V1\Endpoint', 'decode'], - $metadata, $options); - } - - /** - * Lists Endpoints in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListEndpointsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListEndpoints(\Google\Cloud\AIPlatform\V1\ListEndpointsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.EndpointService/ListEndpoints', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListEndpointsResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates an Endpoint. - * @param \Google\Cloud\AIPlatform\V1\UpdateEndpointRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateEndpoint(\Google\Cloud\AIPlatform\V1\UpdateEndpointRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.EndpointService/UpdateEndpoint', - $argument, - ['\Google\Cloud\AIPlatform\V1\Endpoint', 'decode'], - $metadata, $options); - } - - /** - * Deletes an Endpoint. - * @param \Google\Cloud\AIPlatform\V1\DeleteEndpointRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteEndpoint(\Google\Cloud\AIPlatform\V1\DeleteEndpointRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.EndpointService/DeleteEndpoint', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deploys a Model into this Endpoint, creating a DeployedModel within it. - * @param \Google\Cloud\AIPlatform\V1\DeployModelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeployModel(\Google\Cloud\AIPlatform\V1\DeployModelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.EndpointService/DeployModel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Undeploys a Model from an Endpoint, removing a DeployedModel from it, and - * freeing all resources it's using. - * @param \Google\Cloud\AIPlatform\V1\UndeployModelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UndeployModel(\Google\Cloud\AIPlatform\V1\UndeployModelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.EndpointService/UndeployModel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates an existing deployed model. Updatable fields include - * `min_replica_count`, `max_replica_count`, `autoscaling_metric_specs`, - * `disable_container_logging` (v1 only), and `enable_container_logging` - * (v1beta1 only). - * @param \Google\Cloud\AIPlatform\V1\MutateDeployedModelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function MutateDeployedModel(\Google\Cloud\AIPlatform\V1\MutateDeployedModelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.EndpointService/MutateDeployedModel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/EntityIdSelector.php b/AiPlatform/src/V1/EntityIdSelector.php index 2556a98cec80..46e3c929417c 100644 --- a/AiPlatform/src/V1/EntityIdSelector.php +++ b/AiPlatform/src/V1/EntityIdSelector.php @@ -21,7 +21,7 @@ class EntityIdSelector extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_id_field = 5; */ - private $entity_id_field = ''; + protected $entity_id_field = ''; protected $EntityIdsSource; /** diff --git a/AiPlatform/src/V1/EntityType.php b/AiPlatform/src/V1/EntityType.php index af5f1786c456..128f28a9b487 100644 --- a/AiPlatform/src/V1/EntityType.php +++ b/AiPlatform/src/V1/EntityType.php @@ -28,25 +28,25 @@ class EntityType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $name = ''; + protected $name = ''; /** * Optional. Description of the EntityType. * * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Output only. Timestamp when this EntityType was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this EntityType was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. The labels with user-defined metadata to organize your * EntityTypes. @@ -68,7 +68,7 @@ class EntityType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * Optional. The default monitoring configuration for all Features with value * type @@ -81,7 +81,7 @@ class EntityType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig monitoring_config = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $monitoring_config = null; + protected $monitoring_config = null; /** * Optional. Config for data retention policy in offline storage. * TTL in days for feature values that will be stored in offline storage. @@ -91,7 +91,7 @@ class EntityType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 offline_storage_ttl_days = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $offline_storage_ttl_days = 0; + protected $offline_storage_ttl_days = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/EnvVar.php b/AiPlatform/src/V1/EnvVar.php index b07361667fa8..a189248f6cfc 100644 --- a/AiPlatform/src/V1/EnvVar.php +++ b/AiPlatform/src/V1/EnvVar.php @@ -20,7 +20,7 @@ class EnvVar extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; /** * Required. Variables that reference a $(VAR_NAME) are expanded * using the previous defined environment variables in the container and @@ -32,7 +32,7 @@ class EnvVar extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $value = ''; + protected $value = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ErrorAnalysisAnnotation.php b/AiPlatform/src/V1/ErrorAnalysisAnnotation.php index 2f28522fb84b..e063ef9eb60a 100644 --- a/AiPlatform/src/V1/ErrorAnalysisAnnotation.php +++ b/AiPlatform/src/V1/ErrorAnalysisAnnotation.php @@ -27,20 +27,20 @@ class ErrorAnalysisAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ErrorAnalysisAnnotation.QueryType query_type = 2; */ - private $query_type = 0; + protected $query_type = 0; /** * The outlier score of this annotated item. Usually defined as the min of all * distances from attributed items. * * Generated from protobuf field double outlier_score = 3; */ - private $outlier_score = 0.0; + protected $outlier_score = 0.0; /** * The threshold used to determine if this annotation is an outlier or not. * * Generated from protobuf field double outlier_threshold = 4; */ - private $outlier_threshold = 0.0; + protected $outlier_threshold = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/ErrorAnalysisAnnotation/AttributedItem.php b/AiPlatform/src/V1/ErrorAnalysisAnnotation/AttributedItem.php index 7fc6ce7bd84f..fe1824a00b2e 100644 --- a/AiPlatform/src/V1/ErrorAnalysisAnnotation/AttributedItem.php +++ b/AiPlatform/src/V1/ErrorAnalysisAnnotation/AttributedItem.php @@ -22,13 +22,13 @@ class AttributedItem extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_resource_name = 1; */ - private $annotation_resource_name = ''; + protected $annotation_resource_name = ''; /** * The distance of this item to the annotation. * * Generated from protobuf field double distance = 2; */ - private $distance = 0.0; + protected $distance = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/EvaluatedAnnotation.php b/AiPlatform/src/V1/EvaluatedAnnotation.php index d39208896f28..ecc61359bd46 100644 --- a/AiPlatform/src/V1/EvaluatedAnnotation.php +++ b/AiPlatform/src/V1/EvaluatedAnnotation.php @@ -22,7 +22,7 @@ class EvaluatedAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EvaluatedAnnotation.EvaluatedAnnotationType type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $type = 0; + protected $type = 0; /** * Output only. The model predicted annotations. * For true positive, there is one and only one prediction, which matches the @@ -65,7 +65,7 @@ class EvaluatedAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value data_item_payload = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $data_item_payload = null; + protected $data_item_payload = null; /** * Output only. ID of the EvaluatedDataItemView under the same ancestor * ModelEvaluation. The EvaluatedDataItemView consists of all ground truths @@ -74,7 +74,7 @@ class EvaluatedAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string evaluated_data_item_view_id = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $evaluated_data_item_view_id = ''; + protected $evaluated_data_item_view_id = ''; /** * Explanations of * [predictions][google.cloud.aiplatform.v1.EvaluatedAnnotation.predictions]. diff --git a/AiPlatform/src/V1/EvaluatedAnnotationExplanation.php b/AiPlatform/src/V1/EvaluatedAnnotationExplanation.php index 08c2793d276f..4752df122154 100644 --- a/AiPlatform/src/V1/EvaluatedAnnotationExplanation.php +++ b/AiPlatform/src/V1/EvaluatedAnnotationExplanation.php @@ -23,13 +23,13 @@ class EvaluatedAnnotationExplanation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string explanation_type = 1; */ - private $explanation_type = ''; + protected $explanation_type = ''; /** * Explanation attribution response details. * * Generated from protobuf field .google.cloud.aiplatform.v1.Explanation explanation = 2; */ - private $explanation = null; + protected $explanation = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Event.php b/AiPlatform/src/V1/Event.php index 386b1a8d9670..665c415849ca 100644 --- a/AiPlatform/src/V1/Event.php +++ b/AiPlatform/src/V1/Event.php @@ -21,25 +21,25 @@ class Event extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string artifact = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $artifact = ''; + protected $artifact = ''; /** * Output only. The relative resource name of the Execution in the Event. * * Generated from protobuf field string execution = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $execution = ''; + protected $execution = ''; /** * Output only. Time the Event occurred. * * Generated from protobuf field .google.protobuf.Timestamp event_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $event_time = null; + protected $event_time = null; /** * Required. The type of the Event. * * Generated from protobuf field .google.cloud.aiplatform.v1.Event.Type type = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $type = 0; + protected $type = 0; /** * The labels with user-defined metadata to annotate Events. * Label keys and values can be no longer than 64 characters diff --git a/AiPlatform/src/V1/Examples.php b/AiPlatform/src/V1/Examples.php index 3874ab498a9b..107491c628eb 100644 --- a/AiPlatform/src/V1/Examples.php +++ b/AiPlatform/src/V1/Examples.php @@ -21,7 +21,7 @@ class Examples extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 neighbor_count = 3; */ - private $neighbor_count = 0; + protected $neighbor_count = 0; protected $source; protected $config; diff --git a/AiPlatform/src/V1/Examples/ExampleGcsSource.php b/AiPlatform/src/V1/Examples/ExampleGcsSource.php index fa4f8eeb39fb..5fb53c8020e8 100644 --- a/AiPlatform/src/V1/Examples/ExampleGcsSource.php +++ b/AiPlatform/src/V1/Examples/ExampleGcsSource.php @@ -21,13 +21,13 @@ class ExampleGcsSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Examples.ExampleGcsSource.DataFormat data_format = 1; */ - private $data_format = 0; + protected $data_format = 0; /** * The Cloud Storage location for the input instances. * * Generated from protobuf field .google.cloud.aiplatform.v1.GcsSource gcs_source = 2; */ - private $gcs_source = null; + protected $gcs_source = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ExamplesOverride.php b/AiPlatform/src/V1/ExamplesOverride.php index f7c79400f012..b08bb3b5152b 100644 --- a/AiPlatform/src/V1/ExamplesOverride.php +++ b/AiPlatform/src/V1/ExamplesOverride.php @@ -20,13 +20,13 @@ class ExamplesOverride extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 neighbor_count = 1; */ - private $neighbor_count = 0; + protected $neighbor_count = 0; /** * The number of neighbors to return that have the same crowding tag. * * Generated from protobuf field int32 crowding_count = 2; */ - private $crowding_count = 0; + protected $crowding_count = 0; /** * Restrict the resulting nearest neighbors to respect these constraints. * @@ -38,13 +38,13 @@ class ExamplesOverride extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool return_embeddings = 4; */ - private $return_embeddings = false; + protected $return_embeddings = false; /** * The format of the data being provided with each call. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExamplesOverride.DataFormat data_format = 5; */ - private $data_format = 0; + protected $data_format = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/ExamplesRestrictionsNamespace.php b/AiPlatform/src/V1/ExamplesRestrictionsNamespace.php index cda1f00a8663..07d719058697 100644 --- a/AiPlatform/src/V1/ExamplesRestrictionsNamespace.php +++ b/AiPlatform/src/V1/ExamplesRestrictionsNamespace.php @@ -20,7 +20,7 @@ class ExamplesRestrictionsNamespace extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string namespace_name = 1; */ - private $namespace_name = ''; + protected $namespace_name = ''; /** * The list of allowed tags. * diff --git a/AiPlatform/src/V1/Execution.php b/AiPlatform/src/V1/Execution.php index 6d083979bb81..42bf6f6e07ca 100644 --- a/AiPlatform/src/V1/Execution.php +++ b/AiPlatform/src/V1/Execution.php @@ -20,14 +20,14 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * User provided display name of the Execution. * May be up to 128 Unicode characters. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * The state of this Execution. This is a property of the Execution, and does * not imply or capture any ongoing process. This property is managed by @@ -36,14 +36,14 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Execution.State state = 6; */ - private $state = 0; + protected $state = 0; /** * An eTag used to perform consistent read-modify-write updates. If not set, a * blind "overwrite" update happens. * * Generated from protobuf field string etag = 9; */ - private $etag = ''; + protected $etag = ''; /** * The labels with user-defined metadata to organize your Executions. * Label keys and values can be no longer than 64 characters @@ -60,13 +60,13 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Execution was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The title of the schema describing the metadata. * Schema title and version is expected to be registered in earlier Create @@ -75,7 +75,7 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string schema_title = 13; */ - private $schema_title = ''; + protected $schema_title = ''; /** * The version of the schema in `schema_title` to use. * Schema title and version is expected to be registered in earlier Create @@ -84,7 +84,7 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string schema_version = 14; */ - private $schema_version = ''; + protected $schema_version = ''; /** * Properties of the Execution. * Top level metadata keys' heading and trailing spaces will be trimmed. @@ -92,13 +92,13 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Struct metadata = 15; */ - private $metadata = null; + protected $metadata = null; /** * Description of the Execution * * Generated from protobuf field string description = 16; */ - private $description = ''; + protected $description = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ExplainRequest.php b/AiPlatform/src/V1/ExplainRequest.php index 1a11bef372ed..d953774b600f 100644 --- a/AiPlatform/src/V1/ExplainRequest.php +++ b/AiPlatform/src/V1/ExplainRequest.php @@ -23,7 +23,7 @@ class ExplainRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Required. The instances that are the input to the explanation call. * A DeployedModel may have an upper limit on the number of instances it @@ -47,7 +47,7 @@ class ExplainRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value parameters = 4; */ - private $parameters = null; + protected $parameters = null; /** * If specified, overrides the * [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] @@ -60,7 +60,7 @@ class ExplainRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationSpecOverride explanation_spec_override = 5; */ - private $explanation_spec_override = null; + protected $explanation_spec_override = null; /** * If specified, this ExplainRequest will be served by the chosen * DeployedModel, overriding @@ -68,7 +68,7 @@ class ExplainRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string deployed_model_id = 3; */ - private $deployed_model_id = ''; + protected $deployed_model_id = ''; /** * @param string $endpoint Required. The name of the Endpoint requested to serve the explanation. diff --git a/AiPlatform/src/V1/ExplainResponse.php b/AiPlatform/src/V1/ExplainResponse.php index e0e06a928fa2..41d2fa09856e 100644 --- a/AiPlatform/src/V1/ExplainResponse.php +++ b/AiPlatform/src/V1/ExplainResponse.php @@ -31,7 +31,7 @@ class ExplainResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string deployed_model_id = 2; */ - private $deployed_model_id = ''; + protected $deployed_model_id = ''; /** * The predictions that are the output of the predictions call. * Same as diff --git a/AiPlatform/src/V1/ExplanationMetadata.php b/AiPlatform/src/V1/ExplanationMetadata.php index de90597f1d5f..4fe06824724e 100644 --- a/AiPlatform/src/V1/ExplanationMetadata.php +++ b/AiPlatform/src/V1/ExplanationMetadata.php @@ -56,13 +56,13 @@ class ExplanationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_attributions_schema_uri = 3; */ - private $feature_attributions_schema_uri = ''; + protected $feature_attributions_schema_uri = ''; /** * Name of the source to generate embeddings for example based explanations. * * Generated from protobuf field string latent_space_source = 5; */ - private $latent_space_source = ''; + protected $latent_space_source = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ExplanationMetadata/InputMetadata.php b/AiPlatform/src/V1/ExplanationMetadata/InputMetadata.php index 13dfeb16c415..90182f8ba0da 100644 --- a/AiPlatform/src/V1/ExplanationMetadata/InputMetadata.php +++ b/AiPlatform/src/V1/ExplanationMetadata/InputMetadata.php @@ -45,28 +45,28 @@ class InputMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string input_tensor_name = 2; */ - private $input_tensor_name = ''; + protected $input_tensor_name = ''; /** * Defines how the feature is encoded into the input tensor. Defaults to * IDENTITY. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationMetadata.InputMetadata.Encoding encoding = 3; */ - private $encoding = 0; + protected $encoding = 0; /** * Modality of the feature. Valid values are: numeric, image. Defaults to * numeric. * * Generated from protobuf field string modality = 4; */ - private $modality = ''; + protected $modality = ''; /** * The domain details of the input feature value. Like min/max, original * mean or standard deviation if normalized. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationMetadata.InputMetadata.FeatureValueDomain feature_value_domain = 5; */ - private $feature_value_domain = null; + protected $feature_value_domain = null; /** * Specifies the index of the values of the input tensor. * Required when the input tensor is a sparse representation. Refer to @@ -75,7 +75,7 @@ class InputMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string indices_tensor_name = 6; */ - private $indices_tensor_name = ''; + protected $indices_tensor_name = ''; /** * Specifies the shape of the values of the input if the input is a sparse * representation. Refer to Tensorflow documentation for more details: @@ -83,7 +83,7 @@ class InputMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dense_shape_tensor_name = 7; */ - private $dense_shape_tensor_name = ''; + protected $dense_shape_tensor_name = ''; /** * A list of feature names for each index in the input tensor. * Required when the input @@ -106,7 +106,7 @@ class InputMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string encoded_tensor_name = 9; */ - private $encoded_tensor_name = ''; + protected $encoded_tensor_name = ''; /** * A list of baselines for the encoded tensor. * The shape of each baseline should match the shape of the encoded tensor. @@ -121,7 +121,7 @@ class InputMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationMetadata.InputMetadata.Visualization visualization = 11; */ - private $visualization = null; + protected $visualization = null; /** * Name of the group that the input belongs to. Features with the same group * name will be treated as one feature when computing attributions. Features @@ -132,7 +132,7 @@ class InputMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string group_name = 12; */ - private $group_name = ''; + protected $group_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ExplanationMetadata/InputMetadata/FeatureValueDomain.php b/AiPlatform/src/V1/ExplanationMetadata/InputMetadata/FeatureValueDomain.php index 64bcf2df5b2b..2c0fb77ab1e7 100644 --- a/AiPlatform/src/V1/ExplanationMetadata/InputMetadata/FeatureValueDomain.php +++ b/AiPlatform/src/V1/ExplanationMetadata/InputMetadata/FeatureValueDomain.php @@ -27,13 +27,13 @@ class FeatureValueDomain extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float min_value = 1; */ - private $min_value = 0.0; + protected $min_value = 0.0; /** * The maximum permissible value for this feature. * * Generated from protobuf field float max_value = 2; */ - private $max_value = 0.0; + protected $max_value = 0.0; /** * If this input feature has been normalized to a mean value of 0, * the original_mean specifies the mean value of the domain prior to @@ -41,7 +41,7 @@ class FeatureValueDomain extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float original_mean = 3; */ - private $original_mean = 0.0; + protected $original_mean = 0.0; /** * If this input feature has been normalized to a standard deviation of * 1.0, the original_stddev specifies the standard deviation of the domain @@ -49,7 +49,7 @@ class FeatureValueDomain extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float original_stddev = 4; */ - private $original_stddev = 0.0; + protected $original_stddev = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/ExplanationMetadata/InputMetadata/Visualization.php b/AiPlatform/src/V1/ExplanationMetadata/InputMetadata/Visualization.php index ac56b044a505..6effc8906fe8 100644 --- a/AiPlatform/src/V1/ExplanationMetadata/InputMetadata/Visualization.php +++ b/AiPlatform/src/V1/ExplanationMetadata/InputMetadata/Visualization.php @@ -24,14 +24,14 @@ class Visualization extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationMetadata.InputMetadata.Visualization.Type type = 1; */ - private $type = 0; + protected $type = 0; /** * Whether to only highlight pixels with positive contributions, negative * or both. Defaults to POSITIVE. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationMetadata.InputMetadata.Visualization.Polarity polarity = 2; */ - private $polarity = 0; + protected $polarity = 0; /** * The color scheme used for the highlighted areas. * Defaults to PINK_GREEN for @@ -46,7 +46,7 @@ class Visualization extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationMetadata.InputMetadata.Visualization.ColorMap color_map = 3; */ - private $color_map = 0; + protected $color_map = 0; /** * Excludes attributions above the specified percentile from the * highlighted areas. Using the clip_percent_upperbound and @@ -56,14 +56,14 @@ class Visualization extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float clip_percent_upperbound = 4; */ - private $clip_percent_upperbound = 0.0; + protected $clip_percent_upperbound = 0.0; /** * Excludes attributions below the specified percentile, from the * highlighted areas. Defaults to 62. * * Generated from protobuf field float clip_percent_lowerbound = 5; */ - private $clip_percent_lowerbound = 0.0; + protected $clip_percent_lowerbound = 0.0; /** * How the original image is displayed in the visualization. * Adjusting the overlay can help increase visual clarity if the original @@ -71,7 +71,7 @@ class Visualization extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationMetadata.InputMetadata.Visualization.OverlayType overlay_type = 6; */ - private $overlay_type = 0; + protected $overlay_type = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/ExplanationMetadata/OutputMetadata.php b/AiPlatform/src/V1/ExplanationMetadata/OutputMetadata.php index 7bf366efba49..3cc195ee31ea 100644 --- a/AiPlatform/src/V1/ExplanationMetadata/OutputMetadata.php +++ b/AiPlatform/src/V1/ExplanationMetadata/OutputMetadata.php @@ -21,7 +21,7 @@ class OutputMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string output_tensor_name = 3; */ - private $output_tensor_name = ''; + protected $output_tensor_name = ''; protected $display_name_mapping; /** diff --git a/AiPlatform/src/V1/ExplanationParameters.php b/AiPlatform/src/V1/ExplanationParameters.php index 431aaaabb421..c134d7f06b87 100644 --- a/AiPlatform/src/V1/ExplanationParameters.php +++ b/AiPlatform/src/V1/ExplanationParameters.php @@ -23,7 +23,7 @@ class ExplanationParameters extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 top_k = 4; */ - private $top_k = 0; + protected $top_k = 0; /** * If populated, only returns attributions that have * [output_index][google.cloud.aiplatform.v1.Attribution.output_index] @@ -38,7 +38,7 @@ class ExplanationParameters extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.ListValue output_indices = 5; */ - private $output_indices = null; + protected $output_indices = null; protected $method; /** diff --git a/AiPlatform/src/V1/ExplanationSpec.php b/AiPlatform/src/V1/ExplanationSpec.php index 4623da981b99..d3a7c34016a6 100644 --- a/AiPlatform/src/V1/ExplanationSpec.php +++ b/AiPlatform/src/V1/ExplanationSpec.php @@ -20,13 +20,13 @@ class ExplanationSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationParameters parameters = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $parameters = null; + protected $parameters = null; /** * Optional. Metadata describing the Model's input and output for explanation. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationMetadata metadata = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $metadata = null; + protected $metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ExplanationSpecOverride.php b/AiPlatform/src/V1/ExplanationSpecOverride.php index 5b991c0cfdf3..92a3b9487912 100644 --- a/AiPlatform/src/V1/ExplanationSpecOverride.php +++ b/AiPlatform/src/V1/ExplanationSpecOverride.php @@ -24,19 +24,19 @@ class ExplanationSpecOverride extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationParameters parameters = 1; */ - private $parameters = null; + protected $parameters = null; /** * The metadata to be overridden. If not specified, no metadata is overridden. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationMetadataOverride metadata = 2; */ - private $metadata = null; + protected $metadata = null; /** * The example-based explanations parameter overrides. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExamplesOverride examples_override = 3; */ - private $examples_override = null; + protected $examples_override = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportDataConfig.php b/AiPlatform/src/V1/ExportDataConfig.php index 214910aba590..77a162111eb5 100644 --- a/AiPlatform/src/V1/ExportDataConfig.php +++ b/AiPlatform/src/V1/ExportDataConfig.php @@ -24,7 +24,7 @@ class ExportDataConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotations_filter = 2; */ - private $annotations_filter = ''; + protected $annotations_filter = ''; /** * The ID of a SavedQuery (annotation set) under the Dataset specified by * [dataset_id][] used for filtering Annotations for training. @@ -45,7 +45,7 @@ class ExportDataConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string saved_query_id = 11; */ - private $saved_query_id = ''; + protected $saved_query_id = ''; /** * The Cloud Storage URI that points to a YAML file describing the annotation * schema. The schema is defined as an OpenAPI 3.0.2 [Schema @@ -69,13 +69,13 @@ class ExportDataConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_schema_uri = 12; */ - private $annotation_schema_uri = ''; + protected $annotation_schema_uri = ''; /** * Indicates the usage of the exported files. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExportDataConfig.ExportUse export_use = 4; */ - private $export_use = 0; + protected $export_use = 0; protected $destination; protected $split; diff --git a/AiPlatform/src/V1/ExportDataOperationMetadata.php b/AiPlatform/src/V1/ExportDataOperationMetadata.php index 70bdcdfb4d2d..42cce5b8a65d 100644 --- a/AiPlatform/src/V1/ExportDataOperationMetadata.php +++ b/AiPlatform/src/V1/ExportDataOperationMetadata.php @@ -21,14 +21,14 @@ class ExportDataOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * A Google Cloud Storage directory which path ends with '/'. The exported * data is stored in the directory. * * Generated from protobuf field string gcs_output_directory = 2; */ - private $gcs_output_directory = ''; + protected $gcs_output_directory = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportDataRequest.php b/AiPlatform/src/V1/ExportDataRequest.php index 99a0f9bd9028..f228564f8a9d 100644 --- a/AiPlatform/src/V1/ExportDataRequest.php +++ b/AiPlatform/src/V1/ExportDataRequest.php @@ -23,13 +23,13 @@ class ExportDataRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Required. The desired output location. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExportDataConfig export_config = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $export_config = null; + protected $export_config = null; /** * @param string $name Required. The name of the Dataset resource. diff --git a/AiPlatform/src/V1/ExportDataResponse.php b/AiPlatform/src/V1/ExportDataResponse.php index 646804a54c7b..5d6d6fa42680 100644 --- a/AiPlatform/src/V1/ExportDataResponse.php +++ b/AiPlatform/src/V1/ExportDataResponse.php @@ -32,7 +32,7 @@ class ExportDataResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Model.DataStats data_stats = 2; */ - private $data_stats = null; + protected $data_stats = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportFeatureValuesOperationMetadata.php b/AiPlatform/src/V1/ExportFeatureValuesOperationMetadata.php index f70da2a0c64c..5899b28bf347 100644 --- a/AiPlatform/src/V1/ExportFeatureValuesOperationMetadata.php +++ b/AiPlatform/src/V1/ExportFeatureValuesOperationMetadata.php @@ -20,7 +20,7 @@ class ExportFeatureValuesOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportFeatureValuesRequest.php b/AiPlatform/src/V1/ExportFeatureValuesRequest.php index 6ae63cffce46..d9dca89595c7 100644 --- a/AiPlatform/src/V1/ExportFeatureValuesRequest.php +++ b/AiPlatform/src/V1/ExportFeatureValuesRequest.php @@ -23,19 +23,19 @@ class ExportFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_type = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $entity_type = ''; + protected $entity_type = ''; /** * Required. Specifies destination location and format. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureValueDestination destination = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $destination = null; + protected $destination = null; /** * Required. Selects Features to export values of. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureSelector feature_selector = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_selector = null; + protected $feature_selector = null; /** * Per-Feature export settings. * diff --git a/AiPlatform/src/V1/ExportFeatureValuesRequest/FullExport.php b/AiPlatform/src/V1/ExportFeatureValuesRequest/FullExport.php index 9eb14c73b26d..15df7e9a7934 100644 --- a/AiPlatform/src/V1/ExportFeatureValuesRequest/FullExport.php +++ b/AiPlatform/src/V1/ExportFeatureValuesRequest/FullExport.php @@ -23,7 +23,7 @@ class FullExport extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; */ - private $start_time = null; + protected $start_time = null; /** * Exports Feature values as of this timestamp. If not set, * retrieve values as of now. Timestamp, if present, must not have higher @@ -31,7 +31,7 @@ class FullExport extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp end_time = 1; */ - private $end_time = null; + protected $end_time = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportFeatureValuesRequest/SnapshotExport.php b/AiPlatform/src/V1/ExportFeatureValuesRequest/SnapshotExport.php index 26aca9356ff7..0e20cfd9cdaf 100644 --- a/AiPlatform/src/V1/ExportFeatureValuesRequest/SnapshotExport.php +++ b/AiPlatform/src/V1/ExportFeatureValuesRequest/SnapshotExport.php @@ -23,7 +23,7 @@ class SnapshotExport extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp snapshot_time = 1; */ - private $snapshot_time = null; + protected $snapshot_time = null; /** * Excludes Feature values with feature generation timestamp before this * timestamp. If not set, retrieve oldest values kept in Feature Store. @@ -31,7 +31,7 @@ class SnapshotExport extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; */ - private $start_time = null; + protected $start_time = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportFilterSplit.php b/AiPlatform/src/V1/ExportFilterSplit.php index 88e63843d2c7..99367b1b0952 100644 --- a/AiPlatform/src/V1/ExportFilterSplit.php +++ b/AiPlatform/src/V1/ExportFilterSplit.php @@ -31,7 +31,7 @@ class ExportFilterSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string training_filter = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $training_filter = ''; + protected $training_filter = ''; /** * Required. A filter on DataItems of the Dataset. DataItems that match * this filter are used to validate the Model. A filter with same syntax @@ -43,7 +43,7 @@ class ExportFilterSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string validation_filter = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $validation_filter = ''; + protected $validation_filter = ''; /** * Required. A filter on DataItems of the Dataset. DataItems that match * this filter are used to test the Model. A filter with same syntax @@ -55,7 +55,7 @@ class ExportFilterSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string test_filter = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_filter = ''; + protected $test_filter = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportFractionSplit.php b/AiPlatform/src/V1/ExportFractionSplit.php index aab42d88c35e..5d54b7f05e07 100644 --- a/AiPlatform/src/V1/ExportFractionSplit.php +++ b/AiPlatform/src/V1/ExportFractionSplit.php @@ -25,19 +25,19 @@ class ExportFractionSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double training_fraction = 1; */ - private $training_fraction = 0.0; + protected $training_fraction = 0.0; /** * The fraction of the input data that is to be used to validate the Model. * * Generated from protobuf field double validation_fraction = 2; */ - private $validation_fraction = 0.0; + protected $validation_fraction = 0.0; /** * The fraction of the input data that is to be used to evaluate the Model. * * Generated from protobuf field double test_fraction = 3; */ - private $test_fraction = 0.0; + protected $test_fraction = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportModelOperationMetadata.php b/AiPlatform/src/V1/ExportModelOperationMetadata.php index 08adc3cc0486..20ea6285c14d 100644 --- a/AiPlatform/src/V1/ExportModelOperationMetadata.php +++ b/AiPlatform/src/V1/ExportModelOperationMetadata.php @@ -22,14 +22,14 @@ class ExportModelOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Output only. Information further describing the output of this Model * export. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExportModelOperationMetadata.OutputInfo output_info = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $output_info = null; + protected $output_info = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportModelOperationMetadata/OutputInfo.php b/AiPlatform/src/V1/ExportModelOperationMetadata/OutputInfo.php index 7d6d493f1ace..fb13107cb638 100644 --- a/AiPlatform/src/V1/ExportModelOperationMetadata/OutputInfo.php +++ b/AiPlatform/src/V1/ExportModelOperationMetadata/OutputInfo.php @@ -23,14 +23,14 @@ class OutputInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string artifact_output_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $artifact_output_uri = ''; + protected $artifact_output_uri = ''; /** * Output only. If the Model image is being exported to Google Container * Registry or Artifact Registry this is the full path of the image created. * * Generated from protobuf field string image_output_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $image_output_uri = ''; + protected $image_output_uri = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportModelRequest.php b/AiPlatform/src/V1/ExportModelRequest.php index 98d9952456cd..a5b3b13d0766 100644 --- a/AiPlatform/src/V1/ExportModelRequest.php +++ b/AiPlatform/src/V1/ExportModelRequest.php @@ -23,13 +23,13 @@ class ExportModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Required. The desired output location and configuration. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExportModelRequest.OutputConfig output_config = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $output_config = null; + protected $output_config = null; /** * @param string $name Required. The resource name of the Model to export. diff --git a/AiPlatform/src/V1/ExportModelRequest/OutputConfig.php b/AiPlatform/src/V1/ExportModelRequest/OutputConfig.php index 951f2d84906f..18349b43dc89 100644 --- a/AiPlatform/src/V1/ExportModelRequest/OutputConfig.php +++ b/AiPlatform/src/V1/ExportModelRequest/OutputConfig.php @@ -24,7 +24,7 @@ class OutputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string export_format_id = 1; */ - private $export_format_id = ''; + protected $export_format_id = ''; /** * The Cloud Storage location where the Model artifact is to be * written to. Under the directory given as the destination a new one with @@ -37,7 +37,7 @@ class OutputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GcsDestination artifact_destination = 3; */ - private $artifact_destination = null; + protected $artifact_destination = null; /** * The Google Container Registry or Artifact Registry uri where the * Model container image will be copied to. @@ -46,7 +46,7 @@ class OutputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ContainerRegistryDestination image_destination = 4; */ - private $image_destination = null; + protected $image_destination = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ExportTensorboardTimeSeriesDataRequest.php b/AiPlatform/src/V1/ExportTensorboardTimeSeriesDataRequest.php index f2a42dfacb3c..7951fd4cd072 100644 --- a/AiPlatform/src/V1/ExportTensorboardTimeSeriesDataRequest.php +++ b/AiPlatform/src/V1/ExportTensorboardTimeSeriesDataRequest.php @@ -23,13 +23,13 @@ class ExportTensorboardTimeSeriesDataRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string tensorboard_time_series = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $tensorboard_time_series = ''; + protected $tensorboard_time_series = ''; /** * Exports the TensorboardTimeSeries' data that match the filter expression. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of data points to return per page. * The default page_size is 1000. Values must be between 1 and 10000. @@ -37,7 +37,7 @@ class ExportTensorboardTimeSeriesDataRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [ExportTensorboardTimeSeriesData][google.cloud.aiplatform.v1.TensorboardService.ExportTensorboardTimeSeriesData] @@ -48,7 +48,7 @@ class ExportTensorboardTimeSeriesDataRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Field to use to sort the TensorboardTimeSeries' data. * By default, TensorboardTimeSeries' data is returned in a pseudo random @@ -56,7 +56,7 @@ class ExportTensorboardTimeSeriesDataRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $tensorboardTimeSeries Required. The resource name of the TensorboardTimeSeries to export data diff --git a/AiPlatform/src/V1/ExportTensorboardTimeSeriesDataResponse.php b/AiPlatform/src/V1/ExportTensorboardTimeSeriesDataResponse.php index dbd569ce08a6..664be2910658 100644 --- a/AiPlatform/src/V1/ExportTensorboardTimeSeriesDataResponse.php +++ b/AiPlatform/src/V1/ExportTensorboardTimeSeriesDataResponse.php @@ -30,7 +30,7 @@ class ExportTensorboardTimeSeriesDataResponse extends \Google\Protobuf\Internal\ * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/Feature.php b/AiPlatform/src/V1/Feature.php index f31b37de32cc..99e03e3bd4f5 100644 --- a/AiPlatform/src/V1/Feature.php +++ b/AiPlatform/src/V1/Feature.php @@ -28,34 +28,34 @@ class Feature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $name = ''; + protected $name = ''; /** * Description of the Feature. * * Generated from protobuf field string description = 2; */ - private $description = ''; + protected $description = ''; /** * Immutable. Only applicable for Vertex AI Feature Store (Legacy). * Type of Feature value. * * Generated from protobuf field .google.cloud.aiplatform.v1.Feature.ValueType value_type = 3 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $value_type = 0; + protected $value_type = 0; /** * Output only. Only applicable for Vertex AI Feature Store (Legacy). * Timestamp when this EntityType was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Only applicable for Vertex AI Feature Store (Legacy). * Timestamp when this EntityType was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. The labels with user-defined metadata to organize your Features. * Label keys and values can be no longer than 64 characters @@ -76,7 +76,7 @@ class Feature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 7; */ - private $etag = ''; + protected $etag = ''; /** * Optional. Only applicable for Vertex AI Feature Store (Legacy). * If not set, use the monitoring_config defined for the EntityType this @@ -89,7 +89,7 @@ class Feature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disable_monitoring = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $disable_monitoring = false; + protected $disable_monitoring = false; /** * Output only. Only applicable for Vertex AI Feature Store (Legacy). * The list of historical stats and anomalies with specified objectives. @@ -104,14 +104,14 @@ class Feature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version_column_name = 106; */ - private $version_column_name = ''; + protected $version_column_name = ''; /** * Entity responsible for maintaining this feature. Can be comma separated * list of email addresses or URIs. * * Generated from protobuf field string point_of_contact = 107; */ - private $point_of_contact = ''; + protected $point_of_contact = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/Feature/MonitoringStatsAnomaly.php b/AiPlatform/src/V1/Feature/MonitoringStatsAnomaly.php index 43a546d8dcfa..d25ac717bb9b 100644 --- a/AiPlatform/src/V1/Feature/MonitoringStatsAnomaly.php +++ b/AiPlatform/src/V1/Feature/MonitoringStatsAnomaly.php @@ -26,13 +26,13 @@ class MonitoringStatsAnomaly extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Feature.MonitoringStatsAnomaly.Objective objective = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $objective = 0; + protected $objective = 0; /** * Output only. The stats and anomalies generated at specific timestamp. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureStatsAnomaly feature_stats_anomaly = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $feature_stats_anomaly = null; + protected $feature_stats_anomaly = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureGroup.php b/AiPlatform/src/V1/FeatureGroup.php index 20b8fb6d1849..0893a31fd515 100644 --- a/AiPlatform/src/V1/FeatureGroup.php +++ b/AiPlatform/src/V1/FeatureGroup.php @@ -21,26 +21,26 @@ class FeatureGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; */ - private $name = ''; + protected $name = ''; /** * Output only. Timestamp when this FeatureGroup was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this FeatureGroup was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. Used to perform consistent read-modify-write updates. If not set, * a blind "overwrite" update happens. * * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * Optional. The labels with user-defined metadata to organize your * FeatureGroup. @@ -60,7 +60,7 @@ class FeatureGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string description = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; protected $source; /** diff --git a/AiPlatform/src/V1/FeatureGroup/BigQuery.php b/AiPlatform/src/V1/FeatureGroup/BigQuery.php index 2c9d2b90c12b..b2ef7c002990 100644 --- a/AiPlatform/src/V1/FeatureGroup/BigQuery.php +++ b/AiPlatform/src/V1/FeatureGroup/BigQuery.php @@ -21,7 +21,7 @@ class BigQuery extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.BigQuerySource big_query_source = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED]; */ - private $big_query_source = null; + protected $big_query_source = null; /** * Optional. Columns to construct entity_id / row keys. * If not provided defaults to `entity_id`. diff --git a/AiPlatform/src/V1/FeatureNoiseSigma/NoiseSigmaForFeature.php b/AiPlatform/src/V1/FeatureNoiseSigma/NoiseSigmaForFeature.php index c53536f53d47..cca2ad2d7b50 100644 --- a/AiPlatform/src/V1/FeatureNoiseSigma/NoiseSigmaForFeature.php +++ b/AiPlatform/src/V1/FeatureNoiseSigma/NoiseSigmaForFeature.php @@ -23,7 +23,7 @@ class NoiseSigmaForFeature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * This represents the standard deviation of the Gaussian kernel that will * be used to add noise to the feature prior to computing gradients. Similar @@ -32,7 +32,7 @@ class NoiseSigmaForFeature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float sigma = 2; */ - private $sigma = 0.0; + protected $sigma = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureOnlineStore.php b/AiPlatform/src/V1/FeatureOnlineStore.php index 316ee182fa72..562b38e6599e 100644 --- a/AiPlatform/src/V1/FeatureOnlineStore.php +++ b/AiPlatform/src/V1/FeatureOnlineStore.php @@ -23,26 +23,26 @@ class FeatureOnlineStore extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; */ - private $name = ''; + protected $name = ''; /** * Output only. Timestamp when this FeatureOnlineStore was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this FeatureOnlineStore was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. Used to perform consistent read-modify-write updates. If not set, * a blind "overwrite" update happens. * * Generated from protobuf field string etag = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * Optional. The labels with user-defined metadata to organize your * FeatureOnlineStore. @@ -62,21 +62,21 @@ class FeatureOnlineStore extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureOnlineStore.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Optional. The dedicated serving endpoint for this FeatureOnlineStore, which * is different from common Vertex service endpoint. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureOnlineStore.DedicatedServingEndpoint dedicated_serving_endpoint = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $dedicated_serving_endpoint = null; + protected $dedicated_serving_endpoint = null; /** * Optional. Customer-managed encryption key spec for data storage. If set, * online store will be secured by this key. * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 13 [(.google.api.field_behavior) = OPTIONAL]; */ - private $encryption_spec = null; + protected $encryption_spec = null; protected $storage_type; /** diff --git a/AiPlatform/src/V1/FeatureOnlineStore/Bigtable.php b/AiPlatform/src/V1/FeatureOnlineStore/Bigtable.php index fdb115794a7d..a686db9a523e 100644 --- a/AiPlatform/src/V1/FeatureOnlineStore/Bigtable.php +++ b/AiPlatform/src/V1/FeatureOnlineStore/Bigtable.php @@ -18,7 +18,7 @@ class Bigtable extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureOnlineStore.Bigtable.AutoScaling auto_scaling = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $auto_scaling = null; + protected $auto_scaling = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureOnlineStore/Bigtable/AutoScaling.php b/AiPlatform/src/V1/FeatureOnlineStore/Bigtable/AutoScaling.php index 641364326c10..c08c05d21a7e 100644 --- a/AiPlatform/src/V1/FeatureOnlineStore/Bigtable/AutoScaling.php +++ b/AiPlatform/src/V1/FeatureOnlineStore/Bigtable/AutoScaling.php @@ -19,7 +19,7 @@ class AutoScaling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 min_node_count = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $min_node_count = 0; + protected $min_node_count = 0; /** * Required. The maximum number of nodes to scale up to. Must be greater * than or equal to min_node_count, and less than or equal to 10 times of @@ -27,7 +27,7 @@ class AutoScaling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 max_node_count = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_node_count = 0; + protected $max_node_count = 0; /** * Optional. A percentage of the cluster's CPU capacity. Can be from 10% * to 80%. When a cluster's CPU utilization exceeds the target that you @@ -37,7 +37,7 @@ class AutoScaling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 cpu_utilization_target = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $cpu_utilization_target = 0; + protected $cpu_utilization_target = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureOnlineStore/DedicatedServingEndpoint.php b/AiPlatform/src/V1/FeatureOnlineStore/DedicatedServingEndpoint.php index 340d2561ea36..08e52360b936 100644 --- a/AiPlatform/src/V1/FeatureOnlineStore/DedicatedServingEndpoint.php +++ b/AiPlatform/src/V1/FeatureOnlineStore/DedicatedServingEndpoint.php @@ -23,7 +23,7 @@ class DedicatedServingEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string public_endpoint_domain_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $public_endpoint_domain_name = ''; + protected $public_endpoint_domain_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureOnlineStoreAdminServiceClient.php b/AiPlatform/src/V1/FeatureOnlineStoreAdminServiceClient.php deleted file mode 100644 index 25cf712fc925..000000000000 --- a/AiPlatform/src/V1/FeatureOnlineStoreAdminServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -.google.cloud.aiplatform.v1.IdMatcher id_matcher = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $id_matcher = null; + protected $id_matcher = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureStatsAnomaly.php b/AiPlatform/src/V1/FeatureStatsAnomaly.php index 57f94a90d5cf..5ccd30b5a112 100644 --- a/AiPlatform/src/V1/FeatureStatsAnomaly.php +++ b/AiPlatform/src/V1/FeatureStatsAnomaly.php @@ -33,7 +33,7 @@ class FeatureStatsAnomaly extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double score = 1; */ - private $score = 0.0; + protected $score = 0.0; /** * Path of the stats file for current feature values in Cloud Storage bucket. * Format: gs:////stats. @@ -43,7 +43,7 @@ class FeatureStatsAnomaly extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string stats_uri = 3; */ - private $stats_uri = ''; + protected $stats_uri = ''; /** * Path of the anomaly file for current feature values in Cloud Storage * bucket. @@ -56,7 +56,7 @@ class FeatureStatsAnomaly extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string anomaly_uri = 4; */ - private $anomaly_uri = ''; + protected $anomaly_uri = ''; /** * Deviation from the current stats to baseline stats. * 1. For categorical feature, the distribution distance is calculated by @@ -66,7 +66,7 @@ class FeatureStatsAnomaly extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double distribution_deviation = 5; */ - private $distribution_deviation = 0.0; + protected $distribution_deviation = 0.0; /** * This is the threshold used when detecting anomalies. * The threshold can be changed by user, so this one might be different from @@ -74,7 +74,7 @@ class FeatureStatsAnomaly extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double anomaly_detection_threshold = 9; */ - private $anomaly_detection_threshold = 0.0; + protected $anomaly_detection_threshold = 0.0; /** * The start timestamp of window where stats were generated. * For objectives where time window doesn't make sense (e.g. Featurestore @@ -83,7 +83,7 @@ class FeatureStatsAnomaly extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 7; */ - private $start_time = null; + protected $start_time = null; /** * The end timestamp of window where stats were generated. * For objectives where time window doesn't make sense (e.g. Featurestore @@ -92,7 +92,7 @@ class FeatureStatsAnomaly extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp end_time = 8; */ - private $end_time = null; + protected $end_time = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureValue.php b/AiPlatform/src/V1/FeatureValue.php index 906a25d1cbb8..12671a6e42df 100644 --- a/AiPlatform/src/V1/FeatureValue.php +++ b/AiPlatform/src/V1/FeatureValue.php @@ -20,7 +20,7 @@ class FeatureValue extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureValue.Metadata metadata = 14; */ - private $metadata = null; + protected $metadata = null; protected $value; /** diff --git a/AiPlatform/src/V1/FeatureValue/Metadata.php b/AiPlatform/src/V1/FeatureValue/Metadata.php index e9e2ef8b64ce..5285f91093fa 100644 --- a/AiPlatform/src/V1/FeatureValue/Metadata.php +++ b/AiPlatform/src/V1/FeatureValue/Metadata.php @@ -25,7 +25,7 @@ class Metadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp generate_time = 1; */ - private $generate_time = null; + protected $generate_time = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureView.php b/AiPlatform/src/V1/FeatureView.php index 348482a93b49..bd02c1721b84 100644 --- a/AiPlatform/src/V1/FeatureView.php +++ b/AiPlatform/src/V1/FeatureView.php @@ -22,26 +22,26 @@ class FeatureView extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; */ - private $name = ''; + protected $name = ''; /** * Output only. Timestamp when this FeatureView was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this FeatureView was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. Used to perform consistent read-modify-write updates. If not set, * a blind "overwrite" update happens. * * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * Optional. The labels with user-defined metadata to organize your * FeatureViews. @@ -63,7 +63,7 @@ class FeatureView extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureView.SyncConfig sync_config = 7; */ - private $sync_config = null; + protected $sync_config = null; /** * Optional. Configuration for index preparation for vector search. It * contains the required configurations to create an index from source data, @@ -72,7 +72,7 @@ class FeatureView extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureView.IndexConfig index_config = 15 [(.google.api.field_behavior) = OPTIONAL]; */ - private $index_config = null; + protected $index_config = null; protected $source; /** diff --git a/AiPlatform/src/V1/FeatureView/BigQuerySource.php b/AiPlatform/src/V1/FeatureView/BigQuerySource.php index 071ed5f4fa30..2bc1794e1fa1 100644 --- a/AiPlatform/src/V1/FeatureView/BigQuerySource.php +++ b/AiPlatform/src/V1/FeatureView/BigQuerySource.php @@ -19,7 +19,7 @@ class BigQuerySource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $uri = ''; + protected $uri = ''; /** * Required. Columns to construct entity_id / row keys. * diff --git a/AiPlatform/src/V1/FeatureView/FeatureRegistrySource.php b/AiPlatform/src/V1/FeatureView/FeatureRegistrySource.php index eeb3516d7b00..bc9e6147dc18 100644 --- a/AiPlatform/src/V1/FeatureView/FeatureRegistrySource.php +++ b/AiPlatform/src/V1/FeatureView/FeatureRegistrySource.php @@ -27,7 +27,7 @@ class FeatureRegistrySource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 project_number = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $project_number = null; + protected $project_number = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureView/FeatureRegistrySource/FeatureGroup.php b/AiPlatform/src/V1/FeatureView/FeatureRegistrySource/FeatureGroup.php index d4f7da0ef505..c57bf60856e8 100644 --- a/AiPlatform/src/V1/FeatureView/FeatureRegistrySource/FeatureGroup.php +++ b/AiPlatform/src/V1/FeatureView/FeatureRegistrySource/FeatureGroup.php @@ -21,7 +21,7 @@ class FeatureGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_group_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_group_id = ''; + protected $feature_group_id = ''; /** * Required. Identifiers of features under the feature group. * diff --git a/AiPlatform/src/V1/FeatureView/IndexConfig.php b/AiPlatform/src/V1/FeatureView/IndexConfig.php index 5f60331d319d..5d267a5fdcf4 100644 --- a/AiPlatform/src/V1/FeatureView/IndexConfig.php +++ b/AiPlatform/src/V1/FeatureView/IndexConfig.php @@ -22,7 +22,7 @@ class IndexConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string embedding_column = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $embedding_column = ''; + protected $embedding_column = ''; /** * Optional. Columns of features that're used to filter vector search * results. @@ -43,19 +43,19 @@ class IndexConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string crowding_column = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $crowding_column = ''; + protected $crowding_column = ''; /** * Optional. The number of dimensions of the input embedding. * * Generated from protobuf field optional int32 embedding_dimension = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $embedding_dimension = null; + protected $embedding_dimension = null; /** * Optional. The distance measure used in nearest neighbor search. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureView.IndexConfig.DistanceMeasureType distance_measure_type = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $distance_measure_type = 0; + protected $distance_measure_type = 0; protected $algorithm_config; /** diff --git a/AiPlatform/src/V1/FeatureView/IndexConfig/TreeAHConfig.php b/AiPlatform/src/V1/FeatureView/IndexConfig/TreeAHConfig.php index 0d56662cbc72..5f40d88a5874 100644 --- a/AiPlatform/src/V1/FeatureView/IndexConfig/TreeAHConfig.php +++ b/AiPlatform/src/V1/FeatureView/IndexConfig/TreeAHConfig.php @@ -21,7 +21,7 @@ class TreeAHConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 leaf_node_embedding_count = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $leaf_node_embedding_count = null; + protected $leaf_node_embedding_count = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureView/SyncConfig.php b/AiPlatform/src/V1/FeatureView/SyncConfig.php index ec79c353e6b4..2d3ea23f9625 100644 --- a/AiPlatform/src/V1/FeatureView/SyncConfig.php +++ b/AiPlatform/src/V1/FeatureView/SyncConfig.php @@ -25,7 +25,7 @@ class SyncConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string cron = 1; */ - private $cron = ''; + protected $cron = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureViewSync.php b/AiPlatform/src/V1/FeatureViewSync.php index 033b43a622a3..6a4897b4ac72 100644 --- a/AiPlatform/src/V1/FeatureViewSync.php +++ b/AiPlatform/src/V1/FeatureViewSync.php @@ -22,7 +22,7 @@ class FeatureViewSync extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; */ - private $name = ''; + protected $name = ''; /** * Output only. Time when this FeatureViewSync is created. Creation of a * FeatureViewSync means that the job is pending / waiting for sufficient @@ -30,25 +30,25 @@ class FeatureViewSync extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Time when this FeatureViewSync is finished. * * Generated from protobuf field .google.type.Interval run_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $run_time = null; + protected $run_time = null; /** * Output only. Final status of the FeatureViewSync. * * Generated from protobuf field .google.rpc.Status final_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $final_status = null; + protected $final_status = null; /** * Output only. Summary of the sync job. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureViewSync.SyncSummary sync_summary = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $sync_summary = null; + protected $sync_summary = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FeatureViewSync/SyncSummary.php b/AiPlatform/src/V1/FeatureViewSync/SyncSummary.php index e50d0335284a..f382023697b7 100644 --- a/AiPlatform/src/V1/FeatureViewSync/SyncSummary.php +++ b/AiPlatform/src/V1/FeatureViewSync/SyncSummary.php @@ -21,13 +21,13 @@ class SyncSummary extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 row_synced = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $row_synced = 0; + protected $row_synced = 0; /** * Output only. BigQuery slot milliseconds consumed for the sync job. * * Generated from protobuf field int64 total_slot = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $total_slot = 0; + protected $total_slot = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/Featurestore.php b/AiPlatform/src/V1/Featurestore.php index e7767af4928c..d538cfed35fc 100644 --- a/AiPlatform/src/V1/Featurestore.php +++ b/AiPlatform/src/V1/Featurestore.php @@ -23,26 +23,26 @@ class Featurestore extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Timestamp when this Featurestore was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Featurestore was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. Used to perform consistent read-modify-write updates. If not set, * a blind "overwrite" update happens. * * Generated from protobuf field string etag = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $etag = ''; + protected $etag = ''; /** * Optional. The labels with user-defined metadata to organize your * Featurestore. @@ -66,13 +66,13 @@ class Featurestore extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Featurestore.OnlineServingConfig online_serving_config = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $online_serving_config = null; + protected $online_serving_config = null; /** * Output only. State of the featurestore. * * Generated from protobuf field .google.cloud.aiplatform.v1.Featurestore.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Optional. TTL in days for feature values that will be stored in online * serving storage. The Feature Store online storage periodically removes @@ -83,14 +83,14 @@ class Featurestore extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 online_storage_ttl_days = 13 [(.google.api.field_behavior) = OPTIONAL]; */ - private $online_storage_ttl_days = 0; + protected $online_storage_ttl_days = 0; /** * Optional. Customer-managed encryption key spec for data storage. If set, * both of the online and offline data storage will be secured by this key. * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Featurestore/OnlineServingConfig.php b/AiPlatform/src/V1/Featurestore/OnlineServingConfig.php index 6f4fbebbf450..a4a859ded590 100644 --- a/AiPlatform/src/V1/Featurestore/OnlineServingConfig.php +++ b/AiPlatform/src/V1/Featurestore/OnlineServingConfig.php @@ -24,7 +24,7 @@ class OnlineServingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 fixed_node_count = 2; */ - private $fixed_node_count = 0; + protected $fixed_node_count = 0; /** * Online serving scaling configuration. * Only one of `fixed_node_count` and `scaling` can be set. Setting one will @@ -32,7 +32,7 @@ class OnlineServingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Featurestore.OnlineServingConfig.Scaling scaling = 4; */ - private $scaling = null; + protected $scaling = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Featurestore/OnlineServingConfig/Scaling.php b/AiPlatform/src/V1/Featurestore/OnlineServingConfig/Scaling.php index 7f722ed97436..14543f8613dc 100644 --- a/AiPlatform/src/V1/Featurestore/OnlineServingConfig/Scaling.php +++ b/AiPlatform/src/V1/Featurestore/OnlineServingConfig/Scaling.php @@ -23,14 +23,14 @@ class Scaling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 min_node_count = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $min_node_count = 0; + protected $min_node_count = 0; /** * The maximum number of nodes to scale up to. Must be greater than * min_node_count, and less than or equal to 10 times of 'min_node_count'. * * Generated from protobuf field int32 max_node_count = 2; */ - private $max_node_count = 0; + protected $max_node_count = 0; /** * Optional. The cpu utilization that the Autoscaler should be trying to * achieve. This number is on a scale from 0 (no utilization) to 100 @@ -42,7 +42,7 @@ class Scaling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 cpu_utilization_target = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $cpu_utilization_target = 0; + protected $cpu_utilization_target = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/FeaturestoreMonitoringConfig.php b/AiPlatform/src/V1/FeaturestoreMonitoringConfig.php index 88650539f76a..9d13f9c4ff78 100644 --- a/AiPlatform/src/V1/FeaturestoreMonitoringConfig.php +++ b/AiPlatform/src/V1/FeaturestoreMonitoringConfig.php @@ -20,13 +20,13 @@ class FeaturestoreMonitoringConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.SnapshotAnalysis snapshot_analysis = 1; */ - private $snapshot_analysis = null; + protected $snapshot_analysis = null; /** * The config for ImportFeatures Analysis Based Feature Monitoring. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.ImportFeaturesAnalysis import_features_analysis = 2; */ - private $import_features_analysis = null; + protected $import_features_analysis = null; /** * Threshold for numerical features of anomaly detection. * This is shared by all objectives of Featurestore Monitoring for numerical @@ -36,7 +36,7 @@ class FeaturestoreMonitoringConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.ThresholdConfig numerical_threshold_config = 3; */ - private $numerical_threshold_config = null; + protected $numerical_threshold_config = null; /** * Threshold for categorical features of anomaly detection. * This is shared by all types of Featurestore Monitoring for categorical @@ -46,7 +46,7 @@ class FeaturestoreMonitoringConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.ThresholdConfig categorical_threshold_config = 4; */ - private $categorical_threshold_config = null; + protected $categorical_threshold_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FeaturestoreMonitoringConfig/ImportFeaturesAnalysis.php b/AiPlatform/src/V1/FeaturestoreMonitoringConfig/ImportFeaturesAnalysis.php index 9e36fd08e698..195aa9dfc58f 100644 --- a/AiPlatform/src/V1/FeaturestoreMonitoringConfig/ImportFeaturesAnalysis.php +++ b/AiPlatform/src/V1/FeaturestoreMonitoringConfig/ImportFeaturesAnalysis.php @@ -25,14 +25,14 @@ class ImportFeaturesAnalysis extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.ImportFeaturesAnalysis.State state = 1; */ - private $state = 0; + protected $state = 0; /** * The baseline used to do anomaly detection for the statistics generated by * import features analysis. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.ImportFeaturesAnalysis.Baseline anomaly_detection_baseline = 2; */ - private $anomaly_detection_baseline = 0; + protected $anomaly_detection_baseline = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/FeaturestoreMonitoringConfig/SnapshotAnalysis.php b/AiPlatform/src/V1/FeaturestoreMonitoringConfig/SnapshotAnalysis.php index 42230a0fc2d3..67f2b677d9a4 100644 --- a/AiPlatform/src/V1/FeaturestoreMonitoringConfig/SnapshotAnalysis.php +++ b/AiPlatform/src/V1/FeaturestoreMonitoringConfig/SnapshotAnalysis.php @@ -33,14 +33,14 @@ class SnapshotAnalysis extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disabled = 1; */ - private $disabled = false; + protected $disabled = false; /** * Configuration of the snapshot analysis based monitoring pipeline * running interval. The value indicates number of days. * * Generated from protobuf field int32 monitoring_interval_days = 3; */ - private $monitoring_interval_days = 0; + protected $monitoring_interval_days = 0; /** * Customized export features time window for snapshot analysis. Unit is one * day. Default value is 3 weeks. Minimum value is 1 day. Maximum value is @@ -48,7 +48,7 @@ class SnapshotAnalysis extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 staleness_days = 4; */ - private $staleness_days = 0; + protected $staleness_days = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/FeaturestoreOnlineServingServiceClient.php b/AiPlatform/src/V1/FeaturestoreOnlineServingServiceClient.php deleted file mode 100644 index 4942dc5a654b..000000000000 --- a/AiPlatform/src/V1/FeaturestoreOnlineServingServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/ReadFeatureValues', - $argument, - ['\Google\Cloud\AIPlatform\V1\ReadFeatureValuesResponse', 'decode'], - $metadata, $options); - } - - /** - * Reads Feature values for multiple entities. Depending on their size, data - * for different entities may be broken - * up across multiple responses. - * @param \Google\Cloud\AIPlatform\V1\StreamingReadFeatureValuesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\ServerStreamingCall - */ - public function StreamingReadFeatureValues(\Google\Cloud\AIPlatform\V1\StreamingReadFeatureValuesRequest $argument, - $metadata = [], $options = []) { - return $this->_serverStreamRequest('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/StreamingReadFeatureValues', - $argument, - ['\Google\Cloud\AIPlatform\V1\ReadFeatureValuesResponse', 'decode'], - $metadata, $options); - } - - /** - * Writes Feature values of one or more entities of an EntityType. - * - * The Feature values are merged into existing entities if any. The Feature - * values to be written must have timestamp within the online storage - * retention. - * @param \Google\Cloud\AIPlatform\V1\WriteFeatureValuesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function WriteFeatureValues(\Google\Cloud\AIPlatform\V1\WriteFeatureValuesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/WriteFeatureValues', - $argument, - ['\Google\Cloud\AIPlatform\V1\WriteFeatureValuesResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/FeaturestoreServiceClient.php b/AiPlatform/src/V1/FeaturestoreServiceClient.php deleted file mode 100644 index c98456bc2b9c..000000000000 --- a/AiPlatform/src/V1/FeaturestoreServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/CreateFeaturestore', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single Featurestore. - * @param \Google\Cloud\AIPlatform\V1\GetFeaturestoreRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetFeaturestore(\Google\Cloud\AIPlatform\V1\GetFeaturestoreRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/GetFeaturestore', - $argument, - ['\Google\Cloud\AIPlatform\V1\Featurestore', 'decode'], - $metadata, $options); - } - - /** - * Lists Featurestores in a given project and location. - * @param \Google\Cloud\AIPlatform\V1\ListFeaturestoresRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListFeaturestores(\Google\Cloud\AIPlatform\V1\ListFeaturestoresRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/ListFeaturestores', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListFeaturestoresResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates the parameters of a single Featurestore. - * @param \Google\Cloud\AIPlatform\V1\UpdateFeaturestoreRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateFeaturestore(\Google\Cloud\AIPlatform\V1\UpdateFeaturestoreRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/UpdateFeaturestore', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single Featurestore. The Featurestore must not contain any - * EntityTypes or `force` must be set to true for the request to succeed. - * @param \Google\Cloud\AIPlatform\V1\DeleteFeaturestoreRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteFeaturestore(\Google\Cloud\AIPlatform\V1\DeleteFeaturestoreRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeaturestore', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a new EntityType in a given Featurestore. - * @param \Google\Cloud\AIPlatform\V1\CreateEntityTypeRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateEntityType(\Google\Cloud\AIPlatform\V1\CreateEntityTypeRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/CreateEntityType', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single EntityType. - * @param \Google\Cloud\AIPlatform\V1\GetEntityTypeRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetEntityType(\Google\Cloud\AIPlatform\V1\GetEntityTypeRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/GetEntityType', - $argument, - ['\Google\Cloud\AIPlatform\V1\EntityType', 'decode'], - $metadata, $options); - } - - /** - * Lists EntityTypes in a given Featurestore. - * @param \Google\Cloud\AIPlatform\V1\ListEntityTypesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListEntityTypes(\Google\Cloud\AIPlatform\V1\ListEntityTypesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/ListEntityTypes', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListEntityTypesResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates the parameters of a single EntityType. - * @param \Google\Cloud\AIPlatform\V1\UpdateEntityTypeRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateEntityType(\Google\Cloud\AIPlatform\V1\UpdateEntityTypeRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/UpdateEntityType', - $argument, - ['\Google\Cloud\AIPlatform\V1\EntityType', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single EntityType. The EntityType must not have any Features - * or `force` must be set to true for the request to succeed. - * @param \Google\Cloud\AIPlatform\V1\DeleteEntityTypeRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteEntityType(\Google\Cloud\AIPlatform\V1\DeleteEntityTypeRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/DeleteEntityType', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a new Feature in a given EntityType. - * @param \Google\Cloud\AIPlatform\V1\CreateFeatureRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateFeature(\Google\Cloud\AIPlatform\V1\CreateFeatureRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/CreateFeature', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a batch of Features in a given EntityType. - * @param \Google\Cloud\AIPlatform\V1\BatchCreateFeaturesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchCreateFeatures(\Google\Cloud\AIPlatform\V1\BatchCreateFeaturesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/BatchCreateFeatures', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single Feature. - * @param \Google\Cloud\AIPlatform\V1\GetFeatureRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetFeature(\Google\Cloud\AIPlatform\V1\GetFeatureRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/GetFeature', - $argument, - ['\Google\Cloud\AIPlatform\V1\Feature', 'decode'], - $metadata, $options); - } - - /** - * Lists Features in a given EntityType. - * @param \Google\Cloud\AIPlatform\V1\ListFeaturesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListFeatures(\Google\Cloud\AIPlatform\V1\ListFeaturesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/ListFeatures', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListFeaturesResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates the parameters of a single Feature. - * @param \Google\Cloud\AIPlatform\V1\UpdateFeatureRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateFeature(\Google\Cloud\AIPlatform\V1\UpdateFeatureRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/UpdateFeature', - $argument, - ['\Google\Cloud\AIPlatform\V1\Feature', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single Feature. - * @param \Google\Cloud\AIPlatform\V1\DeleteFeatureRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteFeature(\Google\Cloud\AIPlatform\V1\DeleteFeatureRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeature', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Imports Feature values into the Featurestore from a source storage. - * - * The progress of the import is tracked by the returned operation. The - * imported features are guaranteed to be visible to subsequent read - * operations after the operation is marked as successfully done. - * - * If an import operation fails, the Feature values returned from - * reads and exports may be inconsistent. If consistency is - * required, the caller must retry the same import request again and wait till - * the new operation returned is marked as successfully done. - * - * There are also scenarios where the caller can cause inconsistency. - * - * - Source data for import contains multiple distinct Feature values for - * the same entity ID and timestamp. - * - Source is modified during an import. This includes adding, updating, or - * removing source data and/or metadata. Examples of updating metadata - * include but are not limited to changing storage location, storage class, - * or retention policy. - * - Online serving cluster is under-provisioned. - * @param \Google\Cloud\AIPlatform\V1\ImportFeatureValuesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ImportFeatureValues(\Google\Cloud\AIPlatform\V1\ImportFeatureValuesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/ImportFeatureValues', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Batch reads Feature values from a Featurestore. - * - * This API enables batch reading Feature values, where each read - * instance in the batch may read Feature values of entities from one or - * more EntityTypes. Point-in-time correctness is guaranteed for Feature - * values of each read instance as of each instance's read timestamp. - * @param \Google\Cloud\AIPlatform\V1\BatchReadFeatureValuesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchReadFeatureValues(\Google\Cloud\AIPlatform\V1\BatchReadFeatureValuesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/BatchReadFeatureValues', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Exports Feature values from all the entities of a target EntityType. - * @param \Google\Cloud\AIPlatform\V1\ExportFeatureValuesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ExportFeatureValues(\Google\Cloud\AIPlatform\V1\ExportFeatureValuesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/ExportFeatureValues', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Delete Feature values from Featurestore. - * - * The progress of the deletion is tracked by the returned operation. The - * deleted feature values are guaranteed to be invisible to subsequent read - * operations after the operation is marked as successfully done. - * - * If a delete feature values operation fails, the feature values - * returned from reads and exports may be inconsistent. If consistency is - * required, the caller must retry the same delete request again and wait till - * the new operation returned is marked as successfully done. - * @param \Google\Cloud\AIPlatform\V1\DeleteFeatureValuesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteFeatureValues(\Google\Cloud\AIPlatform\V1\DeleteFeatureValuesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeatureValues', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Searches Features matching a query in a given project. - * @param \Google\Cloud\AIPlatform\V1\SearchFeaturesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SearchFeatures(\Google\Cloud\AIPlatform\V1\SearchFeaturesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.FeaturestoreService/SearchFeatures', - $argument, - ['\Google\Cloud\AIPlatform\V1\SearchFeaturesResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/FetchFeatureValuesRequest.php b/AiPlatform/src/V1/FetchFeatureValuesRequest.php index 26a729292741..85ef6d02996e 100644 --- a/AiPlatform/src/V1/FetchFeatureValuesRequest.php +++ b/AiPlatform/src/V1/FetchFeatureValuesRequest.php @@ -23,13 +23,13 @@ class FetchFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_view = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $feature_view = ''; + protected $feature_view = ''; /** * Optional. The request key to fetch feature values for. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureViewDataKey data_key = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $data_key = null; + protected $data_key = null; /** * Optional. Response data format. If not set, * [FeatureViewDataFormat.KEY_VALUE][google.cloud.aiplatform.v1.FeatureViewDataFormat.KEY_VALUE] @@ -37,7 +37,7 @@ class FetchFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureViewDataFormat data_format = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $data_format = 0; + protected $data_format = 0; /** * @param string $featureView Required. FeatureView resource format diff --git a/AiPlatform/src/V1/FetchFeatureValuesResponse.php b/AiPlatform/src/V1/FetchFeatureValuesResponse.php index 0cc4c4debf3d..ae7cc87c31b7 100644 --- a/AiPlatform/src/V1/FetchFeatureValuesResponse.php +++ b/AiPlatform/src/V1/FetchFeatureValuesResponse.php @@ -23,7 +23,7 @@ class FetchFeatureValuesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureViewDataKey data_key = 4; */ - private $data_key = null; + protected $data_key = null; protected $format; /** diff --git a/AiPlatform/src/V1/FetchFeatureValuesResponse/FeatureNameValuePairList/FeatureNameValuePair.php b/AiPlatform/src/V1/FetchFeatureValuesResponse/FeatureNameValuePairList/FeatureNameValuePair.php index 57053a6b5189..88fdf0726b05 100644 --- a/AiPlatform/src/V1/FetchFeatureValuesResponse/FeatureNameValuePairList/FeatureNameValuePair.php +++ b/AiPlatform/src/V1/FetchFeatureValuesResponse/FeatureNameValuePairList/FeatureNameValuePair.php @@ -20,7 +20,7 @@ class FeatureNameValuePair extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; protected $data; /** diff --git a/AiPlatform/src/V1/FileData.php b/AiPlatform/src/V1/FileData.php index 09153cc5942e..acd920e86eb8 100644 --- a/AiPlatform/src/V1/FileData.php +++ b/AiPlatform/src/V1/FileData.php @@ -20,13 +20,13 @@ class FileData extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $mime_type = ''; + protected $mime_type = ''; /** * Required. URI. * * Generated from protobuf field string file_uri = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $file_uri = ''; + protected $file_uri = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/FilterSplit.php b/AiPlatform/src/V1/FilterSplit.php index b325cab9250f..3c23a46820ed 100644 --- a/AiPlatform/src/V1/FilterSplit.php +++ b/AiPlatform/src/V1/FilterSplit.php @@ -31,7 +31,7 @@ class FilterSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string training_filter = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $training_filter = ''; + protected $training_filter = ''; /** * Required. A filter on DataItems of the Dataset. DataItems that match * this filter are used to validate the Model. A filter with same syntax @@ -43,7 +43,7 @@ class FilterSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string validation_filter = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $validation_filter = ''; + protected $validation_filter = ''; /** * Required. A filter on DataItems of the Dataset. DataItems that match * this filter are used to test the Model. A filter with same syntax @@ -55,7 +55,7 @@ class FilterSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string test_filter = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_filter = ''; + protected $test_filter = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/FindNeighborsRequest.php b/AiPlatform/src/V1/FindNeighborsRequest.php index 4a931c568701..0a3b79c5bbaa 100644 --- a/AiPlatform/src/V1/FindNeighborsRequest.php +++ b/AiPlatform/src/V1/FindNeighborsRequest.php @@ -23,7 +23,7 @@ class FindNeighborsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string index_endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $index_endpoint = ''; + protected $index_endpoint = ''; /** * The ID of the DeployedIndex that will serve the request. This request is * sent to a specific IndexEndpoint, as per the IndexEndpoint.network. That @@ -34,7 +34,7 @@ class FindNeighborsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string deployed_index_id = 2; */ - private $deployed_index_id = ''; + protected $deployed_index_id = ''; /** * The list of queries. * @@ -49,7 +49,7 @@ class FindNeighborsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool return_full_datapoint = 4; */ - private $return_full_datapoint = false; + protected $return_full_datapoint = false; /** * Constructor. diff --git a/AiPlatform/src/V1/FindNeighborsRequest/Query.php b/AiPlatform/src/V1/FindNeighborsRequest/Query.php index 7a258722fbb5..24b4c2d43bb2 100644 --- a/AiPlatform/src/V1/FindNeighborsRequest/Query.php +++ b/AiPlatform/src/V1/FindNeighborsRequest/Query.php @@ -22,7 +22,7 @@ class Query extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.IndexDatapoint datapoint = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $datapoint = null; + protected $datapoint = null; /** * The number of nearest neighbors to be retrieved from database for each * query. If not set, will use the default from the service configuration @@ -30,7 +30,7 @@ class Query extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 neighbor_count = 2; */ - private $neighbor_count = 0; + protected $neighbor_count = 0; /** * Crowding is a constraint on a neighbor list produced by nearest neighbor * search requiring that no more than some value k' of the k neighbors @@ -40,7 +40,7 @@ class Query extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 per_crowding_attribute_neighbor_count = 3; */ - private $per_crowding_attribute_neighbor_count = 0; + protected $per_crowding_attribute_neighbor_count = 0; /** * The number of neighbors to find via approximate search before * exact reordering is performed. If not set, the default value from scam @@ -48,7 +48,7 @@ class Query extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 approximate_neighbor_count = 4; */ - private $approximate_neighbor_count = 0; + protected $approximate_neighbor_count = 0; /** * The fraction of the number of leaves to search, set at query time allows * user to tune search performance. This value increase result in both @@ -59,7 +59,7 @@ class Query extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double fraction_leaf_nodes_to_search_override = 5; */ - private $fraction_leaf_nodes_to_search_override = 0.0; + protected $fraction_leaf_nodes_to_search_override = 0.0; protected $ranking; /** diff --git a/AiPlatform/src/V1/FindNeighborsRequest/Query/RRF.php b/AiPlatform/src/V1/FindNeighborsRequest/Query/RRF.php index 56550e9f8dfb..3531fd2dc088 100644 --- a/AiPlatform/src/V1/FindNeighborsRequest/Query/RRF.php +++ b/AiPlatform/src/V1/FindNeighborsRequest/Query/RRF.php @@ -22,7 +22,7 @@ class RRF extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float alpha = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $alpha = 0.0; + protected $alpha = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/FindNeighborsResponse/NearestNeighbors.php b/AiPlatform/src/V1/FindNeighborsResponse/NearestNeighbors.php index 903936daafbd..04e1279c5b5f 100644 --- a/AiPlatform/src/V1/FindNeighborsResponse/NearestNeighbors.php +++ b/AiPlatform/src/V1/FindNeighborsResponse/NearestNeighbors.php @@ -20,7 +20,7 @@ class NearestNeighbors extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1; */ - private $id = ''; + protected $id = ''; /** * All its neighbors. * diff --git a/AiPlatform/src/V1/FindNeighborsResponse/Neighbor.php b/AiPlatform/src/V1/FindNeighborsResponse/Neighbor.php index 2c1be95fa1de..72b18d042922 100644 --- a/AiPlatform/src/V1/FindNeighborsResponse/Neighbor.php +++ b/AiPlatform/src/V1/FindNeighborsResponse/Neighbor.php @@ -23,19 +23,19 @@ class Neighbor extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.IndexDatapoint datapoint = 1; */ - private $datapoint = null; + protected $datapoint = null; /** * The distance between the neighbor and the dense embedding query. * * Generated from protobuf field double distance = 2; */ - private $distance = 0.0; + protected $distance = 0.0; /** * The distance between the neighbor and the query sparse_embedding. * * Generated from protobuf field double sparse_distance = 3; */ - private $sparse_distance = 0.0; + protected $sparse_distance = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/FractionSplit.php b/AiPlatform/src/V1/FractionSplit.php index 5124b20be183..c122220bf0c8 100644 --- a/AiPlatform/src/V1/FractionSplit.php +++ b/AiPlatform/src/V1/FractionSplit.php @@ -25,19 +25,19 @@ class FractionSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double training_fraction = 1; */ - private $training_fraction = 0.0; + protected $training_fraction = 0.0; /** * The fraction of the input data that is to be used to validate the Model. * * Generated from protobuf field double validation_fraction = 2; */ - private $validation_fraction = 0.0; + protected $validation_fraction = 0.0; /** * The fraction of the input data that is to be used to evaluate the Model. * * Generated from protobuf field double test_fraction = 3; */ - private $test_fraction = 0.0; + protected $test_fraction = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/FunctionCall.php b/AiPlatform/src/V1/FunctionCall.php index ca73d3cf160b..601dafb65711 100644 --- a/AiPlatform/src/V1/FunctionCall.php +++ b/AiPlatform/src/V1/FunctionCall.php @@ -23,14 +23,14 @@ class FunctionCall extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; /** * Optional. Required. The function parameters and values in JSON object * format. See [FunctionDeclaration.parameters] for parameter details. * * Generated from protobuf field .google.protobuf.Struct args = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $args = null; + protected $args = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FunctionCallingConfig.php b/AiPlatform/src/V1/FunctionCallingConfig.php index a9800526b5a6..b65c4e1231cc 100644 --- a/AiPlatform/src/V1/FunctionCallingConfig.php +++ b/AiPlatform/src/V1/FunctionCallingConfig.php @@ -20,7 +20,7 @@ class FunctionCallingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FunctionCallingConfig.Mode mode = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $mode = 0; + protected $mode = 0; /** * Optional. Function names to call. Only set when the Mode is ANY. Function * names should match [FunctionDeclaration.name]. With mode set to ANY, model diff --git a/AiPlatform/src/V1/FunctionDeclaration.php b/AiPlatform/src/V1/FunctionDeclaration.php index 5130f027d0df..8499695959db 100644 --- a/AiPlatform/src/V1/FunctionDeclaration.php +++ b/AiPlatform/src/V1/FunctionDeclaration.php @@ -27,14 +27,14 @@ class FunctionDeclaration extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; /** * Optional. Description and purpose of the function. * Model uses it to decide how and whether to call the function. * * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Optional. Describes the parameters to this function in JSON Schema Object * format. Reflects the Open API 3.03 Parameter Object. string Key: the name @@ -53,7 +53,7 @@ class FunctionDeclaration extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Schema parameters = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $parameters = null; + protected $parameters = null; /** * Constructor. diff --git a/AiPlatform/src/V1/FunctionResponse.php b/AiPlatform/src/V1/FunctionResponse.php index 0396c980a23f..0d62db7ae42d 100644 --- a/AiPlatform/src/V1/FunctionResponse.php +++ b/AiPlatform/src/V1/FunctionResponse.php @@ -24,13 +24,13 @@ class FunctionResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; /** * Required. The function response in JSON object format. * * Generated from protobuf field .google.protobuf.Struct response = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $response = null; + protected $response = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Gapic/DatasetServiceGapicClient.php b/AiPlatform/src/V1/Gapic/DatasetServiceGapicClient.php deleted file mode 100644 index d5bf3128d992..000000000000 --- a/AiPlatform/src/V1/Gapic/DatasetServiceGapicClient.php +++ /dev/null @@ -1,2472 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $dataset = new Dataset(); - * $operationResponse = $datasetServiceClient->createDataset($formattedParent, $dataset); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $datasetServiceClient->createDataset($formattedParent, $dataset); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $datasetServiceClient->resumeOperation($operationName, 'createDataset'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\DatasetServiceClient}. - */ -class DatasetServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.DatasetService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $annotationSpecNameTemplate; - - private static $dataItemNameTemplate; - - private static $datasetNameTemplate; - - private static $datasetVersionNameTemplate; - - private static $locationNameTemplate; - - private static $savedQueryNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/dataset_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/dataset_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/dataset_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/dataset_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getAnnotationSpecNameTemplate() - { - if (self::$annotationSpecNameTemplate == null) { - self::$annotationSpecNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}' - ); - } - - return self::$annotationSpecNameTemplate; - } - - private static function getDataItemNameTemplate() - { - if (self::$dataItemNameTemplate == null) { - self::$dataItemNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/datasets/{dataset}/dataItems/{data_item}' - ); - } - - return self::$dataItemNameTemplate; - } - - private static function getDatasetNameTemplate() - { - if (self::$datasetNameTemplate == null) { - self::$datasetNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/datasets/{dataset}' - ); - } - - return self::$datasetNameTemplate; - } - - private static function getDatasetVersionNameTemplate() - { - if (self::$datasetVersionNameTemplate == null) { - self::$datasetVersionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/datasets/{dataset}/datasetVersions/{dataset_version}' - ); - } - - return self::$datasetVersionNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getSavedQueryNameTemplate() - { - if (self::$savedQueryNameTemplate == null) { - self::$savedQueryNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/datasets/{dataset}/savedQueries/{saved_query}' - ); - } - - return self::$savedQueryNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'annotationSpec' => self::getAnnotationSpecNameTemplate(), - 'dataItem' => self::getDataItemNameTemplate(), - 'dataset' => self::getDatasetNameTemplate(), - 'datasetVersion' => self::getDatasetVersionNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'savedQuery' => self::getSavedQueryNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * annotation_spec resource. - * - * @param string $project - * @param string $location - * @param string $dataset - * @param string $annotationSpec - * - * @return string The formatted annotation_spec resource. - */ - public static function annotationSpecName( - $project, - $location, - $dataset, - $annotationSpec - ) { - return self::getAnnotationSpecNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'dataset' => $dataset, - 'annotation_spec' => $annotationSpec, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a data_item - * resource. - * - * @param string $project - * @param string $location - * @param string $dataset - * @param string $dataItem - * - * @return string The formatted data_item resource. - */ - public static function dataItemName( - $project, - $location, - $dataset, - $dataItem - ) { - return self::getDataItemNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'dataset' => $dataset, - 'data_item' => $dataItem, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a dataset - * resource. - * - * @param string $project - * @param string $location - * @param string $dataset - * - * @return string The formatted dataset resource. - */ - public static function datasetName($project, $location, $dataset) - { - return self::getDatasetNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'dataset' => $dataset, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * dataset_version resource. - * - * @param string $project - * @param string $location - * @param string $dataset - * @param string $datasetVersion - * - * @return string The formatted dataset_version resource. - */ - public static function datasetVersionName( - $project, - $location, - $dataset, - $datasetVersion - ) { - return self::getDatasetVersionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'dataset' => $dataset, - 'dataset_version' => $datasetVersion, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a saved_query - * resource. - * - * @param string $project - * @param string $location - * @param string $dataset - * @param string $savedQuery - * - * @return string The formatted saved_query resource. - */ - public static function savedQueryName( - $project, - $location, - $dataset, - $savedQuery - ) { - return self::getSavedQueryNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'dataset' => $dataset, - 'saved_query' => $savedQuery, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - annotationSpec: projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec} - * - dataItem: projects/{project}/locations/{location}/datasets/{dataset}/dataItems/{data_item} - * - dataset: projects/{project}/locations/{location}/datasets/{dataset} - * - datasetVersion: projects/{project}/locations/{location}/datasets/{dataset}/datasetVersions/{dataset_version} - * - location: projects/{project}/locations/{location} - * - savedQuery: projects/{project}/locations/{location}/datasets/{dataset}/savedQueries/{saved_query} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedParent = $datasetServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $dataset = new Dataset(); - * $operationResponse = $datasetServiceClient->createDataset($formattedParent, $dataset); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $datasetServiceClient->createDataset($formattedParent, $dataset); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $datasetServiceClient->resumeOperation($operationName, 'createDataset'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the Dataset in. - * Format: `projects/{project}/locations/{location}` - * @param Dataset $dataset Required. The Dataset to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createDataset($parent, $dataset, array $optionalArgs = []) - { - $request = new CreateDatasetRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDataset($dataset); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateDataset', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Create a version from a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedParent = $datasetServiceClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - * $datasetVersion = new DatasetVersion(); - * $operationResponse = $datasetServiceClient->createDatasetVersion($formattedParent, $datasetVersion); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $datasetServiceClient->createDatasetVersion($formattedParent, $datasetVersion); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $datasetServiceClient->resumeOperation($operationName, 'createDatasetVersion'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the Dataset resource. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}` - * @param DatasetVersion $datasetVersion Required. The version to be created. The same CMEK policies with the - * original Dataset will be applied the dataset version. So here we don't need - * to specify the EncryptionSpecType here. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createDatasetVersion( - $parent, - $datasetVersion, - array $optionalArgs = [] - ) { - $request = new CreateDatasetVersionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDatasetVersion($datasetVersion); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateDatasetVersion', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedName = $datasetServiceClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - * $operationResponse = $datasetServiceClient->deleteDataset($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $datasetServiceClient->deleteDataset($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $datasetServiceClient->resumeOperation($operationName, 'deleteDataset'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Dataset to delete. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteDataset($name, array $optionalArgs = []) - { - $request = new DeleteDatasetRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteDataset', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a Dataset version. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedName = $datasetServiceClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - * $operationResponse = $datasetServiceClient->deleteDatasetVersion($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $datasetServiceClient->deleteDatasetVersion($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $datasetServiceClient->resumeOperation($operationName, 'deleteDatasetVersion'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Dataset version to delete. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}/datasetVersions/{dataset_version}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteDatasetVersion($name, array $optionalArgs = []) - { - $request = new DeleteDatasetVersionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteDatasetVersion', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a SavedQuery. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedName = $datasetServiceClient->savedQueryName('[PROJECT]', '[LOCATION]', '[DATASET]', '[SAVED_QUERY]'); - * $operationResponse = $datasetServiceClient->deleteSavedQuery($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $datasetServiceClient->deleteSavedQuery($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $datasetServiceClient->resumeOperation($operationName, 'deleteSavedQuery'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the SavedQuery to delete. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}/savedQueries/{saved_query}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteSavedQuery($name, array $optionalArgs = []) - { - $request = new DeleteSavedQueryRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteSavedQuery', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Exports data from a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedName = $datasetServiceClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - * $exportConfig = new ExportDataConfig(); - * $operationResponse = $datasetServiceClient->exportData($formattedName, $exportConfig); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $datasetServiceClient->exportData($formattedName, $exportConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $datasetServiceClient->resumeOperation($operationName, 'exportData'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Dataset resource. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}` - * @param ExportDataConfig $exportConfig Required. The desired output location. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function exportData($name, $exportConfig, array $optionalArgs = []) - { - $request = new ExportDataRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setExportConfig($exportConfig); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'ExportData', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets an AnnotationSpec. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedName = $datasetServiceClient->annotationSpecName('[PROJECT]', '[LOCATION]', '[DATASET]', '[ANNOTATION_SPEC]'); - * $response = $datasetServiceClient->getAnnotationSpec($formattedName); - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the AnnotationSpec resource. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\AnnotationSpec - * - * @throws ApiException if the remote call fails - */ - public function getAnnotationSpec($name, array $optionalArgs = []) - { - $request = new GetAnnotationSpecRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetAnnotationSpec', - AnnotationSpec::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedName = $datasetServiceClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - * $response = $datasetServiceClient->getDataset($formattedName); - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Dataset resource. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Dataset - * - * @throws ApiException if the remote call fails - */ - public function getDataset($name, array $optionalArgs = []) - { - $request = new GetDatasetRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetDataset', - Dataset::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a Dataset version. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedName = $datasetServiceClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - * $response = $datasetServiceClient->getDatasetVersion($formattedName); - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Dataset version to delete. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}/datasetVersions/{dataset_version}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\DatasetVersion - * - * @throws ApiException if the remote call fails - */ - public function getDatasetVersion($name, array $optionalArgs = []) - { - $request = new GetDatasetVersionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetDatasetVersion', - DatasetVersion::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Imports data into a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedName = $datasetServiceClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - * $importConfigs = []; - * $operationResponse = $datasetServiceClient->importData($formattedName, $importConfigs); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $datasetServiceClient->importData($formattedName, $importConfigs); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $datasetServiceClient->resumeOperation($operationName, 'importData'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Dataset resource. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}` - * @param ImportDataConfig[] $importConfigs Required. The desired input locations. The contents of all input locations - * will be imported in one batch. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function importData($name, $importConfigs, array $optionalArgs = []) - { - $request = new ImportDataRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setImportConfigs($importConfigs); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'ImportData', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Lists Annotations belongs to a dataitem - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedParent = $datasetServiceClient->dataItemName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATA_ITEM]'); - * // Iterate over pages of elements - * $pagedResponse = $datasetServiceClient->listAnnotations($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $datasetServiceClient->listAnnotations($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the DataItem to list Annotations from. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}/dataItems/{data_item}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listAnnotations($parent, array $optionalArgs = []) - { - $request = new ListAnnotationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListAnnotations', - $optionalArgs, - ListAnnotationsResponse::class, - $request - ); - } - - /** - * Lists DataItems in a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedParent = $datasetServiceClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - * // Iterate over pages of elements - * $pagedResponse = $datasetServiceClient->listDataItems($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $datasetServiceClient->listDataItems($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Dataset to list DataItems from. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listDataItems($parent, array $optionalArgs = []) - { - $request = new ListDataItemsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListDataItems', - $optionalArgs, - ListDataItemsResponse::class, - $request - ); - } - - /** - * Lists DatasetVersions in a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedParent = $datasetServiceClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - * // Iterate over pages of elements - * $pagedResponse = $datasetServiceClient->listDatasetVersions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $datasetServiceClient->listDatasetVersions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Dataset to list DatasetVersions from. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Optional. Mask specifying which fields to read. - * @type string $orderBy - * Optional. A comma-separated list of fields to order by, sorted in ascending - * order. Use "desc" after a field name for descending. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listDatasetVersions($parent, array $optionalArgs = []) - { - $request = new ListDatasetVersionsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListDatasetVersions', - $optionalArgs, - ListDatasetVersionsResponse::class, - $request - ); - } - - /** - * Lists Datasets in a Location. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedParent = $datasetServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $datasetServiceClient->listDatasets($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $datasetServiceClient->listDatasets($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the Dataset's parent resource. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * An expression for filtering the results of the request. For field names - * both snake_case and camelCase are supported. - * - * * `display_name`: supports = and != - * * `metadata_schema_uri`: supports = and != - * * `labels` supports general map functions that is: - * * `labels.key=value` - key:value equality - * * `labels.key:* or labels:key - key existence - * * A key including a space must be quoted. `labels."a key"`. - * - * Some examples: - * - * * `displayName="myDisplayName"` - * * `labels.myKey="myValue"` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * Supported fields: - * - * * `display_name` - * * `create_time` - * * `update_time` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listDatasets($parent, array $optionalArgs = []) - { - $request = new ListDatasetsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListDatasets', - $optionalArgs, - ListDatasetsResponse::class, - $request - ); - } - - /** - * Lists SavedQueries in a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedParent = $datasetServiceClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - * // Iterate over pages of elements - * $pagedResponse = $datasetServiceClient->listSavedQueries($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $datasetServiceClient->listSavedQueries($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Dataset to list SavedQueries from. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSavedQueries($parent, array $optionalArgs = []) - { - $request = new ListSavedQueriesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListSavedQueries', - $optionalArgs, - ListSavedQueriesResponse::class, - $request - ); - } - - /** - * Restores a dataset version. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedName = $datasetServiceClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - * $operationResponse = $datasetServiceClient->restoreDatasetVersion($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $datasetServiceClient->restoreDatasetVersion($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $datasetServiceClient->resumeOperation($operationName, 'restoreDatasetVersion'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the DatasetVersion resource. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}/datasetVersions/{dataset_version}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function restoreDatasetVersion($name, array $optionalArgs = []) - { - $request = new RestoreDatasetVersionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'RestoreDatasetVersion', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Searches DataItems in a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $formattedDataset = $datasetServiceClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - * // Iterate over pages of elements - * $pagedResponse = $datasetServiceClient->searchDataItems($formattedDataset); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $datasetServiceClient->searchDataItems($formattedDataset); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $dataset Required. The resource name of the Dataset from which to search DataItems. - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}` - * @param array $optionalArgs { - * Optional. - * - * @type string $orderByDataItem - * A comma-separated list of data item fields to order by, sorted in - * ascending order. Use "desc" after a field name for descending. - * @type OrderByAnnotation $orderByAnnotation - * Expression that allows ranking results based on annotation's property. - * @type string $savedQuery - * The resource name of a SavedQuery(annotation set in UI). - * Format: - * `projects/{project}/locations/{location}/datasets/{dataset}/savedQueries/{saved_query}` - * All of the search will be done in the context of this SavedQuery. - * @type string $dataLabelingJob - * The resource name of a DataLabelingJob. - * Format: - * `projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}` - * If this field is set, all of the search will be done in the context of - * this DataLabelingJob. - * @type string $dataItemFilter - * An expression for filtering the DataItem that will be returned. - * - * * `data_item_id` - for = or !=. - * * `labeled` - for = or !=. - * * `has_annotation(ANNOTATION_SPEC_ID)` - true only for DataItem that - * have at least one annotation with annotation_spec_id = - * `ANNOTATION_SPEC_ID` in the context of SavedQuery or DataLabelingJob. - * - * For example: - * - * * `data_item=1` - * * `has_annotation(5)` - * @type string $annotationsFilter - * An expression for filtering the Annotations that will be returned per - * DataItem. - * * `annotation_spec_id` - for = or !=. - * @type string[] $annotationFilters - * An expression that specifies what Annotations will be returned per - * DataItem. Annotations satisfied either of the conditions will be returned. - * * `annotation_spec_id` - for = or !=. - * Must specify `saved_query_id=` - saved query id that annotations should - * belong to. - * @type FieldMask $fieldMask - * Mask specifying which fields of - * [DataItemView][google.cloud.aiplatform.v1.DataItemView] to read. - * @type int $annotationsLimit - * If set, only up to this many of Annotations will be returned per - * DataItemView. The maximum value is 1000. If not set, the maximum value will - * be used. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function searchDataItems($dataset, array $optionalArgs = []) - { - $request = new SearchDataItemsRequest(); - $requestParamHeaders = []; - $request->setDataset($dataset); - $requestParamHeaders['dataset'] = $dataset; - if (isset($optionalArgs['orderByDataItem'])) { - $request->setOrderByDataItem($optionalArgs['orderByDataItem']); - } - - if (isset($optionalArgs['orderByAnnotation'])) { - $request->setOrderByAnnotation($optionalArgs['orderByAnnotation']); - } - - if (isset($optionalArgs['savedQuery'])) { - $request->setSavedQuery($optionalArgs['savedQuery']); - } - - if (isset($optionalArgs['dataLabelingJob'])) { - $request->setDataLabelingJob($optionalArgs['dataLabelingJob']); - } - - if (isset($optionalArgs['dataItemFilter'])) { - $request->setDataItemFilter($optionalArgs['dataItemFilter']); - } - - if (isset($optionalArgs['annotationsFilter'])) { - $request->setAnnotationsFilter($optionalArgs['annotationsFilter']); - } - - if (isset($optionalArgs['annotationFilters'])) { - $request->setAnnotationFilters($optionalArgs['annotationFilters']); - } - - if (isset($optionalArgs['fieldMask'])) { - $request->setFieldMask($optionalArgs['fieldMask']); - } - - if (isset($optionalArgs['annotationsLimit'])) { - $request->setAnnotationsLimit($optionalArgs['annotationsLimit']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'SearchDataItems', - $optionalArgs, - SearchDataItemsResponse::class, - $request - ); - } - - /** - * Updates a Dataset. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $dataset = new Dataset(); - * $updateMask = new FieldMask(); - * $response = $datasetServiceClient->updateDataset($dataset, $updateMask); - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param Dataset $dataset Required. The Dataset which replaces the resource on the server. - * @param FieldMask $updateMask Required. The update mask applies to the resource. - * For the `FieldMask` definition, see - * [google.protobuf.FieldMask][google.protobuf.FieldMask]. Updatable fields: - * - * * `display_name` - * * `description` - * * `labels` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Dataset - * - * @throws ApiException if the remote call fails - */ - public function updateDataset( - $dataset, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateDatasetRequest(); - $requestParamHeaders = []; - $request->setDataset($dataset); - $request->setUpdateMask($updateMask); - $requestParamHeaders['dataset.name'] = $dataset->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateDataset', - Dataset::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates a DatasetVersion. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $datasetVersion = new DatasetVersion(); - * $updateMask = new FieldMask(); - * $response = $datasetServiceClient->updateDatasetVersion($datasetVersion, $updateMask); - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param DatasetVersion $datasetVersion Required. The DatasetVersion which replaces the resource on the server. - * @param FieldMask $updateMask Required. The update mask applies to the resource. - * For the `FieldMask` definition, see - * [google.protobuf.FieldMask][google.protobuf.FieldMask]. Updatable fields: - * - * * `display_name` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\DatasetVersion - * - * @throws ApiException if the remote call fails - */ - public function updateDatasetVersion( - $datasetVersion, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateDatasetVersionRequest(); - $requestParamHeaders = []; - $request->setDatasetVersion($datasetVersion); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'dataset_version.name' - ] = $datasetVersion->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateDatasetVersion', - DatasetVersion::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $response = $datasetServiceClient->getLocation(); - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $datasetServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $datasetServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $resource = 'resource'; - * $response = $datasetServiceClient->getIamPolicy($resource); - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $datasetServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $datasetServiceClient = new DatasetServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $datasetServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $datasetServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/DeploymentResourcePoolServiceGapicClient.php b/AiPlatform/src/V1/Gapic/DeploymentResourcePoolServiceGapicClient.php deleted file mode 100644 index 3f32b0e06653..000000000000 --- a/AiPlatform/src/V1/Gapic/DeploymentResourcePoolServiceGapicClient.php +++ /dev/null @@ -1,1129 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $deploymentResourcePool = new DeploymentResourcePool(); - * $deploymentResourcePoolId = 'deployment_resource_pool_id'; - * $operationResponse = $deploymentResourcePoolServiceClient->createDeploymentResourcePool($formattedParent, $deploymentResourcePool, $deploymentResourcePoolId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $deploymentResourcePoolServiceClient->createDeploymentResourcePool($formattedParent, $deploymentResourcePool, $deploymentResourcePoolId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $deploymentResourcePoolServiceClient->resumeOperation($operationName, 'createDeploymentResourcePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\DeploymentResourcePoolServiceClient}. - */ -class DeploymentResourcePoolServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.DeploymentResourcePoolService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $deploymentResourcePoolNameTemplate; - - private static $locationNameTemplate; - - private static $projectNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/deployment_resource_pool_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/deployment_resource_pool_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/deployment_resource_pool_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/deployment_resource_pool_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getDeploymentResourcePoolNameTemplate() - { - if (self::$deploymentResourcePoolNameTemplate == null) { - self::$deploymentResourcePoolNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool}' - ); - } - - return self::$deploymentResourcePoolNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getProjectNameTemplate() - { - if (self::$projectNameTemplate == null) { - self::$projectNameTemplate = new PathTemplate('projects/{project}'); - } - - return self::$projectNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'deploymentResourcePool' => self::getDeploymentResourcePoolNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'project' => self::getProjectNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * deployment_resource_pool resource. - * - * @param string $project - * @param string $location - * @param string $deploymentResourcePool - * - * @return string The formatted deployment_resource_pool resource. - */ - public static function deploymentResourcePoolName( - $project, - $location, - $deploymentResourcePool - ) { - return self::getDeploymentResourcePoolNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'deployment_resource_pool' => $deploymentResourcePool, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName($project) - { - return self::getProjectNameTemplate()->render([ - 'project' => $project, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - deploymentResourcePool: projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool} - * - location: projects/{project}/locations/{location} - * - project: projects/{project} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Create a DeploymentResourcePool. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * $formattedParent = $deploymentResourcePoolServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $deploymentResourcePool = new DeploymentResourcePool(); - * $deploymentResourcePoolId = 'deployment_resource_pool_id'; - * $operationResponse = $deploymentResourcePoolServiceClient->createDeploymentResourcePool($formattedParent, $deploymentResourcePool, $deploymentResourcePoolId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $deploymentResourcePoolServiceClient->createDeploymentResourcePool($formattedParent, $deploymentResourcePool, $deploymentResourcePoolId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $deploymentResourcePoolServiceClient->resumeOperation($operationName, 'createDeploymentResourcePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location resource where this DeploymentResourcePool - * will be created. Format: `projects/{project}/locations/{location}` - * @param DeploymentResourcePool $deploymentResourcePool Required. The DeploymentResourcePool to create. - * @param string $deploymentResourcePoolId Required. The ID to use for the DeploymentResourcePool, which - * will become the final component of the DeploymentResourcePool's resource - * name. - * - * The maximum length is 63 characters, and valid characters - * are `/^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createDeploymentResourcePool( - $parent, - $deploymentResourcePool, - $deploymentResourcePoolId, - array $optionalArgs = [] - ) { - $request = new CreateDeploymentResourcePoolRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDeploymentResourcePool($deploymentResourcePool); - $request->setDeploymentResourcePoolId($deploymentResourcePoolId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateDeploymentResourcePool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Delete a DeploymentResourcePool. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * $formattedName = $deploymentResourcePoolServiceClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - * $operationResponse = $deploymentResourcePoolServiceClient->deleteDeploymentResourcePool($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $deploymentResourcePoolServiceClient->deleteDeploymentResourcePool($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $deploymentResourcePoolServiceClient->resumeOperation($operationName, 'deleteDeploymentResourcePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the DeploymentResourcePool to delete. - * Format: - * `projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteDeploymentResourcePool( - $name, - array $optionalArgs = [] - ) { - $request = new DeleteDeploymentResourcePoolRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteDeploymentResourcePool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Get a DeploymentResourcePool. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * $formattedName = $deploymentResourcePoolServiceClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - * $response = $deploymentResourcePoolServiceClient->getDeploymentResourcePool($formattedName); - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the DeploymentResourcePool to retrieve. - * Format: - * `projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\DeploymentResourcePool - * - * @throws ApiException if the remote call fails - */ - public function getDeploymentResourcePool($name, array $optionalArgs = []) - { - $request = new GetDeploymentResourcePoolRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetDeploymentResourcePool', - DeploymentResourcePool::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * List DeploymentResourcePools in a location. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * $formattedParent = $deploymentResourcePoolServiceClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $deploymentResourcePoolServiceClient->listDeploymentResourcePools($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $deploymentResourcePoolServiceClient->listDeploymentResourcePools($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent Location which owns this collection of - * DeploymentResourcePools. Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listDeploymentResourcePools( - $parent, - array $optionalArgs = [] - ) { - $request = new ListDeploymentResourcePoolsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListDeploymentResourcePools', - $optionalArgs, - ListDeploymentResourcePoolsResponse::class, - $request - ); - } - - /** - * List DeployedModels that have been deployed on this DeploymentResourcePool. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * $deploymentResourcePool = 'deployment_resource_pool'; - * // Iterate over pages of elements - * $pagedResponse = $deploymentResourcePoolServiceClient->queryDeployedModels($deploymentResourcePool); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $deploymentResourcePoolServiceClient->queryDeployedModels($deploymentResourcePool); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param string $deploymentResourcePool Required. The name of the target DeploymentResourcePool to query. - * Format: - * `projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function queryDeployedModels( - $deploymentResourcePool, - array $optionalArgs = [] - ) { - $request = new QueryDeployedModelsRequest(); - $requestParamHeaders = []; - $request->setDeploymentResourcePool($deploymentResourcePool); - $requestParamHeaders[ - 'deployment_resource_pool' - ] = $deploymentResourcePool; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'QueryDeployedModels', - $optionalArgs, - QueryDeployedModelsResponse::class, - $request - ); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * $response = $deploymentResourcePoolServiceClient->getLocation(); - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $deploymentResourcePoolServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $deploymentResourcePoolServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * $resource = 'resource'; - * $response = $deploymentResourcePoolServiceClient->getIamPolicy($resource); - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $deploymentResourcePoolServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $deploymentResourcePoolServiceClient = new DeploymentResourcePoolServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $deploymentResourcePoolServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $deploymentResourcePoolServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/EndpointServiceGapicClient.php b/AiPlatform/src/V1/Gapic/EndpointServiceGapicClient.php deleted file mode 100644 index 969ccd96c01f..000000000000 --- a/AiPlatform/src/V1/Gapic/EndpointServiceGapicClient.php +++ /dev/null @@ -1,1631 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $endpoint = new Endpoint(); - * $operationResponse = $endpointServiceClient->createEndpoint($formattedParent, $endpoint); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $endpointServiceClient->createEndpoint($formattedParent, $endpoint); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $endpointServiceClient->resumeOperation($operationName, 'createEndpoint'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\EndpointServiceClient}. - */ -class EndpointServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.EndpointService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $deploymentResourcePoolNameTemplate; - - private static $endpointNameTemplate; - - private static $locationNameTemplate; - - private static $modelNameTemplate; - - private static $modelDeploymentMonitoringJobNameTemplate; - - private static $networkNameTemplate; - - private static $projectLocationEndpointNameTemplate; - - private static $projectLocationPublisherModelNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/endpoint_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/endpoint_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/endpoint_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/endpoint_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getDeploymentResourcePoolNameTemplate() - { - if (self::$deploymentResourcePoolNameTemplate == null) { - self::$deploymentResourcePoolNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool}' - ); - } - - return self::$deploymentResourcePoolNameTemplate; - } - - private static function getEndpointNameTemplate() - { - if (self::$endpointNameTemplate == null) { - self::$endpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$endpointNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getModelNameTemplate() - { - if (self::$modelNameTemplate == null) { - self::$modelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/models/{model}' - ); - } - - return self::$modelNameTemplate; - } - - private static function getModelDeploymentMonitoringJobNameTemplate() - { - if (self::$modelDeploymentMonitoringJobNameTemplate == null) { - self::$modelDeploymentMonitoringJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}' - ); - } - - return self::$modelDeploymentMonitoringJobNameTemplate; - } - - private static function getNetworkNameTemplate() - { - if (self::$networkNameTemplate == null) { - self::$networkNameTemplate = new PathTemplate( - 'projects/{project}/global/networks/{network}' - ); - } - - return self::$networkNameTemplate; - } - - private static function getProjectLocationEndpointNameTemplate() - { - if (self::$projectLocationEndpointNameTemplate == null) { - self::$projectLocationEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$projectLocationEndpointNameTemplate; - } - - private static function getProjectLocationPublisherModelNameTemplate() - { - if (self::$projectLocationPublisherModelNameTemplate == null) { - self::$projectLocationPublisherModelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/publishers/{publisher}/models/{model}' - ); - } - - return self::$projectLocationPublisherModelNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'deploymentResourcePool' => self::getDeploymentResourcePoolNameTemplate(), - 'endpoint' => self::getEndpointNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'model' => self::getModelNameTemplate(), - 'modelDeploymentMonitoringJob' => self::getModelDeploymentMonitoringJobNameTemplate(), - 'network' => self::getNetworkNameTemplate(), - 'projectLocationEndpoint' => self::getProjectLocationEndpointNameTemplate(), - 'projectLocationPublisherModel' => self::getProjectLocationPublisherModelNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * deployment_resource_pool resource. - * - * @param string $project - * @param string $location - * @param string $deploymentResourcePool - * - * @return string The formatted deployment_resource_pool resource. - */ - public static function deploymentResourcePoolName( - $project, - $location, - $deploymentResourcePool - ) { - return self::getDeploymentResourcePoolNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'deployment_resource_pool' => $deploymentResourcePool, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a endpoint - * resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted endpoint resource. - */ - public static function endpointName($project, $location, $endpoint) - { - return self::getEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName($project, $location, $model) - { - return self::getModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * model_deployment_monitoring_job resource. - * - * @param string $project - * @param string $location - * @param string $modelDeploymentMonitoringJob - * - * @return string The formatted model_deployment_monitoring_job resource. - */ - public static function modelDeploymentMonitoringJobName( - $project, - $location, - $modelDeploymentMonitoringJob - ) { - return self::getModelDeploymentMonitoringJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model_deployment_monitoring_job' => $modelDeploymentMonitoringJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a network - * resource. - * - * @param string $project - * @param string $network - * - * @return string The formatted network resource. - */ - public static function networkName($project, $network) - { - return self::getNetworkNameTemplate()->render([ - 'project' => $project, - 'network' => $network, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted project_location_endpoint resource. - */ - public static function projectLocationEndpointName( - $project, - $location, - $endpoint - ) { - return self::getProjectLocationEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_publisher_model resource. - * - * @param string $project - * @param string $location - * @param string $publisher - * @param string $model - * - * @return string The formatted project_location_publisher_model resource. - */ - public static function projectLocationPublisherModelName( - $project, - $location, - $publisher, - $model - ) { - return self::getProjectLocationPublisherModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'publisher' => $publisher, - 'model' => $model, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - deploymentResourcePool: projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool} - * - endpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - location: projects/{project}/locations/{location} - * - model: projects/{project}/locations/{location}/models/{model} - * - modelDeploymentMonitoringJob: projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job} - * - network: projects/{project}/global/networks/{network} - * - projectLocationEndpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - projectLocationPublisherModel: projects/{project}/locations/{location}/publishers/{publisher}/models/{model} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates an Endpoint. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $formattedParent = $endpointServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $endpoint = new Endpoint(); - * $operationResponse = $endpointServiceClient->createEndpoint($formattedParent, $endpoint); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $endpointServiceClient->createEndpoint($formattedParent, $endpoint); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $endpointServiceClient->resumeOperation($operationName, 'createEndpoint'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the Endpoint in. - * Format: `projects/{project}/locations/{location}` - * @param Endpoint $endpoint Required. The Endpoint to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $endpointId - * Immutable. The ID to use for endpoint, which will become the final - * component of the endpoint resource name. - * If not provided, Vertex AI will generate a value for this ID. - * - * If the first character is a letter, this value may be up to 63 characters, - * and valid characters are `[a-z0-9-]`. The last character must be a letter - * or number. - * - * If the first character is a number, this value may be up to 9 characters, - * and valid characters are `[0-9]` with no leading zeros. - * - * When using HTTP/JSON, this field is populated - * based on a query string argument, such as `?endpoint_id=12345`. This is the - * fallback for fields that are not included in either the URI or the body. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createEndpoint($parent, $endpoint, array $optionalArgs = []) - { - $request = new CreateEndpointRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setEndpoint($endpoint); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['endpointId'])) { - $request->setEndpointId($optionalArgs['endpointId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateEndpoint', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes an Endpoint. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $formattedName = $endpointServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $operationResponse = $endpointServiceClient->deleteEndpoint($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $endpointServiceClient->deleteEndpoint($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $endpointServiceClient->resumeOperation($operationName, 'deleteEndpoint'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Endpoint resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteEndpoint($name, array $optionalArgs = []) - { - $request = new DeleteEndpointRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteEndpoint', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deploys a Model into this Endpoint, creating a DeployedModel within it. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $formattedEndpoint = $endpointServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $deployedModel = new DeployedModel(); - * $operationResponse = $endpointServiceClient->deployModel($formattedEndpoint, $deployedModel); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $endpointServiceClient->deployModel($formattedEndpoint, $deployedModel); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $endpointServiceClient->resumeOperation($operationName, 'deployModel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint resource into which to deploy a Model. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param DeployedModel $deployedModel Required. The DeployedModel to be created within the Endpoint. Note that - * [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] - * must be updated for the DeployedModel to start receiving traffic, either as - * part of this call, or via - * [EndpointService.UpdateEndpoint][google.cloud.aiplatform.v1.EndpointService.UpdateEndpoint]. - * @param array $optionalArgs { - * Optional. - * - * @type array $trafficSplit - * A map from a DeployedModel's ID to the percentage of this Endpoint's - * traffic that should be forwarded to that DeployedModel. - * - * If this field is non-empty, then the Endpoint's - * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] will be - * overwritten with it. To refer to the ID of the just being deployed Model, a - * "0" should be used, and the actual ID of the new DeployedModel will be - * filled in its place by this method. The traffic percentage values must add - * up to 100. - * - * If this field is empty, then the Endpoint's - * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] is not - * updated. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deployModel( - $endpoint, - $deployedModel, - array $optionalArgs = [] - ) { - $request = new DeployModelRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $request->setDeployedModel($deployedModel); - $requestParamHeaders['endpoint'] = $endpoint; - if (isset($optionalArgs['trafficSplit'])) { - $request->setTrafficSplit($optionalArgs['trafficSplit']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeployModel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets an Endpoint. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $formattedName = $endpointServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $response = $endpointServiceClient->getEndpoint($formattedName); - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Endpoint resource. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Endpoint - * - * @throws ApiException if the remote call fails - */ - public function getEndpoint($name, array $optionalArgs = []) - { - $request = new GetEndpointRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetEndpoint', - Endpoint::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists Endpoints in a Location. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $formattedParent = $endpointServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $endpointServiceClient->listEndpoints($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $endpointServiceClient->listEndpoints($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location from which to list the - * Endpoints. Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. An expression for filtering the results of the request. For field - * names both snake_case and camelCase are supported. - * - * * `endpoint` supports `=` and `!=`. `endpoint` represents the Endpoint - * ID, i.e. the last segment of the Endpoint's - * [resource name][google.cloud.aiplatform.v1.Endpoint.name]. - * * `display_name` supports `=` and `!=`. - * * `labels` supports general map functions that is: - * * `labels.key=value` - key:value equality - * * `labels.key:*` or `labels:key` - key existence - * * A key including a space must be quoted. `labels."a key"`. - * * `base_model_name` only supports `=`. - * - * Some examples: - * - * * `endpoint=1` - * * `displayName="myDisplayName"` - * * `labels.myKey="myValue"` - * * `baseModelName="text-bison"` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Optional. Mask specifying which fields to read. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * Supported fields: - * - * * `display_name` - * * `create_time` - * * `update_time` - * - * Example: `display_name, create_time desc`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listEndpoints($parent, array $optionalArgs = []) - { - $request = new ListEndpointsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListEndpoints', - $optionalArgs, - ListEndpointsResponse::class, - $request - ); - } - - /** - * Updates an existing deployed model. Updatable fields include - * `min_replica_count`, `max_replica_count`, `autoscaling_metric_specs`, - * `disable_container_logging` (v1 only), and `enable_container_logging` - * (v1beta1 only). - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $formattedEndpoint = $endpointServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $deployedModel = new DeployedModel(); - * $updateMask = new FieldMask(); - * $operationResponse = $endpointServiceClient->mutateDeployedModel($formattedEndpoint, $deployedModel, $updateMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $endpointServiceClient->mutateDeployedModel($formattedEndpoint, $deployedModel, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $endpointServiceClient->resumeOperation($operationName, 'mutateDeployedModel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint resource into which to mutate a - * DeployedModel. Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param DeployedModel $deployedModel Required. The DeployedModel to be mutated within the Endpoint. Only the - * following fields can be mutated: - * - * * `min_replica_count` in either - * [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources] or - * [AutomaticResources][google.cloud.aiplatform.v1.AutomaticResources] - * * `max_replica_count` in either - * [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources] or - * [AutomaticResources][google.cloud.aiplatform.v1.AutomaticResources] - * * [autoscaling_metric_specs][google.cloud.aiplatform.v1.DedicatedResources.autoscaling_metric_specs] - * * `disable_container_logging` (v1 only) - * * `enable_container_logging` (v1beta1 only) - * @param FieldMask $updateMask Required. The update mask applies to the resource. See - * [google.protobuf.FieldMask][google.protobuf.FieldMask]. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function mutateDeployedModel( - $endpoint, - $deployedModel, - $updateMask, - array $optionalArgs = [] - ) { - $request = new MutateDeployedModelRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $request->setDeployedModel($deployedModel); - $request->setUpdateMask($updateMask); - $requestParamHeaders['endpoint'] = $endpoint; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'MutateDeployedModel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Undeploys a Model from an Endpoint, removing a DeployedModel from it, and - * freeing all resources it's using. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $formattedEndpoint = $endpointServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $deployedModelId = 'deployed_model_id'; - * $operationResponse = $endpointServiceClient->undeployModel($formattedEndpoint, $deployedModelId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $endpointServiceClient->undeployModel($formattedEndpoint, $deployedModelId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $endpointServiceClient->resumeOperation($operationName, 'undeployModel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint resource from which to undeploy a Model. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param string $deployedModelId Required. The ID of the DeployedModel to be undeployed from the Endpoint. - * @param array $optionalArgs { - * Optional. - * - * @type array $trafficSplit - * If this field is provided, then the Endpoint's - * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] will be - * overwritten with it. If last DeployedModel is being undeployed from the - * Endpoint, the [Endpoint.traffic_split] will always end up empty when this - * call returns. A DeployedModel will be successfully undeployed only if it - * doesn't have any traffic assigned to it when this method executes, or if - * this field unassigns any traffic to it. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function undeployModel( - $endpoint, - $deployedModelId, - array $optionalArgs = [] - ) { - $request = new UndeployModelRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $request->setDeployedModelId($deployedModelId); - $requestParamHeaders['endpoint'] = $endpoint; - if (isset($optionalArgs['trafficSplit'])) { - $request->setTrafficSplit($optionalArgs['trafficSplit']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UndeployModel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates an Endpoint. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $endpoint = new Endpoint(); - * $updateMask = new FieldMask(); - * $response = $endpointServiceClient->updateEndpoint($endpoint, $updateMask); - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param Endpoint $endpoint Required. The Endpoint which replaces the resource on the server. - * @param FieldMask $updateMask Required. The update mask applies to the resource. See - * [google.protobuf.FieldMask][google.protobuf.FieldMask]. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Endpoint - * - * @throws ApiException if the remote call fails - */ - public function updateEndpoint( - $endpoint, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateEndpointRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $request->setUpdateMask($updateMask); - $requestParamHeaders['endpoint.name'] = $endpoint->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateEndpoint', - Endpoint::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $response = $endpointServiceClient->getLocation(); - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $endpointServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $endpointServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $resource = 'resource'; - * $response = $endpointServiceClient->getIamPolicy($resource); - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $endpointServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $endpointServiceClient = new EndpointServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $endpointServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $endpointServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/FeatureOnlineStoreAdminServiceGapicClient.php b/AiPlatform/src/V1/Gapic/FeatureOnlineStoreAdminServiceGapicClient.php deleted file mode 100644 index 82b4e2a57e97..000000000000 --- a/AiPlatform/src/V1/Gapic/FeatureOnlineStoreAdminServiceGapicClient.php +++ /dev/null @@ -1,1884 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $featureOnlineStore = new FeatureOnlineStore(); - * $featureOnlineStoreId = 'feature_online_store_id'; - * $operationResponse = $featureOnlineStoreAdminServiceClient->createFeatureOnlineStore($formattedParent, $featureOnlineStore, $featureOnlineStoreId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureOnlineStoreAdminServiceClient->createFeatureOnlineStore($formattedParent, $featureOnlineStore, $featureOnlineStoreId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureOnlineStoreAdminServiceClient->resumeOperation($operationName, 'createFeatureOnlineStore'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\FeatureOnlineStoreAdminServiceClient}. - */ -class FeatureOnlineStoreAdminServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $featureOnlineStoreNameTemplate; - - private static $featureViewNameTemplate; - - private static $featureViewSyncNameTemplate; - - private static $locationNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/feature_online_store_admin_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/feature_online_store_admin_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/feature_online_store_admin_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/feature_online_store_admin_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getFeatureOnlineStoreNameTemplate() - { - if (self::$featureOnlineStoreNameTemplate == null) { - self::$featureOnlineStoreNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}' - ); - } - - return self::$featureOnlineStoreNameTemplate; - } - - private static function getFeatureViewNameTemplate() - { - if (self::$featureViewNameTemplate == null) { - self::$featureViewNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}' - ); - } - - return self::$featureViewNameTemplate; - } - - private static function getFeatureViewSyncNameTemplate() - { - if (self::$featureViewSyncNameTemplate == null) { - self::$featureViewSyncNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}/featureViewSyncs/feature_view_sync' - ); - } - - return self::$featureViewSyncNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'featureOnlineStore' => self::getFeatureOnlineStoreNameTemplate(), - 'featureView' => self::getFeatureViewNameTemplate(), - 'featureViewSync' => self::getFeatureViewSyncNameTemplate(), - 'location' => self::getLocationNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * feature_online_store resource. - * - * @param string $project - * @param string $location - * @param string $featureOnlineStore - * - * @return string The formatted feature_online_store resource. - */ - public static function featureOnlineStoreName( - $project, - $location, - $featureOnlineStore - ) { - return self::getFeatureOnlineStoreNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'feature_online_store' => $featureOnlineStore, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a feature_view - * resource. - * - * @param string $project - * @param string $location - * @param string $featureOnlineStore - * @param string $featureView - * - * @return string The formatted feature_view resource. - */ - public static function featureViewName( - $project, - $location, - $featureOnlineStore, - $featureView - ) { - return self::getFeatureViewNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'feature_online_store' => $featureOnlineStore, - 'feature_view' => $featureView, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * feature_view_sync resource. - * - * @param string $project - * @param string $location - * @param string $featureOnlineStore - * @param string $featureView - * - * @return string The formatted feature_view_sync resource. - */ - public static function featureViewSyncName( - $project, - $location, - $featureOnlineStore, - $featureView - ) { - return self::getFeatureViewSyncNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'feature_online_store' => $featureOnlineStore, - 'feature_view' => $featureView, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - featureOnlineStore: projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store} - * - featureView: projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view} - * - featureViewSync: projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}/featureViewSyncs/feature_view_sync - * - location: projects/{project}/locations/{location} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates a new FeatureOnlineStore in a given project and location. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedParent = $featureOnlineStoreAdminServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $featureOnlineStore = new FeatureOnlineStore(); - * $featureOnlineStoreId = 'feature_online_store_id'; - * $operationResponse = $featureOnlineStoreAdminServiceClient->createFeatureOnlineStore($formattedParent, $featureOnlineStore, $featureOnlineStoreId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureOnlineStoreAdminServiceClient->createFeatureOnlineStore($formattedParent, $featureOnlineStore, $featureOnlineStoreId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureOnlineStoreAdminServiceClient->resumeOperation($operationName, 'createFeatureOnlineStore'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create FeatureOnlineStores. - * Format: - * `projects/{project}/locations/{location}` - * @param FeatureOnlineStore $featureOnlineStore Required. The FeatureOnlineStore to create. - * @param string $featureOnlineStoreId Required. The ID to use for this FeatureOnlineStore, which will become the - * final component of the FeatureOnlineStore's resource name. - * - * This value may be up to 60 characters, and valid characters are - * `[a-z0-9_]`. The first character cannot be a number. - * - * The value must be unique within the project and location. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createFeatureOnlineStore( - $parent, - $featureOnlineStore, - $featureOnlineStoreId, - array $optionalArgs = [] - ) { - $request = new CreateFeatureOnlineStoreRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFeatureOnlineStore($featureOnlineStore); - $request->setFeatureOnlineStoreId($featureOnlineStoreId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateFeatureOnlineStore', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new FeatureView in a given FeatureOnlineStore. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedParent = $featureOnlineStoreAdminServiceClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - * $featureView = new FeatureView(); - * $featureViewId = 'feature_view_id'; - * $operationResponse = $featureOnlineStoreAdminServiceClient->createFeatureView($formattedParent, $featureView, $featureViewId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureOnlineStoreAdminServiceClient->createFeatureView($formattedParent, $featureView, $featureViewId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureOnlineStoreAdminServiceClient->resumeOperation($operationName, 'createFeatureView'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the FeatureOnlineStore to create - * FeatureViews. Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}` - * @param FeatureView $featureView Required. The FeatureView to create. - * @param string $featureViewId Required. The ID to use for the FeatureView, which will become the final - * component of the FeatureView's resource name. - * - * This value may be up to 60 characters, and valid characters are - * `[a-z0-9_]`. The first character cannot be a number. - * - * The value must be unique within a FeatureOnlineStore. - * @param array $optionalArgs { - * Optional. - * - * @type bool $runSyncImmediately - * Immutable. If set to true, one on demand sync will be run immediately, - * regardless whether the - * [FeatureView.sync_config][google.cloud.aiplatform.v1.FeatureView.sync_config] - * is configured or not. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createFeatureView( - $parent, - $featureView, - $featureViewId, - array $optionalArgs = [] - ) { - $request = new CreateFeatureViewRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFeatureView($featureView); - $request->setFeatureViewId($featureViewId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['runSyncImmediately'])) { - $request->setRunSyncImmediately( - $optionalArgs['runSyncImmediately'] - ); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateFeatureView', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not - * contain any FeatureViews. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedName = $featureOnlineStoreAdminServiceClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - * $operationResponse = $featureOnlineStoreAdminServiceClient->deleteFeatureOnlineStore($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureOnlineStoreAdminServiceClient->deleteFeatureOnlineStore($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureOnlineStoreAdminServiceClient->resumeOperation($operationName, 'deleteFeatureOnlineStore'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the FeatureOnlineStore to be deleted. - * Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}` - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * If set to true, any FeatureViews and Features for this FeatureOnlineStore - * will also be deleted. (Otherwise, the request will only work if the - * FeatureOnlineStore has no FeatureViews.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFeatureOnlineStore($name, array $optionalArgs = []) - { - $request = new DeleteFeatureOnlineStoreRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteFeatureOnlineStore', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single FeatureView. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedName = $featureOnlineStoreAdminServiceClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - * $operationResponse = $featureOnlineStoreAdminServiceClient->deleteFeatureView($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureOnlineStoreAdminServiceClient->deleteFeatureView($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureOnlineStoreAdminServiceClient->resumeOperation($operationName, 'deleteFeatureView'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the FeatureView to be deleted. - * Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFeatureView($name, array $optionalArgs = []) - { - $request = new DeleteFeatureViewRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteFeatureView', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets details of a single FeatureOnlineStore. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedName = $featureOnlineStoreAdminServiceClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - * $response = $featureOnlineStoreAdminServiceClient->getFeatureOnlineStore($formattedName); - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the FeatureOnlineStore resource. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\FeatureOnlineStore - * - * @throws ApiException if the remote call fails - */ - public function getFeatureOnlineStore($name, array $optionalArgs = []) - { - $request = new GetFeatureOnlineStoreRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetFeatureOnlineStore', - FeatureOnlineStore::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single FeatureView. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedName = $featureOnlineStoreAdminServiceClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - * $response = $featureOnlineStoreAdminServiceClient->getFeatureView($formattedName); - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the FeatureView resource. - * Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\FeatureView - * - * @throws ApiException if the remote call fails - */ - public function getFeatureView($name, array $optionalArgs = []) - { - $request = new GetFeatureViewRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetFeatureView', - FeatureView::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single FeatureViewSync. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedName = $featureOnlineStoreAdminServiceClient->featureViewSyncName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - * $response = $featureOnlineStoreAdminServiceClient->getFeatureViewSync($formattedName); - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the FeatureViewSync resource. - * Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}/featureViewSyncs/{feature_view_sync}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\FeatureViewSync - * - * @throws ApiException if the remote call fails - */ - public function getFeatureViewSync($name, array $optionalArgs = []) - { - $request = new GetFeatureViewSyncRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetFeatureViewSync', - FeatureViewSync::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists FeatureOnlineStores in a given project and location. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedParent = $featureOnlineStoreAdminServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $featureOnlineStoreAdminServiceClient->listFeatureOnlineStores($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featureOnlineStoreAdminServiceClient->listFeatureOnlineStores($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list FeatureOnlineStores. - * Format: - * `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the FeatureOnlineStores that match the filter expression. The - * following fields are supported: - * - * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be - * in RFC 3339 format. - * * `update_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be - * in RFC 3339 format. - * * `labels`: Supports key-value equality and key presence. - * - * Examples: - * - * * `create_time > "2020-01-01" OR update_time > "2020-01-01"` - * FeatureOnlineStores created or updated after 2020-01-01. - * * `labels.env = "prod"` - * FeatureOnlineStores with label "env" set to "prod". - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * Supported Fields: - * - * * `create_time` - * * `update_time` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listFeatureOnlineStores($parent, array $optionalArgs = []) - { - $request = new ListFeatureOnlineStoresRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListFeatureOnlineStores', - $optionalArgs, - ListFeatureOnlineStoresResponse::class, - $request - ); - } - - /** - * Lists FeatureViewSyncs in a given FeatureView. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedParent = $featureOnlineStoreAdminServiceClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - * // Iterate over pages of elements - * $pagedResponse = $featureOnlineStoreAdminServiceClient->listFeatureViewSyncs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featureOnlineStoreAdminServiceClient->listFeatureViewSyncs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the FeatureView to list FeatureViewSyncs. - * Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the FeatureViewSyncs that match the filter expression. The following - * filters are supported: - * - * * `create_time`: Supports `=`, `!=`, `<`, `>`, `>=`, and `<=` comparisons. - * Values must be in RFC 3339 format. - * - * Examples: - * - * * `create_time > \"2020-01-31T15:30:00.000000Z\"` --> FeatureViewSyncs - * created after 2020-01-31T15:30:00.000000Z. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * - * Supported fields: - * - * * `create_time` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listFeatureViewSyncs($parent, array $optionalArgs = []) - { - $request = new ListFeatureViewSyncsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListFeatureViewSyncs', - $optionalArgs, - ListFeatureViewSyncsResponse::class, - $request - ); - } - - /** - * Lists FeatureViews in a given FeatureOnlineStore. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedParent = $featureOnlineStoreAdminServiceClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - * // Iterate over pages of elements - * $pagedResponse = $featureOnlineStoreAdminServiceClient->listFeatureViews($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featureOnlineStoreAdminServiceClient->listFeatureViews($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the FeatureOnlineStore to list FeatureViews. - * Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the FeatureViews that match the filter expression. The following - * filters are supported: - * - * * `create_time`: Supports `=`, `!=`, `<`, `>`, `>=`, and `<=` comparisons. - * Values must be in RFC 3339 format. - * * `update_time`: Supports `=`, `!=`, `<`, `>`, `>=`, and `<=` comparisons. - * Values must be in RFC 3339 format. - * * `labels`: Supports key-value equality as well as key presence. - * - * Examples: - * - * * `create_time > \"2020-01-31T15:30:00.000000Z\" OR - * update_time > \"2020-01-31T15:30:00.000000Z\"` --> FeatureViews - * created or updated after 2020-01-31T15:30:00.000000Z. - * * `labels.active = yes AND labels.env = prod` --> FeatureViews having both - * (active: yes) and (env: prod) labels. - * * `labels.env: *` --> Any FeatureView which has a label with 'env' as the - * key. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * - * Supported fields: - * - * * `feature_view_id` - * * `create_time` - * * `update_time` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listFeatureViews($parent, array $optionalArgs = []) - { - $request = new ListFeatureViewsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListFeatureViews', - $optionalArgs, - ListFeatureViewsResponse::class, - $request - ); - } - - /** - * Triggers on-demand sync for the FeatureView. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $formattedFeatureView = $featureOnlineStoreAdminServiceClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - * $response = $featureOnlineStoreAdminServiceClient->syncFeatureView($formattedFeatureView); - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $featureView Required. Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\SyncFeatureViewResponse - * - * @throws ApiException if the remote call fails - */ - public function syncFeatureView($featureView, array $optionalArgs = []) - { - $request = new SyncFeatureViewRequest(); - $requestParamHeaders = []; - $request->setFeatureView($featureView); - $requestParamHeaders['feature_view'] = $featureView; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SyncFeatureView', - SyncFeatureViewResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates the parameters of a single FeatureOnlineStore. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $featureOnlineStore = new FeatureOnlineStore(); - * $operationResponse = $featureOnlineStoreAdminServiceClient->updateFeatureOnlineStore($featureOnlineStore); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureOnlineStoreAdminServiceClient->updateFeatureOnlineStore($featureOnlineStore); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureOnlineStoreAdminServiceClient->resumeOperation($operationName, 'updateFeatureOnlineStore'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param FeatureOnlineStore $featureOnlineStore Required. The FeatureOnlineStore's `name` field is used to identify the - * FeatureOnlineStore to be updated. Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * FeatureOnlineStore resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then only the non-empty fields present in the - * request will be overwritten. Set the update_mask to `*` to override all - * fields. - * - * Updatable fields: - * - * * `big_query_source` - * * `bigtable` - * * `labels` - * * `sync_config` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateFeatureOnlineStore( - $featureOnlineStore, - array $optionalArgs = [] - ) { - $request = new UpdateFeatureOnlineStoreRequest(); - $requestParamHeaders = []; - $request->setFeatureOnlineStore($featureOnlineStore); - $requestParamHeaders[ - 'feature_online_store.name' - ] = $featureOnlineStore->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateFeatureOnlineStore', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single FeatureView. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $featureView = new FeatureView(); - * $operationResponse = $featureOnlineStoreAdminServiceClient->updateFeatureView($featureView); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureOnlineStoreAdminServiceClient->updateFeatureView($featureView); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureOnlineStoreAdminServiceClient->resumeOperation($operationName, 'updateFeatureView'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param FeatureView $featureView Required. The FeatureView's `name` field is used to identify the - * FeatureView to be updated. Format: - * `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * FeatureView resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then only the non-empty fields present in the - * request will be overwritten. Set the update_mask to `*` to override all - * fields. - * - * Updatable fields: - * - * * `labels` - * * `serviceAgentType` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateFeatureView($featureView, array $optionalArgs = []) - { - $request = new UpdateFeatureViewRequest(); - $requestParamHeaders = []; - $request->setFeatureView($featureView); - $requestParamHeaders['feature_view.name'] = $featureView->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateFeatureView', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $response = $featureOnlineStoreAdminServiceClient->getLocation(); - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $featureOnlineStoreAdminServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featureOnlineStoreAdminServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $resource = 'resource'; - * $response = $featureOnlineStoreAdminServiceClient->getIamPolicy($resource); - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $featureOnlineStoreAdminServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $featureOnlineStoreAdminServiceClient = new FeatureOnlineStoreAdminServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $featureOnlineStoreAdminServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $featureOnlineStoreAdminServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/FeatureOnlineStoreServiceGapicClient.php b/AiPlatform/src/V1/Gapic/FeatureOnlineStoreServiceGapicClient.php deleted file mode 100644 index 3829ec5a3fdd..000000000000 --- a/AiPlatform/src/V1/Gapic/FeatureOnlineStoreServiceGapicClient.php +++ /dev/null @@ -1,756 +0,0 @@ -featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - * $response = $featureOnlineStoreServiceClient->fetchFeatureValues($formattedFeatureView); - * } finally { - * $featureOnlineStoreServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\FeatureOnlineStoreServiceClient}. - */ -class FeatureOnlineStoreServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.FeatureOnlineStoreService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $featureViewNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/feature_online_store_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/feature_online_store_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/feature_online_store_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/feature_online_store_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getFeatureViewNameTemplate() - { - if (self::$featureViewNameTemplate == null) { - self::$featureViewNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}' - ); - } - - return self::$featureViewNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'featureView' => self::getFeatureViewNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a feature_view - * resource. - * - * @param string $project - * @param string $location - * @param string $featureOnlineStore - * @param string $featureView - * - * @return string The formatted feature_view resource. - */ - public static function featureViewName( - $project, - $location, - $featureOnlineStore, - $featureView - ) { - return self::getFeatureViewNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'feature_online_store' => $featureOnlineStore, - 'feature_view' => $featureView, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - featureView: projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Fetch feature values under a FeatureView. - * - * Sample code: - * ``` - * $featureOnlineStoreServiceClient = new FeatureOnlineStoreServiceClient(); - * try { - * $formattedFeatureView = $featureOnlineStoreServiceClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - * $response = $featureOnlineStoreServiceClient->fetchFeatureValues($formattedFeatureView); - * } finally { - * $featureOnlineStoreServiceClient->close(); - * } - * ``` - * - * @param string $featureView Required. FeatureView resource format - * `projects/{project}/locations/{location}/featureOnlineStores/{featureOnlineStore}/featureViews/{featureView}` - * @param array $optionalArgs { - * Optional. - * - * @type FeatureViewDataKey $dataKey - * Optional. The request key to fetch feature values for. - * @type int $dataFormat - * Optional. Response data format. If not set, - * [FeatureViewDataFormat.KEY_VALUE][google.cloud.aiplatform.v1.FeatureViewDataFormat.KEY_VALUE] - * will be used. - * For allowed values, use constants defined on {@see \Google\Cloud\AIPlatform\V1\FeatureViewDataFormat} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\FetchFeatureValuesResponse - * - * @throws ApiException if the remote call fails - */ - public function fetchFeatureValues($featureView, array $optionalArgs = []) - { - $request = new FetchFeatureValuesRequest(); - $requestParamHeaders = []; - $request->setFeatureView($featureView); - $requestParamHeaders['feature_view'] = $featureView; - if (isset($optionalArgs['dataKey'])) { - $request->setDataKey($optionalArgs['dataKey']); - } - - if (isset($optionalArgs['dataFormat'])) { - $request->setDataFormat($optionalArgs['dataFormat']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'FetchFeatureValues', - FetchFeatureValuesResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Search the nearest entities under a FeatureView. - * Search only works for indexable feature view; if a feature view isn't - * indexable, returns Invalid argument response. - * - * Sample code: - * ``` - * $featureOnlineStoreServiceClient = new FeatureOnlineStoreServiceClient(); - * try { - * $formattedFeatureView = $featureOnlineStoreServiceClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - * $query = new NearestNeighborQuery(); - * $response = $featureOnlineStoreServiceClient->searchNearestEntities($formattedFeatureView, $query); - * } finally { - * $featureOnlineStoreServiceClient->close(); - * } - * ``` - * - * @param string $featureView Required. FeatureView resource format - * `projects/{project}/locations/{location}/featureOnlineStores/{featureOnlineStore}/featureViews/{featureView}` - * @param NearestNeighborQuery $query Required. The query. - * @param array $optionalArgs { - * Optional. - * - * @type bool $returnFullEntity - * Optional. If set to true, the full entities (including all vector values - * and metadata) of the nearest neighbors are returned; otherwise only entity - * id of the nearest neighbors will be returned. Note that returning full - * entities will significantly increase the latency and cost of the query. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\SearchNearestEntitiesResponse - * - * @throws ApiException if the remote call fails - */ - public function searchNearestEntities( - $featureView, - $query, - array $optionalArgs = [] - ) { - $request = new SearchNearestEntitiesRequest(); - $requestParamHeaders = []; - $request->setFeatureView($featureView); - $request->setQuery($query); - $requestParamHeaders['feature_view'] = $featureView; - if (isset($optionalArgs['returnFullEntity'])) { - $request->setReturnFullEntity($optionalArgs['returnFullEntity']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SearchNearestEntities', - SearchNearestEntitiesResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $featureOnlineStoreServiceClient = new FeatureOnlineStoreServiceClient(); - * try { - * $response = $featureOnlineStoreServiceClient->getLocation(); - * } finally { - * $featureOnlineStoreServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $featureOnlineStoreServiceClient = new FeatureOnlineStoreServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $featureOnlineStoreServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featureOnlineStoreServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featureOnlineStoreServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $featureOnlineStoreServiceClient = new FeatureOnlineStoreServiceClient(); - * try { - * $resource = 'resource'; - * $response = $featureOnlineStoreServiceClient->getIamPolicy($resource); - * } finally { - * $featureOnlineStoreServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $featureOnlineStoreServiceClient = new FeatureOnlineStoreServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $featureOnlineStoreServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $featureOnlineStoreServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $featureOnlineStoreServiceClient = new FeatureOnlineStoreServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $featureOnlineStoreServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $featureOnlineStoreServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/FeatureRegistryServiceGapicClient.php b/AiPlatform/src/V1/Gapic/FeatureRegistryServiceGapicClient.php deleted file mode 100644 index 58f0c33818d6..000000000000 --- a/AiPlatform/src/V1/Gapic/FeatureRegistryServiceGapicClient.php +++ /dev/null @@ -1,1775 +0,0 @@ -entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $feature = new Feature(); - * $featureId = 'feature_id'; - * $operationResponse = $featureRegistryServiceClient->createFeature($formattedParent, $feature, $featureId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureRegistryServiceClient->createFeature($formattedParent, $feature, $featureId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureRegistryServiceClient->resumeOperation($operationName, 'createFeature'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\FeatureRegistryServiceClient}. - */ -class FeatureRegistryServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.FeatureRegistryService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $entityTypeNameTemplate; - - private static $featureNameTemplate; - - private static $featureGroupNameTemplate; - - private static $locationNameTemplate; - - private static $projectLocationFeatureGroupFeatureNameTemplate; - - private static $projectLocationFeaturestoreEntityTypeFeatureNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/feature_registry_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/feature_registry_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/feature_registry_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/feature_registry_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getEntityTypeNameTemplate() - { - if (self::$entityTypeNameTemplate == null) { - self::$entityTypeNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}' - ); - } - - return self::$entityTypeNameTemplate; - } - - private static function getFeatureNameTemplate() - { - if (self::$featureNameTemplate == null) { - self::$featureNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature}' - ); - } - - return self::$featureNameTemplate; - } - - private static function getFeatureGroupNameTemplate() - { - if (self::$featureGroupNameTemplate == null) { - self::$featureGroupNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featureGroups/{feature_group}' - ); - } - - return self::$featureGroupNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getProjectLocationFeatureGroupFeatureNameTemplate() - { - if (self::$projectLocationFeatureGroupFeatureNameTemplate == null) { - self::$projectLocationFeatureGroupFeatureNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featureGroups/{feature_group}/features/{feature}' - ); - } - - return self::$projectLocationFeatureGroupFeatureNameTemplate; - } - - private static function getProjectLocationFeaturestoreEntityTypeFeatureNameTemplate() - { - if ( - self::$projectLocationFeaturestoreEntityTypeFeatureNameTemplate == - null - ) { - self::$projectLocationFeaturestoreEntityTypeFeatureNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature}' - ); - } - - return self::$projectLocationFeaturestoreEntityTypeFeatureNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'entityType' => self::getEntityTypeNameTemplate(), - 'feature' => self::getFeatureNameTemplate(), - 'featureGroup' => self::getFeatureGroupNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'projectLocationFeatureGroupFeature' => self::getProjectLocationFeatureGroupFeatureNameTemplate(), - 'projectLocationFeaturestoreEntityTypeFeature' => self::getProjectLocationFeaturestoreEntityTypeFeatureNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a entity_type - * resource. - * - * @param string $project - * @param string $location - * @param string $featurestore - * @param string $entityType - * - * @return string The formatted entity_type resource. - */ - public static function entityTypeName( - $project, - $location, - $featurestore, - $entityType - ) { - return self::getEntityTypeNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'featurestore' => $featurestore, - 'entity_type' => $entityType, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a feature - * resource. - * - * @param string $project - * @param string $location - * @param string $featurestore - * @param string $entityType - * @param string $feature - * - * @return string The formatted feature resource. - */ - public static function featureName( - $project, - $location, - $featurestore, - $entityType, - $feature - ) { - return self::getFeatureNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'featurestore' => $featurestore, - 'entity_type' => $entityType, - 'feature' => $feature, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * feature_group resource. - * - * @param string $project - * @param string $location - * @param string $featureGroup - * - * @return string The formatted feature_group resource. - */ - public static function featureGroupName($project, $location, $featureGroup) - { - return self::getFeatureGroupNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'feature_group' => $featureGroup, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_feature_group_feature resource. - * - * @param string $project - * @param string $location - * @param string $featureGroup - * @param string $feature - * - * @return string The formatted project_location_feature_group_feature resource. - */ - public static function projectLocationFeatureGroupFeatureName( - $project, - $location, - $featureGroup, - $feature - ) { - return self::getProjectLocationFeatureGroupFeatureNameTemplate()->render( - [ - 'project' => $project, - 'location' => $location, - 'feature_group' => $featureGroup, - 'feature' => $feature, - ] - ); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_featurestore_entity_type_feature resource. - * - * @param string $project - * @param string $location - * @param string $featurestore - * @param string $entityType - * @param string $feature - * - * @return string The formatted project_location_featurestore_entity_type_feature resource. - */ - public static function projectLocationFeaturestoreEntityTypeFeatureName( - $project, - $location, - $featurestore, - $entityType, - $feature - ) { - return self::getProjectLocationFeaturestoreEntityTypeFeatureNameTemplate()->render( - [ - 'project' => $project, - 'location' => $location, - 'featurestore' => $featurestore, - 'entity_type' => $entityType, - 'feature' => $feature, - ] - ); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - entityType: projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type} - * - feature: projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature} - * - featureGroup: projects/{project}/locations/{location}/featureGroups/{feature_group} - * - location: projects/{project}/locations/{location} - * - projectLocationFeatureGroupFeature: projects/{project}/locations/{location}/featureGroups/{feature_group}/features/{feature} - * - projectLocationFeaturestoreEntityTypeFeature: projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates a new Feature in a given FeatureGroup. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $formattedParent = $featureRegistryServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $feature = new Feature(); - * $featureId = 'feature_id'; - * $operationResponse = $featureRegistryServiceClient->createFeature($formattedParent, $feature, $featureId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureRegistryServiceClient->createFeature($formattedParent, $feature, $featureId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureRegistryServiceClient->resumeOperation($operationName, 'createFeature'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the EntityType or FeatureGroup to create a - * Feature. Format for entity_type as parent: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * Format for feature_group as parent: - * `projects/{project}/locations/{location}/featureGroups/{feature_group}` - * @param Feature $feature Required. The Feature to create. - * @param string $featureId Required. The ID to use for the Feature, which will become the final - * component of the Feature's resource name. - * - * This value may be up to 128 characters, and valid characters are - * `[a-z0-9_]`. The first character cannot be a number. - * - * The value must be unique within an EntityType/FeatureGroup. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createFeature( - $parent, - $feature, - $featureId, - array $optionalArgs = [] - ) { - $request = new CreateFeatureRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFeature($feature); - $request->setFeatureId($featureId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateFeature', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new FeatureGroup in a given project and location. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $formattedParent = $featureRegistryServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $featureGroup = new FeatureGroup(); - * $featureGroupId = 'feature_group_id'; - * $operationResponse = $featureRegistryServiceClient->createFeatureGroup($formattedParent, $featureGroup, $featureGroupId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureRegistryServiceClient->createFeatureGroup($formattedParent, $featureGroup, $featureGroupId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureRegistryServiceClient->resumeOperation($operationName, 'createFeatureGroup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create FeatureGroups. - * Format: - * `projects/{project}/locations/{location}` - * @param FeatureGroup $featureGroup Required. The FeatureGroup to create. - * @param string $featureGroupId Required. The ID to use for this FeatureGroup, which will become the final - * component of the FeatureGroup's resource name. - * - * This value may be up to 60 characters, and valid characters are - * `[a-z0-9_]`. The first character cannot be a number. - * - * The value must be unique within the project and location. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createFeatureGroup( - $parent, - $featureGroup, - $featureGroupId, - array $optionalArgs = [] - ) { - $request = new CreateFeatureGroupRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFeatureGroup($featureGroup); - $request->setFeatureGroupId($featureGroupId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateFeatureGroup', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single Feature. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $formattedName = $featureRegistryServiceClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - * $operationResponse = $featureRegistryServiceClient->deleteFeature($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureRegistryServiceClient->deleteFeature($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureRegistryServiceClient->resumeOperation($operationName, 'deleteFeature'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Features to be deleted. - * Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature}` - * `projects/{project}/locations/{location}/featureGroups/{feature_group}/features/{feature}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFeature($name, array $optionalArgs = []) - { - $request = new DeleteFeatureRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteFeature', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single FeatureGroup. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $formattedName = $featureRegistryServiceClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - * $operationResponse = $featureRegistryServiceClient->deleteFeatureGroup($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureRegistryServiceClient->deleteFeatureGroup($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureRegistryServiceClient->resumeOperation($operationName, 'deleteFeatureGroup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the FeatureGroup to be deleted. - * Format: - * `projects/{project}/locations/{location}/featureGroups/{feature_group}` - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * If set to true, any Features under this FeatureGroup - * will also be deleted. (Otherwise, the request will only work if the - * FeatureGroup has no Features.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFeatureGroup($name, array $optionalArgs = []) - { - $request = new DeleteFeatureGroupRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteFeatureGroup', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets details of a single Feature. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $formattedName = $featureRegistryServiceClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - * $response = $featureRegistryServiceClient->getFeature($formattedName); - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Feature resource. - * Format for entity_type as parent: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * Format for feature_group as parent: - * `projects/{project}/locations/{location}/featureGroups/{feature_group}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Feature - * - * @throws ApiException if the remote call fails - */ - public function getFeature($name, array $optionalArgs = []) - { - $request = new GetFeatureRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetFeature', - Feature::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single FeatureGroup. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $formattedName = $featureRegistryServiceClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - * $response = $featureRegistryServiceClient->getFeatureGroup($formattedName); - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the FeatureGroup resource. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\FeatureGroup - * - * @throws ApiException if the remote call fails - */ - public function getFeatureGroup($name, array $optionalArgs = []) - { - $request = new GetFeatureGroupRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetFeatureGroup', - FeatureGroup::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists FeatureGroups in a given project and location. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $formattedParent = $featureRegistryServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $featureRegistryServiceClient->listFeatureGroups($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featureRegistryServiceClient->listFeatureGroups($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list FeatureGroups. - * Format: - * `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the FeatureGroups that match the filter expression. The - * following fields are supported: - * - * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be - * in RFC 3339 format. - * * `update_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be - * in RFC 3339 format. - * * `labels`: Supports key-value equality and key presence. - * - * Examples: - * - * * `create_time > "2020-01-01" OR update_time > "2020-01-01"` - * FeatureGroups created or updated after 2020-01-01. - * * `labels.env = "prod"` - * FeatureGroups with label "env" set to "prod". - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * Supported Fields: - * - * * `create_time` - * * `update_time` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listFeatureGroups($parent, array $optionalArgs = []) - { - $request = new ListFeatureGroupsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListFeatureGroups', - $optionalArgs, - ListFeatureGroupsResponse::class, - $request - ); - } - - /** - * Lists Features in a given FeatureGroup. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $formattedParent = $featureRegistryServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * // Iterate over pages of elements - * $pagedResponse = $featureRegistryServiceClient->listFeatures($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featureRegistryServiceClient->listFeatures($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list Features. - * Format for entity_type as parent: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * Format for feature_group as parent: - * `projects/{project}/locations/{location}/featureGroups/{feature_group}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the Features that match the filter expression. The following - * filters are supported: - * - * * `value_type`: Supports = and != comparisons. - * * `create_time`: Supports =, !=, <, >, >=, and <= comparisons. Values must - * be in RFC 3339 format. - * * `update_time`: Supports =, !=, <, >, >=, and <= comparisons. Values must - * be in RFC 3339 format. - * * `labels`: Supports key-value equality as well as key presence. - * - * Examples: - * - * * `value_type = DOUBLE` --> Features whose type is DOUBLE. - * * `create_time > \"2020-01-31T15:30:00.000000Z\" OR - * update_time > \"2020-01-31T15:30:00.000000Z\"` --> EntityTypes created - * or updated after 2020-01-31T15:30:00.000000Z. - * * `labels.active = yes AND labels.env = prod` --> Features having both - * (active: yes) and (env: prod) labels. - * * `labels.env: *` --> Any Feature which has a label with 'env' as the - * key. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * Supported fields: - * - * * `feature_id` - * * `value_type` (Not supported for FeatureRegistry Feature) - * * `create_time` - * * `update_time` - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type int $latestStatsCount - * Only applicable for Vertex AI Feature Store (Legacy). - * If set, return the most recent - * [ListFeaturesRequest.latest_stats_count][google.cloud.aiplatform.v1.ListFeaturesRequest.latest_stats_count] - * of stats for each Feature in response. Valid value is [0, 10]. If number of - * stats exists < - * [ListFeaturesRequest.latest_stats_count][google.cloud.aiplatform.v1.ListFeaturesRequest.latest_stats_count], - * return all existing stats. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listFeatures($parent, array $optionalArgs = []) - { - $request = new ListFeaturesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['latestStatsCount'])) { - $request->setLatestStatsCount($optionalArgs['latestStatsCount']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListFeatures', - $optionalArgs, - ListFeaturesResponse::class, - $request - ); - } - - /** - * Updates the parameters of a single Feature. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $feature = new Feature(); - * $operationResponse = $featureRegistryServiceClient->updateFeature($feature); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureRegistryServiceClient->updateFeature($feature); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureRegistryServiceClient->resumeOperation($operationName, 'updateFeature'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param Feature $feature Required. The Feature's `name` field is used to identify the Feature to be - * updated. - * Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature}` - * `projects/{project}/locations/{location}/featureGroups/{feature_group}/features/{feature}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * Features resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then only the non-empty fields present in the - * request will be overwritten. Set the update_mask to `*` to override all - * fields. - * - * Updatable fields: - * - * * `description` - * * `labels` - * * `disable_monitoring` (Not supported for FeatureRegistry Feature) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateFeature($feature, array $optionalArgs = []) - { - $request = new UpdateFeatureRequest(); - $requestParamHeaders = []; - $request->setFeature($feature); - $requestParamHeaders['feature.name'] = $feature->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateFeature', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single FeatureGroup. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $featureGroup = new FeatureGroup(); - * $operationResponse = $featureRegistryServiceClient->updateFeatureGroup($featureGroup); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featureRegistryServiceClient->updateFeatureGroup($featureGroup); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featureRegistryServiceClient->resumeOperation($operationName, 'updateFeatureGroup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param FeatureGroup $featureGroup Required. The FeatureGroup's `name` field is used to identify the - * FeatureGroup to be updated. Format: - * `projects/{project}/locations/{location}/featureGroups/{feature_group}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * FeatureGroup resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then only the non-empty fields present in the - * request will be overwritten. Set the update_mask to `*` to override all - * fields. - * - * Updatable fields: - * - * * `labels` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateFeatureGroup($featureGroup, array $optionalArgs = []) - { - $request = new UpdateFeatureGroupRequest(); - $requestParamHeaders = []; - $request->setFeatureGroup($featureGroup); - $requestParamHeaders['feature_group.name'] = $featureGroup->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateFeatureGroup', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $response = $featureRegistryServiceClient->getLocation(); - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $featureRegistryServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featureRegistryServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $resource = 'resource'; - * $response = $featureRegistryServiceClient->getIamPolicy($resource); - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $featureRegistryServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $featureRegistryServiceClient = new FeatureRegistryServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $featureRegistryServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $featureRegistryServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/FeaturestoreOnlineServingServiceGapicClient.php b/AiPlatform/src/V1/Gapic/FeaturestoreOnlineServingServiceGapicClient.php deleted file mode 100644 index 32d62778a0d9..000000000000 --- a/AiPlatform/src/V1/Gapic/FeaturestoreOnlineServingServiceGapicClient.php +++ /dev/null @@ -1,829 +0,0 @@ -entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $entityId = 'entity_id'; - * $featureSelector = new FeatureSelector(); - * $response = $featurestoreOnlineServingServiceClient->readFeatureValues($formattedEntityType, $entityId, $featureSelector); - * } finally { - * $featurestoreOnlineServingServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\FeaturestoreOnlineServingServiceClient}. - */ -class FeaturestoreOnlineServingServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.FeaturestoreOnlineServingService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $entityTypeNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/featurestore_online_serving_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/featurestore_online_serving_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/featurestore_online_serving_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/featurestore_online_serving_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getEntityTypeNameTemplate() - { - if (self::$entityTypeNameTemplate == null) { - self::$entityTypeNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}' - ); - } - - return self::$entityTypeNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'entityType' => self::getEntityTypeNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a entity_type - * resource. - * - * @param string $project - * @param string $location - * @param string $featurestore - * @param string $entityType - * - * @return string The formatted entity_type resource. - */ - public static function entityTypeName( - $project, - $location, - $featurestore, - $entityType - ) { - return self::getEntityTypeNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'featurestore' => $featurestore, - 'entity_type' => $entityType, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - entityType: projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Reads Feature values of a specific entity of an EntityType. For reading - * feature values of multiple entities of an EntityType, please use - * StreamingReadFeatureValues. - * - * Sample code: - * ``` - * $featurestoreOnlineServingServiceClient = new FeaturestoreOnlineServingServiceClient(); - * try { - * $formattedEntityType = $featurestoreOnlineServingServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $entityId = 'entity_id'; - * $featureSelector = new FeatureSelector(); - * $response = $featurestoreOnlineServingServiceClient->readFeatureValues($formattedEntityType, $entityId, $featureSelector); - * } finally { - * $featurestoreOnlineServingServiceClient->close(); - * } - * ``` - * - * @param string $entityType Required. The resource name of the EntityType for the entity being read. - * Value format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}`. - * For example, for a machine learning model predicting user clicks on a - * website, an EntityType ID could be `user`. - * @param string $entityId Required. ID for a specific entity. For example, - * for a machine learning model predicting user clicks on a website, an entity - * ID could be `user_123`. - * @param FeatureSelector $featureSelector Required. Selector choosing Features of the target EntityType. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ReadFeatureValuesResponse - * - * @throws ApiException if the remote call fails - */ - public function readFeatureValues( - $entityType, - $entityId, - $featureSelector, - array $optionalArgs = [] - ) { - $request = new ReadFeatureValuesRequest(); - $requestParamHeaders = []; - $request->setEntityType($entityType); - $request->setEntityId($entityId); - $request->setFeatureSelector($featureSelector); - $requestParamHeaders['entity_type'] = $entityType; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ReadFeatureValues', - ReadFeatureValuesResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Reads Feature values for multiple entities. Depending on their size, data - * for different entities may be broken - * up across multiple responses. - * - * Sample code: - * ``` - * $featurestoreOnlineServingServiceClient = new FeaturestoreOnlineServingServiceClient(); - * try { - * $formattedEntityType = $featurestoreOnlineServingServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $entityIds = []; - * $featureSelector = new FeatureSelector(); - * // Read all responses until the stream is complete - * $stream = $featurestoreOnlineServingServiceClient->streamingReadFeatureValues($formattedEntityType, $entityIds, $featureSelector); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featurestoreOnlineServingServiceClient->close(); - * } - * ``` - * - * @param string $entityType Required. The resource name of the entities' type. - * Value format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}`. - * For example, - * for a machine learning model predicting user clicks on a website, an - * EntityType ID could be `user`. - * @param string[] $entityIds Required. IDs of entities to read Feature values of. The maximum number of - * IDs is 100. For example, for a machine learning model predicting user - * clicks on a website, an entity ID could be `user_123`. - * @param FeatureSelector $featureSelector Required. Selector choosing Features of the target EntityType. Feature IDs - * will be deduplicated. - * @param array $optionalArgs { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function streamingReadFeatureValues( - $entityType, - $entityIds, - $featureSelector, - array $optionalArgs = [] - ) { - $request = new StreamingReadFeatureValuesRequest(); - $requestParamHeaders = []; - $request->setEntityType($entityType); - $request->setEntityIds($entityIds); - $request->setFeatureSelector($featureSelector); - $requestParamHeaders['entity_type'] = $entityType; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'StreamingReadFeatureValues', - ReadFeatureValuesResponse::class, - $optionalArgs, - $request, - Call::SERVER_STREAMING_CALL - ); - } - - /** - * Writes Feature values of one or more entities of an EntityType. - * - * The Feature values are merged into existing entities if any. The Feature - * values to be written must have timestamp within the online storage - * retention. - * - * Sample code: - * ``` - * $featurestoreOnlineServingServiceClient = new FeaturestoreOnlineServingServiceClient(); - * try { - * $formattedEntityType = $featurestoreOnlineServingServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $payloads = []; - * $response = $featurestoreOnlineServingServiceClient->writeFeatureValues($formattedEntityType, $payloads); - * } finally { - * $featurestoreOnlineServingServiceClient->close(); - * } - * ``` - * - * @param string $entityType Required. The resource name of the EntityType for the entities being - * written. Value format: - * `projects/{project}/locations/{location}/featurestores/ - * {featurestore}/entityTypes/{entityType}`. For example, - * for a machine learning model predicting user clicks on a website, an - * EntityType ID could be `user`. - * @param WriteFeatureValuesPayload[] $payloads Required. The entities to be written. Up to 100,000 feature values can be - * written across all `payloads`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\WriteFeatureValuesResponse - * - * @throws ApiException if the remote call fails - */ - public function writeFeatureValues( - $entityType, - $payloads, - array $optionalArgs = [] - ) { - $request = new WriteFeatureValuesRequest(); - $requestParamHeaders = []; - $request->setEntityType($entityType); - $request->setPayloads($payloads); - $requestParamHeaders['entity_type'] = $entityType; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'WriteFeatureValues', - WriteFeatureValuesResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $featurestoreOnlineServingServiceClient = new FeaturestoreOnlineServingServiceClient(); - * try { - * $response = $featurestoreOnlineServingServiceClient->getLocation(); - * } finally { - * $featurestoreOnlineServingServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $featurestoreOnlineServingServiceClient = new FeaturestoreOnlineServingServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $featurestoreOnlineServingServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featurestoreOnlineServingServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featurestoreOnlineServingServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $featurestoreOnlineServingServiceClient = new FeaturestoreOnlineServingServiceClient(); - * try { - * $resource = 'resource'; - * $response = $featurestoreOnlineServingServiceClient->getIamPolicy($resource); - * } finally { - * $featurestoreOnlineServingServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $featurestoreOnlineServingServiceClient = new FeaturestoreOnlineServingServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $featurestoreOnlineServingServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $featurestoreOnlineServingServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $featurestoreOnlineServingServiceClient = new FeaturestoreOnlineServingServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $featurestoreOnlineServingServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $featurestoreOnlineServingServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/FeaturestoreServiceGapicClient.php b/AiPlatform/src/V1/Gapic/FeaturestoreServiceGapicClient.php deleted file mode 100644 index f8a12aff9131..000000000000 --- a/AiPlatform/src/V1/Gapic/FeaturestoreServiceGapicClient.php +++ /dev/null @@ -1,2990 +0,0 @@ -entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $requests = []; - * $operationResponse = $featurestoreServiceClient->batchCreateFeatures($formattedParent, $requests); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->batchCreateFeatures($formattedParent, $requests); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'batchCreateFeatures'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\FeaturestoreServiceClient}. - */ -class FeaturestoreServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.FeaturestoreService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $entityTypeNameTemplate; - - private static $featureNameTemplate; - - private static $featureGroupNameTemplate; - - private static $featurestoreNameTemplate; - - private static $locationNameTemplate; - - private static $projectLocationFeatureGroupFeatureNameTemplate; - - private static $projectLocationFeaturestoreEntityTypeFeatureNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/featurestore_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/featurestore_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/featurestore_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/featurestore_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getEntityTypeNameTemplate() - { - if (self::$entityTypeNameTemplate == null) { - self::$entityTypeNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}' - ); - } - - return self::$entityTypeNameTemplate; - } - - private static function getFeatureNameTemplate() - { - if (self::$featureNameTemplate == null) { - self::$featureNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature}' - ); - } - - return self::$featureNameTemplate; - } - - private static function getFeatureGroupNameTemplate() - { - if (self::$featureGroupNameTemplate == null) { - self::$featureGroupNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featureGroups/{feature_group}' - ); - } - - return self::$featureGroupNameTemplate; - } - - private static function getFeaturestoreNameTemplate() - { - if (self::$featurestoreNameTemplate == null) { - self::$featurestoreNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featurestores/{featurestore}' - ); - } - - return self::$featurestoreNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getProjectLocationFeatureGroupFeatureNameTemplate() - { - if (self::$projectLocationFeatureGroupFeatureNameTemplate == null) { - self::$projectLocationFeatureGroupFeatureNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featureGroups/{feature_group}/features/{feature}' - ); - } - - return self::$projectLocationFeatureGroupFeatureNameTemplate; - } - - private static function getProjectLocationFeaturestoreEntityTypeFeatureNameTemplate() - { - if ( - self::$projectLocationFeaturestoreEntityTypeFeatureNameTemplate == - null - ) { - self::$projectLocationFeaturestoreEntityTypeFeatureNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature}' - ); - } - - return self::$projectLocationFeaturestoreEntityTypeFeatureNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'entityType' => self::getEntityTypeNameTemplate(), - 'feature' => self::getFeatureNameTemplate(), - 'featureGroup' => self::getFeatureGroupNameTemplate(), - 'featurestore' => self::getFeaturestoreNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'projectLocationFeatureGroupFeature' => self::getProjectLocationFeatureGroupFeatureNameTemplate(), - 'projectLocationFeaturestoreEntityTypeFeature' => self::getProjectLocationFeaturestoreEntityTypeFeatureNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a entity_type - * resource. - * - * @param string $project - * @param string $location - * @param string $featurestore - * @param string $entityType - * - * @return string The formatted entity_type resource. - */ - public static function entityTypeName( - $project, - $location, - $featurestore, - $entityType - ) { - return self::getEntityTypeNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'featurestore' => $featurestore, - 'entity_type' => $entityType, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a feature - * resource. - * - * @param string $project - * @param string $location - * @param string $featurestore - * @param string $entityType - * @param string $feature - * - * @return string The formatted feature resource. - */ - public static function featureName( - $project, - $location, - $featurestore, - $entityType, - $feature - ) { - return self::getFeatureNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'featurestore' => $featurestore, - 'entity_type' => $entityType, - 'feature' => $feature, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * feature_group resource. - * - * @param string $project - * @param string $location - * @param string $featureGroup - * - * @return string The formatted feature_group resource. - */ - public static function featureGroupName($project, $location, $featureGroup) - { - return self::getFeatureGroupNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'feature_group' => $featureGroup, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a featurestore - * resource. - * - * @param string $project - * @param string $location - * @param string $featurestore - * - * @return string The formatted featurestore resource. - */ - public static function featurestoreName($project, $location, $featurestore) - { - return self::getFeaturestoreNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'featurestore' => $featurestore, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_feature_group_feature resource. - * - * @param string $project - * @param string $location - * @param string $featureGroup - * @param string $feature - * - * @return string The formatted project_location_feature_group_feature resource. - */ - public static function projectLocationFeatureGroupFeatureName( - $project, - $location, - $featureGroup, - $feature - ) { - return self::getProjectLocationFeatureGroupFeatureNameTemplate()->render( - [ - 'project' => $project, - 'location' => $location, - 'feature_group' => $featureGroup, - 'feature' => $feature, - ] - ); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_featurestore_entity_type_feature resource. - * - * @param string $project - * @param string $location - * @param string $featurestore - * @param string $entityType - * @param string $feature - * - * @return string The formatted project_location_featurestore_entity_type_feature resource. - */ - public static function projectLocationFeaturestoreEntityTypeFeatureName( - $project, - $location, - $featurestore, - $entityType, - $feature - ) { - return self::getProjectLocationFeaturestoreEntityTypeFeatureNameTemplate()->render( - [ - 'project' => $project, - 'location' => $location, - 'featurestore' => $featurestore, - 'entity_type' => $entityType, - 'feature' => $feature, - ] - ); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - entityType: projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type} - * - feature: projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature} - * - featureGroup: projects/{project}/locations/{location}/featureGroups/{feature_group} - * - featurestore: projects/{project}/locations/{location}/featurestores/{featurestore} - * - location: projects/{project}/locations/{location} - * - projectLocationFeatureGroupFeature: projects/{project}/locations/{location}/featureGroups/{feature_group}/features/{feature} - * - projectLocationFeaturestoreEntityTypeFeature: projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates a batch of Features in a given EntityType. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedParent = $featurestoreServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $requests = []; - * $operationResponse = $featurestoreServiceClient->batchCreateFeatures($formattedParent, $requests); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->batchCreateFeatures($formattedParent, $requests); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'batchCreateFeatures'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the EntityType to create the batch of - * Features under. Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * @param CreateFeatureRequest[] $requests Required. The request message specifying the Features to create. All - * Features must be created under the same parent EntityType. The `parent` - * field in each child request message can be omitted. If `parent` is set in a - * child request, then the value must match the `parent` value in this request - * message. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function batchCreateFeatures( - $parent, - $requests, - array $optionalArgs = [] - ) { - $request = new BatchCreateFeaturesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setRequests($requests); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'BatchCreateFeatures', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Batch reads Feature values from a Featurestore. - * - * This API enables batch reading Feature values, where each read - * instance in the batch may read Feature values of entities from one or - * more EntityTypes. Point-in-time correctness is guaranteed for Feature - * values of each read instance as of each instance's read timestamp. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedFeaturestore = $featurestoreServiceClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - * $destination = new FeatureValueDestination(); - * $entityTypeSpecs = []; - * $operationResponse = $featurestoreServiceClient->batchReadFeatureValues($formattedFeaturestore, $destination, $entityTypeSpecs); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->batchReadFeatureValues($formattedFeaturestore, $destination, $entityTypeSpecs); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'batchReadFeatureValues'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $featurestore Required. The resource name of the Featurestore from which to query Feature - * values. Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}` - * @param FeatureValueDestination $destination Required. Specifies output location and format. - * @param EntityTypeSpec[] $entityTypeSpecs Required. Specifies EntityType grouping Features to read values of and - * settings. - * @param array $optionalArgs { - * Optional. - * - * @type CsvSource $csvReadInstances - * Each read instance consists of exactly one read timestamp and one or more - * entity IDs identifying entities of the corresponding EntityTypes whose - * Features are requested. - * - * Each output instance contains Feature values of requested entities - * concatenated together as of the read time. - * - * An example read instance may be `foo_entity_id, bar_entity_id, - * 2020-01-01T10:00:00.123Z`. - * - * An example output instance may be `foo_entity_id, bar_entity_id, - * 2020-01-01T10:00:00.123Z, foo_entity_feature1_value, - * bar_entity_feature2_value`. - * - * Timestamp in each read instance must be millisecond-aligned. - * - * `csv_read_instances` are read instances stored in a plain-text CSV file. - * The header should be: - * [ENTITY_TYPE_ID1], [ENTITY_TYPE_ID2], ..., timestamp - * - * The columns can be in any order. - * - * Values in the timestamp column must use the RFC 3339 format, e.g. - * `2012-07-30T10:43:17.123Z`. - * @type BigQuerySource $bigqueryReadInstances - * Similar to csv_read_instances, but from BigQuery source. - * @type PassThroughField[] $passThroughFields - * When not empty, the specified fields in the *_read_instances source will be - * joined as-is in the output, in addition to those fields from the - * Featurestore Entity. - * - * For BigQuery source, the type of the pass-through values will be - * automatically inferred. For CSV source, the pass-through values will be - * passed as opaque bytes. - * @type Timestamp $startTime - * Optional. Excludes Feature values with feature generation timestamp before - * this timestamp. If not set, retrieve oldest values kept in Feature Store. - * Timestamp, if present, must not have higher than millisecond precision. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function batchReadFeatureValues( - $featurestore, - $destination, - $entityTypeSpecs, - array $optionalArgs = [] - ) { - $request = new BatchReadFeatureValuesRequest(); - $requestParamHeaders = []; - $request->setFeaturestore($featurestore); - $request->setDestination($destination); - $request->setEntityTypeSpecs($entityTypeSpecs); - $requestParamHeaders['featurestore'] = $featurestore; - if (isset($optionalArgs['csvReadInstances'])) { - $request->setCsvReadInstances($optionalArgs['csvReadInstances']); - } - - if (isset($optionalArgs['bigqueryReadInstances'])) { - $request->setBigqueryReadInstances( - $optionalArgs['bigqueryReadInstances'] - ); - } - - if (isset($optionalArgs['passThroughFields'])) { - $request->setPassThroughFields($optionalArgs['passThroughFields']); - } - - if (isset($optionalArgs['startTime'])) { - $request->setStartTime($optionalArgs['startTime']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'BatchReadFeatureValues', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new EntityType in a given Featurestore. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedParent = $featurestoreServiceClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - * $entityTypeId = 'entity_type_id'; - * $operationResponse = $featurestoreServiceClient->createEntityType($formattedParent, $entityTypeId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->createEntityType($formattedParent, $entityTypeId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'createEntityType'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Featurestore to create EntityTypes. - * Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}` - * @param string $entityTypeId Required. The ID to use for the EntityType, which will become the final - * component of the EntityType's resource name. - * - * This value may be up to 60 characters, and valid characters are - * `[a-z0-9_]`. The first character cannot be a number. - * - * The value must be unique within a featurestore. - * @param array $optionalArgs { - * Optional. - * - * @type EntityType $entityType - * The EntityType to create. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createEntityType( - $parent, - $entityTypeId, - array $optionalArgs = [] - ) { - $request = new CreateEntityTypeRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setEntityTypeId($entityTypeId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['entityType'])) { - $request->setEntityType($optionalArgs['entityType']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateEntityType', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new Feature in a given EntityType. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedParent = $featurestoreServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $feature = new Feature(); - * $featureId = 'feature_id'; - * $operationResponse = $featurestoreServiceClient->createFeature($formattedParent, $feature, $featureId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->createFeature($formattedParent, $feature, $featureId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'createFeature'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the EntityType or FeatureGroup to create a - * Feature. Format for entity_type as parent: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * Format for feature_group as parent: - * `projects/{project}/locations/{location}/featureGroups/{feature_group}` - * @param Feature $feature Required. The Feature to create. - * @param string $featureId Required. The ID to use for the Feature, which will become the final - * component of the Feature's resource name. - * - * This value may be up to 128 characters, and valid characters are - * `[a-z0-9_]`. The first character cannot be a number. - * - * The value must be unique within an EntityType/FeatureGroup. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createFeature( - $parent, - $feature, - $featureId, - array $optionalArgs = [] - ) { - $request = new CreateFeatureRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFeature($feature); - $request->setFeatureId($featureId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateFeature', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new Featurestore in a given project and location. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedParent = $featurestoreServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $featurestore = new Featurestore(); - * $featurestoreId = 'featurestore_id'; - * $operationResponse = $featurestoreServiceClient->createFeaturestore($formattedParent, $featurestore, $featurestoreId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->createFeaturestore($formattedParent, $featurestore, $featurestoreId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'createFeaturestore'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create Featurestores. - * Format: - * `projects/{project}/locations/{location}` - * @param Featurestore $featurestore Required. The Featurestore to create. - * @param string $featurestoreId Required. The ID to use for this Featurestore, which will become the final - * component of the Featurestore's resource name. - * - * This value may be up to 60 characters, and valid characters are - * `[a-z0-9_]`. The first character cannot be a number. - * - * The value must be unique within the project and location. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createFeaturestore( - $parent, - $featurestore, - $featurestoreId, - array $optionalArgs = [] - ) { - $request = new CreateFeaturestoreRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFeaturestore($featurestore); - $request->setFeaturestoreId($featurestoreId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateFeaturestore', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single EntityType. The EntityType must not have any Features - * or `force` must be set to true for the request to succeed. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedName = $featurestoreServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $operationResponse = $featurestoreServiceClient->deleteEntityType($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->deleteEntityType($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'deleteEntityType'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the EntityType to be deleted. - * Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * If set to true, any Features for this EntityType will also be deleted. - * (Otherwise, the request will only work if the EntityType has no Features.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteEntityType($name, array $optionalArgs = []) - { - $request = new DeleteEntityTypeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteEntityType', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single Feature. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedName = $featurestoreServiceClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - * $operationResponse = $featurestoreServiceClient->deleteFeature($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->deleteFeature($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'deleteFeature'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Features to be deleted. - * Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature}` - * `projects/{project}/locations/{location}/featureGroups/{feature_group}/features/{feature}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFeature($name, array $optionalArgs = []) - { - $request = new DeleteFeatureRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteFeature', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Delete Feature values from Featurestore. - * - * The progress of the deletion is tracked by the returned operation. The - * deleted feature values are guaranteed to be invisible to subsequent read - * operations after the operation is marked as successfully done. - * - * If a delete feature values operation fails, the feature values - * returned from reads and exports may be inconsistent. If consistency is - * required, the caller must retry the same delete request again and wait till - * the new operation returned is marked as successfully done. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedEntityType = $featurestoreServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $operationResponse = $featurestoreServiceClient->deleteFeatureValues($formattedEntityType); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->deleteFeatureValues($formattedEntityType); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'deleteFeatureValues'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $entityType Required. The resource name of the EntityType grouping the Features for - * which values are being deleted from. Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}` - * @param array $optionalArgs { - * Optional. - * - * @type SelectEntity $selectEntity - * Select feature values to be deleted by specifying entities. - * @type SelectTimeRangeAndFeature $selectTimeRangeAndFeature - * Select feature values to be deleted by specifying time range and - * features. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFeatureValues($entityType, array $optionalArgs = []) - { - $request = new DeleteFeatureValuesRequest(); - $requestParamHeaders = []; - $request->setEntityType($entityType); - $requestParamHeaders['entity_type'] = $entityType; - if (isset($optionalArgs['selectEntity'])) { - $request->setSelectEntity($optionalArgs['selectEntity']); - } - - if (isset($optionalArgs['selectTimeRangeAndFeature'])) { - $request->setSelectTimeRangeAndFeature( - $optionalArgs['selectTimeRangeAndFeature'] - ); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteFeatureValues', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single Featurestore. The Featurestore must not contain any - * EntityTypes or `force` must be set to true for the request to succeed. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedName = $featurestoreServiceClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - * $operationResponse = $featurestoreServiceClient->deleteFeaturestore($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->deleteFeaturestore($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'deleteFeaturestore'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Featurestore to be deleted. - * Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}` - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * If set to true, any EntityTypes and Features for this Featurestore will - * also be deleted. (Otherwise, the request will only work if the Featurestore - * has no EntityTypes.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteFeaturestore($name, array $optionalArgs = []) - { - $request = new DeleteFeaturestoreRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteFeaturestore', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Exports Feature values from all the entities of a target EntityType. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedEntityType = $featurestoreServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $destination = new FeatureValueDestination(); - * $featureSelector = new FeatureSelector(); - * $operationResponse = $featurestoreServiceClient->exportFeatureValues($formattedEntityType, $destination, $featureSelector); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->exportFeatureValues($formattedEntityType, $destination, $featureSelector); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'exportFeatureValues'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $entityType Required. The resource name of the EntityType from which to export Feature - * values. Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * @param FeatureValueDestination $destination Required. Specifies destination location and format. - * @param FeatureSelector $featureSelector Required. Selects Features to export values of. - * @param array $optionalArgs { - * Optional. - * - * @type SnapshotExport $snapshotExport - * Exports the latest Feature values of all entities of the EntityType - * within a time range. - * @type FullExport $fullExport - * Exports all historical values of all entities of the EntityType within a - * time range - * @type DestinationFeatureSetting[] $settings - * Per-Feature export settings. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function exportFeatureValues( - $entityType, - $destination, - $featureSelector, - array $optionalArgs = [] - ) { - $request = new ExportFeatureValuesRequest(); - $requestParamHeaders = []; - $request->setEntityType($entityType); - $request->setDestination($destination); - $request->setFeatureSelector($featureSelector); - $requestParamHeaders['entity_type'] = $entityType; - if (isset($optionalArgs['snapshotExport'])) { - $request->setSnapshotExport($optionalArgs['snapshotExport']); - } - - if (isset($optionalArgs['fullExport'])) { - $request->setFullExport($optionalArgs['fullExport']); - } - - if (isset($optionalArgs['settings'])) { - $request->setSettings($optionalArgs['settings']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'ExportFeatureValues', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets details of a single EntityType. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedName = $featurestoreServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $response = $featurestoreServiceClient->getEntityType($formattedName); - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the EntityType resource. - * Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\EntityType - * - * @throws ApiException if the remote call fails - */ - public function getEntityType($name, array $optionalArgs = []) - { - $request = new GetEntityTypeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetEntityType', - EntityType::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single Feature. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedName = $featurestoreServiceClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - * $response = $featurestoreServiceClient->getFeature($formattedName); - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Feature resource. - * Format for entity_type as parent: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * Format for feature_group as parent: - * `projects/{project}/locations/{location}/featureGroups/{feature_group}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Feature - * - * @throws ApiException if the remote call fails - */ - public function getFeature($name, array $optionalArgs = []) - { - $request = new GetFeatureRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetFeature', - Feature::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single Featurestore. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedName = $featurestoreServiceClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - * $response = $featurestoreServiceClient->getFeaturestore($formattedName); - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Featurestore resource. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Featurestore - * - * @throws ApiException if the remote call fails - */ - public function getFeaturestore($name, array $optionalArgs = []) - { - $request = new GetFeaturestoreRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetFeaturestore', - Featurestore::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Imports Feature values into the Featurestore from a source storage. - * - * The progress of the import is tracked by the returned operation. The - * imported features are guaranteed to be visible to subsequent read - * operations after the operation is marked as successfully done. - * - * If an import operation fails, the Feature values returned from - * reads and exports may be inconsistent. If consistency is - * required, the caller must retry the same import request again and wait till - * the new operation returned is marked as successfully done. - * - * There are also scenarios where the caller can cause inconsistency. - * - * - Source data for import contains multiple distinct Feature values for - * the same entity ID and timestamp. - * - Source is modified during an import. This includes adding, updating, or - * removing source data and/or metadata. Examples of updating metadata - * include but are not limited to changing storage location, storage class, - * or retention policy. - * - Online serving cluster is under-provisioned. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedEntityType = $featurestoreServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * $featureSpecs = []; - * $operationResponse = $featurestoreServiceClient->importFeatureValues($formattedEntityType, $featureSpecs); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->importFeatureValues($formattedEntityType, $featureSpecs); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'importFeatureValues'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $entityType Required. The resource name of the EntityType grouping the Features for - * which values are being imported. Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}` - * @param FeatureSpec[] $featureSpecs Required. Specifications defining which Feature values to import from the - * entity. The request fails if no feature_specs are provided, and having - * multiple feature_specs for one Feature is not allowed. - * @param array $optionalArgs { - * Optional. - * - * @type AvroSource $avroSource - * @type BigQuerySource $bigquerySource - * @type CsvSource $csvSource - * @type string $featureTimeField - * Source column that holds the Feature timestamp for all Feature - * values in each entity. - * @type Timestamp $featureTime - * Single Feature timestamp for all entities being imported. The - * timestamp must not have higher than millisecond precision. - * @type string $entityIdField - * Source column that holds entity IDs. If not provided, entity IDs are - * extracted from the column named entity_id. - * @type bool $disableOnlineServing - * If set, data will not be imported for online serving. This - * is typically used for backfilling, where Feature generation timestamps are - * not in the timestamp range needed for online serving. - * @type int $workerCount - * Specifies the number of workers that are used to write data to the - * Featurestore. Consider the online serving capacity that you require to - * achieve the desired import throughput without interfering with online - * serving. The value must be positive, and less than or equal to 100. - * If not set, defaults to using 1 worker. The low count ensures minimal - * impact on online serving performance. - * @type bool $disableIngestionAnalysis - * If true, API doesn't start ingestion analysis pipeline. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function importFeatureValues( - $entityType, - $featureSpecs, - array $optionalArgs = [] - ) { - $request = new ImportFeatureValuesRequest(); - $requestParamHeaders = []; - $request->setEntityType($entityType); - $request->setFeatureSpecs($featureSpecs); - $requestParamHeaders['entity_type'] = $entityType; - if (isset($optionalArgs['avroSource'])) { - $request->setAvroSource($optionalArgs['avroSource']); - } - - if (isset($optionalArgs['bigquerySource'])) { - $request->setBigquerySource($optionalArgs['bigquerySource']); - } - - if (isset($optionalArgs['csvSource'])) { - $request->setCsvSource($optionalArgs['csvSource']); - } - - if (isset($optionalArgs['featureTimeField'])) { - $request->setFeatureTimeField($optionalArgs['featureTimeField']); - } - - if (isset($optionalArgs['featureTime'])) { - $request->setFeatureTime($optionalArgs['featureTime']); - } - - if (isset($optionalArgs['entityIdField'])) { - $request->setEntityIdField($optionalArgs['entityIdField']); - } - - if (isset($optionalArgs['disableOnlineServing'])) { - $request->setDisableOnlineServing( - $optionalArgs['disableOnlineServing'] - ); - } - - if (isset($optionalArgs['workerCount'])) { - $request->setWorkerCount($optionalArgs['workerCount']); - } - - if (isset($optionalArgs['disableIngestionAnalysis'])) { - $request->setDisableIngestionAnalysis( - $optionalArgs['disableIngestionAnalysis'] - ); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'ImportFeatureValues', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Lists EntityTypes in a given Featurestore. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedParent = $featurestoreServiceClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - * // Iterate over pages of elements - * $pagedResponse = $featurestoreServiceClient->listEntityTypes($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featurestoreServiceClient->listEntityTypes($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Featurestore to list EntityTypes. - * Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the EntityTypes that match the filter expression. The following - * filters are supported: - * - * * `create_time`: Supports `=`, `!=`, `<`, `>`, `>=`, and `<=` comparisons. - * Values must be in RFC 3339 format. - * * `update_time`: Supports `=`, `!=`, `<`, `>`, `>=`, and `<=` comparisons. - * Values must be in RFC 3339 format. - * * `labels`: Supports key-value equality as well as key presence. - * - * Examples: - * - * * `create_time > \"2020-01-31T15:30:00.000000Z\" OR - * update_time > \"2020-01-31T15:30:00.000000Z\"` --> EntityTypes created - * or updated after 2020-01-31T15:30:00.000000Z. - * * `labels.active = yes AND labels.env = prod` --> EntityTypes having both - * (active: yes) and (env: prod) labels. - * * `labels.env: *` --> Any EntityType which has a label with 'env' as the - * key. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * - * Supported fields: - * - * * `entity_type_id` - * * `create_time` - * * `update_time` - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listEntityTypes($parent, array $optionalArgs = []) - { - $request = new ListEntityTypesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListEntityTypes', - $optionalArgs, - ListEntityTypesResponse::class, - $request - ); - } - - /** - * Lists Features in a given EntityType. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedParent = $featurestoreServiceClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - * // Iterate over pages of elements - * $pagedResponse = $featurestoreServiceClient->listFeatures($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featurestoreServiceClient->listFeatures($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list Features. - * Format for entity_type as parent: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * Format for feature_group as parent: - * `projects/{project}/locations/{location}/featureGroups/{feature_group}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the Features that match the filter expression. The following - * filters are supported: - * - * * `value_type`: Supports = and != comparisons. - * * `create_time`: Supports =, !=, <, >, >=, and <= comparisons. Values must - * be in RFC 3339 format. - * * `update_time`: Supports =, !=, <, >, >=, and <= comparisons. Values must - * be in RFC 3339 format. - * * `labels`: Supports key-value equality as well as key presence. - * - * Examples: - * - * * `value_type = DOUBLE` --> Features whose type is DOUBLE. - * * `create_time > \"2020-01-31T15:30:00.000000Z\" OR - * update_time > \"2020-01-31T15:30:00.000000Z\"` --> EntityTypes created - * or updated after 2020-01-31T15:30:00.000000Z. - * * `labels.active = yes AND labels.env = prod` --> Features having both - * (active: yes) and (env: prod) labels. - * * `labels.env: *` --> Any Feature which has a label with 'env' as the - * key. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * Supported fields: - * - * * `feature_id` - * * `value_type` (Not supported for FeatureRegistry Feature) - * * `create_time` - * * `update_time` - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type int $latestStatsCount - * Only applicable for Vertex AI Feature Store (Legacy). - * If set, return the most recent - * [ListFeaturesRequest.latest_stats_count][google.cloud.aiplatform.v1.ListFeaturesRequest.latest_stats_count] - * of stats for each Feature in response. Valid value is [0, 10]. If number of - * stats exists < - * [ListFeaturesRequest.latest_stats_count][google.cloud.aiplatform.v1.ListFeaturesRequest.latest_stats_count], - * return all existing stats. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listFeatures($parent, array $optionalArgs = []) - { - $request = new ListFeaturesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['latestStatsCount'])) { - $request->setLatestStatsCount($optionalArgs['latestStatsCount']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListFeatures', - $optionalArgs, - ListFeaturesResponse::class, - $request - ); - } - - /** - * Lists Featurestores in a given project and location. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedParent = $featurestoreServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $featurestoreServiceClient->listFeaturestores($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featurestoreServiceClient->listFeaturestores($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list Featurestores. - * Format: - * `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the featurestores that match the filter expression. The following - * fields are supported: - * - * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be - * in RFC 3339 format. - * * `update_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be - * in RFC 3339 format. - * * `online_serving_config.fixed_node_count`: Supports `=`, `!=`, `<`, `>`, - * `<=`, and `>=` comparisons. - * * `labels`: Supports key-value equality and key presence. - * - * Examples: - * - * * `create_time > "2020-01-01" OR update_time > "2020-01-01"` - * Featurestores created or updated after 2020-01-01. - * * `labels.env = "prod"` - * Featurestores with label "env" set to "prod". - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * Supported Fields: - * - * * `create_time` - * * `update_time` - * * `online_serving_config.fixed_node_count` - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listFeaturestores($parent, array $optionalArgs = []) - { - $request = new ListFeaturestoresRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListFeaturestores', - $optionalArgs, - ListFeaturestoresResponse::class, - $request - ); - } - - /** - * Searches Features matching a query in a given project. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $formattedLocation = $featurestoreServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $featurestoreServiceClient->searchFeatures($formattedLocation); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featurestoreServiceClient->searchFeatures($formattedLocation); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $location Required. The resource name of the Location to search Features. - * Format: - * `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $query - * Query string that is a conjunction of field-restricted queries and/or - * field-restricted filters. Field-restricted queries and filters can be - * combined using `AND` to form a conjunction. - * - * A field query is in the form FIELD:QUERY. This implicitly checks if QUERY - * exists as a substring within Feature's FIELD. The QUERY - * and the FIELD are converted to a sequence of words (i.e. tokens) for - * comparison. This is done by: - * - * * Removing leading/trailing whitespace and tokenizing the search value. - * Characters that are not one of alphanumeric `[a-zA-Z0-9]`, underscore - * `_`, or asterisk `*` are treated as delimiters for tokens. `*` is treated - * as a wildcard that matches characters within a token. - * * Ignoring case. - * * Prepending an asterisk to the first and appending an asterisk to the - * last token in QUERY. - * - * A QUERY must be either a singular token or a phrase. A phrase is one or - * multiple words enclosed in double quotation marks ("). With phrases, the - * order of the words is important. Words in the phrase must be matching in - * order and consecutively. - * - * Supported FIELDs for field-restricted queries: - * - * * `feature_id` - * * `description` - * * `entity_type_id` - * - * Examples: - * - * * `feature_id: foo` --> Matches a Feature with ID containing the substring - * `foo` (eg. `foo`, `foofeature`, `barfoo`). - * * `feature_id: foo*feature` --> Matches a Feature with ID containing the - * substring `foo*feature` (eg. `foobarfeature`). - * * `feature_id: foo AND description: bar` --> Matches a Feature with ID - * containing the substring `foo` and description containing the substring - * `bar`. - * - * - * Besides field queries, the following exact-match filters are - * supported. The exact-match filters do not support wildcards. Unlike - * field-restricted queries, exact-match filters are case-sensitive. - * - * * `feature_id`: Supports = comparisons. - * * `description`: Supports = comparisons. Multi-token filters should be - * enclosed in quotes. - * * `entity_type_id`: Supports = comparisons. - * * `value_type`: Supports = and != comparisons. - * * `labels`: Supports key-value equality as well as key presence. - * * `featurestore_id`: Supports = comparisons. - * - * Examples: - * - * * `description = "foo bar"` --> Any Feature with description exactly equal - * to `foo bar` - * * `value_type = DOUBLE` --> Features whose type is DOUBLE. - * * `labels.active = yes AND labels.env = prod` --> Features having both - * (active: yes) and (env: prod) labels. - * * `labels.env: *` --> Any Feature which has a label with `env` as the - * key. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function searchFeatures($location, array $optionalArgs = []) - { - $request = new SearchFeaturesRequest(); - $requestParamHeaders = []; - $request->setLocation($location); - $requestParamHeaders['location'] = $location; - if (isset($optionalArgs['query'])) { - $request->setQuery($optionalArgs['query']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'SearchFeatures', - $optionalArgs, - SearchFeaturesResponse::class, - $request - ); - } - - /** - * Updates the parameters of a single EntityType. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $entityType = new EntityType(); - * $response = $featurestoreServiceClient->updateEntityType($entityType); - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param EntityType $entityType Required. The EntityType's `name` field is used to identify the EntityType - * to be updated. Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * EntityType resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then only the non-empty fields present in the - * request will be overwritten. Set the update_mask to `*` to override all - * fields. - * - * Updatable fields: - * - * * `description` - * * `labels` - * * `monitoring_config.snapshot_analysis.disabled` - * * `monitoring_config.snapshot_analysis.monitoring_interval_days` - * * `monitoring_config.snapshot_analysis.staleness_days` - * * `monitoring_config.import_features_analysis.state` - * * `monitoring_config.import_features_analysis.anomaly_detection_baseline` - * * `monitoring_config.numerical_threshold_config.value` - * * `monitoring_config.categorical_threshold_config.value` - * * `offline_storage_ttl_days` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\EntityType - * - * @throws ApiException if the remote call fails - */ - public function updateEntityType($entityType, array $optionalArgs = []) - { - $request = new UpdateEntityTypeRequest(); - $requestParamHeaders = []; - $request->setEntityType($entityType); - $requestParamHeaders['entity_type.name'] = $entityType->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateEntityType', - EntityType::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates the parameters of a single Feature. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $feature = new Feature(); - * $response = $featurestoreServiceClient->updateFeature($feature); - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param Feature $feature Required. The Feature's `name` field is used to identify the Feature to be - * updated. - * Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entity_type}/features/{feature}` - * `projects/{project}/locations/{location}/featureGroups/{feature_group}/features/{feature}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * Features resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then only the non-empty fields present in the - * request will be overwritten. Set the update_mask to `*` to override all - * fields. - * - * Updatable fields: - * - * * `description` - * * `labels` - * * `disable_monitoring` (Not supported for FeatureRegistry Feature) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Feature - * - * @throws ApiException if the remote call fails - */ - public function updateFeature($feature, array $optionalArgs = []) - { - $request = new UpdateFeatureRequest(); - $requestParamHeaders = []; - $request->setFeature($feature); - $requestParamHeaders['feature.name'] = $feature->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateFeature', - Feature::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates the parameters of a single Featurestore. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $featurestore = new Featurestore(); - * $operationResponse = $featurestoreServiceClient->updateFeaturestore($featurestore); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $featurestoreServiceClient->updateFeaturestore($featurestore); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $featurestoreServiceClient->resumeOperation($operationName, 'updateFeaturestore'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param Featurestore $featurestore Required. The Featurestore's `name` field is used to identify the - * Featurestore to be updated. Format: - * `projects/{project}/locations/{location}/featurestores/{featurestore}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * Featurestore resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then only the non-empty fields present in the - * request will be overwritten. Set the update_mask to `*` to override all - * fields. - * - * Updatable fields: - * - * * `labels` - * * `online_serving_config.fixed_node_count` - * * `online_serving_config.scaling` - * * `online_storage_ttl_days` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateFeaturestore($featurestore, array $optionalArgs = []) - { - $request = new UpdateFeaturestoreRequest(); - $requestParamHeaders = []; - $request->setFeaturestore($featurestore); - $requestParamHeaders['featurestore.name'] = $featurestore->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateFeaturestore', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $response = $featurestoreServiceClient->getLocation(); - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $featurestoreServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $featurestoreServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $resource = 'resource'; - * $response = $featurestoreServiceClient->getIamPolicy($resource); - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $featurestoreServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $featurestoreServiceClient = new FeaturestoreServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $featurestoreServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $featurestoreServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/GenAiTuningServiceGapicClient.php b/AiPlatform/src/V1/Gapic/GenAiTuningServiceGapicClient.php deleted file mode 100644 index e2cd1cb21b89..000000000000 --- a/AiPlatform/src/V1/Gapic/GenAiTuningServiceGapicClient.php +++ /dev/null @@ -1,1084 +0,0 @@ -tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - * $genAiTuningServiceClient->cancelTuningJob($formattedName); - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\GenAiTuningServiceClient}. - */ -class GenAiTuningServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.GenAiTuningService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $contextNameTemplate; - - private static $endpointNameTemplate; - - private static $locationNameTemplate; - - private static $modelNameTemplate; - - private static $projectLocationEndpointNameTemplate; - - private static $projectLocationPublisherModelNameTemplate; - - private static $tuningJobNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/gen_ai_tuning_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/gen_ai_tuning_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/gen_ai_tuning_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/gen_ai_tuning_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getContextNameTemplate() - { - if (self::$contextNameTemplate == null) { - self::$contextNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context}' - ); - } - - return self::$contextNameTemplate; - } - - private static function getEndpointNameTemplate() - { - if (self::$endpointNameTemplate == null) { - self::$endpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$endpointNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getModelNameTemplate() - { - if (self::$modelNameTemplate == null) { - self::$modelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/models/{model}' - ); - } - - return self::$modelNameTemplate; - } - - private static function getProjectLocationEndpointNameTemplate() - { - if (self::$projectLocationEndpointNameTemplate == null) { - self::$projectLocationEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$projectLocationEndpointNameTemplate; - } - - private static function getProjectLocationPublisherModelNameTemplate() - { - if (self::$projectLocationPublisherModelNameTemplate == null) { - self::$projectLocationPublisherModelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/publishers/{publisher}/models/{model}' - ); - } - - return self::$projectLocationPublisherModelNameTemplate; - } - - private static function getTuningJobNameTemplate() - { - if (self::$tuningJobNameTemplate == null) { - self::$tuningJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/tuningJobs/{tuning_job}' - ); - } - - return self::$tuningJobNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'context' => self::getContextNameTemplate(), - 'endpoint' => self::getEndpointNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'model' => self::getModelNameTemplate(), - 'projectLocationEndpoint' => self::getProjectLocationEndpointNameTemplate(), - 'projectLocationPublisherModel' => self::getProjectLocationPublisherModelNameTemplate(), - 'tuningJob' => self::getTuningJobNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a context - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $context - * - * @return string The formatted context resource. - */ - public static function contextName( - $project, - $location, - $metadataStore, - $context - ) { - return self::getContextNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'context' => $context, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a endpoint - * resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted endpoint resource. - */ - public static function endpointName($project, $location, $endpoint) - { - return self::getEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName($project, $location, $model) - { - return self::getModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted project_location_endpoint resource. - */ - public static function projectLocationEndpointName( - $project, - $location, - $endpoint - ) { - return self::getProjectLocationEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_publisher_model resource. - * - * @param string $project - * @param string $location - * @param string $publisher - * @param string $model - * - * @return string The formatted project_location_publisher_model resource. - */ - public static function projectLocationPublisherModelName( - $project, - $location, - $publisher, - $model - ) { - return self::getProjectLocationPublisherModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'publisher' => $publisher, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a tuning_job - * resource. - * - * @param string $project - * @param string $location - * @param string $tuningJob - * - * @return string The formatted tuning_job resource. - */ - public static function tuningJobName($project, $location, $tuningJob) - { - return self::getTuningJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'tuning_job' => $tuningJob, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - context: projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context} - * - endpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - location: projects/{project}/locations/{location} - * - model: projects/{project}/locations/{location}/models/{model} - * - projectLocationEndpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - projectLocationPublisherModel: projects/{project}/locations/{location}/publishers/{publisher}/models/{model} - * - tuningJob: projects/{project}/locations/{location}/tuningJobs/{tuning_job} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Cancels a TuningJob. - * Starts asynchronous cancellation on the TuningJob. The server makes a best - * effort to cancel the job, but success is not guaranteed. Clients can use - * [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] - * or other methods to check whether the cancellation succeeded or whether the - * job completed despite cancellation. On successful cancellation, the - * TuningJob is not deleted; instead it becomes a job with a - * [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - * `Code.CANCELLED`, and - * [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to - * `CANCELLED`. - * - * Sample code: - * ``` - * $genAiTuningServiceClient = new GenAiTuningServiceClient(); - * try { - * $formattedName = $genAiTuningServiceClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - * $genAiTuningServiceClient->cancelTuningJob($formattedName); - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TuningJob to cancel. Format: - * `projects/{project}/locations/{location}/tuningJobs/{tuning_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function cancelTuningJob($name, array $optionalArgs = []) - { - $request = new CancelTuningJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CancelTuningJob', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a TuningJob. A created TuningJob right away will be attempted to - * be run. - * - * Sample code: - * ``` - * $genAiTuningServiceClient = new GenAiTuningServiceClient(); - * try { - * $formattedParent = $genAiTuningServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $tuningJob = new TuningJob(); - * $response = $genAiTuningServiceClient->createTuningJob($formattedParent, $tuningJob); - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the TuningJob in. - * Format: `projects/{project}/locations/{location}` - * @param TuningJob $tuningJob Required. The TuningJob to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TuningJob - * - * @throws ApiException if the remote call fails - */ - public function createTuningJob( - $parent, - $tuningJob, - array $optionalArgs = [] - ) { - $request = new CreateTuningJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setTuningJob($tuningJob); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateTuningJob', - TuningJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a TuningJob. - * - * Sample code: - * ``` - * $genAiTuningServiceClient = new GenAiTuningServiceClient(); - * try { - * $formattedName = $genAiTuningServiceClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - * $response = $genAiTuningServiceClient->getTuningJob($formattedName); - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TuningJob resource. Format: - * `projects/{project}/locations/{location}/tuningJobs/{tuning_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TuningJob - * - * @throws ApiException if the remote call fails - */ - public function getTuningJob($name, array $optionalArgs = []) - { - $request = new GetTuningJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetTuningJob', - TuningJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists TuningJobs in a Location. - * - * Sample code: - * ``` - * $genAiTuningServiceClient = new GenAiTuningServiceClient(); - * try { - * $formattedParent = $genAiTuningServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $genAiTuningServiceClient->listTuningJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $genAiTuningServiceClient->listTuningJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the TuningJobs from. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTuningJobs($parent, array $optionalArgs = []) - { - $request = new ListTuningJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListTuningJobs', - $optionalArgs, - ListTuningJobsResponse::class, - $request - ); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $genAiTuningServiceClient = new GenAiTuningServiceClient(); - * try { - * $response = $genAiTuningServiceClient->getLocation(); - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $genAiTuningServiceClient = new GenAiTuningServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $genAiTuningServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $genAiTuningServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $genAiTuningServiceClient = new GenAiTuningServiceClient(); - * try { - * $resource = 'resource'; - * $response = $genAiTuningServiceClient->getIamPolicy($resource); - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $genAiTuningServiceClient = new GenAiTuningServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $genAiTuningServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $genAiTuningServiceClient = new GenAiTuningServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $genAiTuningServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $genAiTuningServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/IndexEndpointServiceGapicClient.php b/AiPlatform/src/V1/Gapic/IndexEndpointServiceGapicClient.php deleted file mode 100644 index 61c43d7399f4..000000000000 --- a/AiPlatform/src/V1/Gapic/IndexEndpointServiceGapicClient.php +++ /dev/null @@ -1,1374 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $indexEndpoint = new IndexEndpoint(); - * $operationResponse = $indexEndpointServiceClient->createIndexEndpoint($formattedParent, $indexEndpoint); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexEndpointServiceClient->createIndexEndpoint($formattedParent, $indexEndpoint); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexEndpointServiceClient->resumeOperation($operationName, 'createIndexEndpoint'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\IndexEndpointServiceClient}. - */ -class IndexEndpointServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.IndexEndpointService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $indexNameTemplate; - - private static $indexEndpointNameTemplate; - - private static $locationNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/index_endpoint_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/index_endpoint_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/index_endpoint_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/index_endpoint_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getIndexNameTemplate() - { - if (self::$indexNameTemplate == null) { - self::$indexNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/indexes/{index}' - ); - } - - return self::$indexNameTemplate; - } - - private static function getIndexEndpointNameTemplate() - { - if (self::$indexEndpointNameTemplate == null) { - self::$indexEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}' - ); - } - - return self::$indexEndpointNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'index' => self::getIndexNameTemplate(), - 'indexEndpoint' => self::getIndexEndpointNameTemplate(), - 'location' => self::getLocationNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a index - * resource. - * - * @param string $project - * @param string $location - * @param string $index - * - * @return string The formatted index resource. - */ - public static function indexName($project, $location, $index) - { - return self::getIndexNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'index' => $index, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * index_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $indexEndpoint - * - * @return string The formatted index_endpoint resource. - */ - public static function indexEndpointName( - $project, - $location, - $indexEndpoint - ) { - return self::getIndexEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'index_endpoint' => $indexEndpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - index: projects/{project}/locations/{location}/indexes/{index} - * - indexEndpoint: projects/{project}/locations/{location}/indexEndpoints/{index_endpoint} - * - location: projects/{project}/locations/{location} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates an IndexEndpoint. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $formattedParent = $indexEndpointServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $indexEndpoint = new IndexEndpoint(); - * $operationResponse = $indexEndpointServiceClient->createIndexEndpoint($formattedParent, $indexEndpoint); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexEndpointServiceClient->createIndexEndpoint($formattedParent, $indexEndpoint); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexEndpointServiceClient->resumeOperation($operationName, 'createIndexEndpoint'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the IndexEndpoint in. - * Format: `projects/{project}/locations/{location}` - * @param IndexEndpoint $indexEndpoint Required. The IndexEndpoint to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createIndexEndpoint( - $parent, - $indexEndpoint, - array $optionalArgs = [] - ) { - $request = new CreateIndexEndpointRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setIndexEndpoint($indexEndpoint); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateIndexEndpoint', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes an IndexEndpoint. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $formattedName = $indexEndpointServiceClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - * $operationResponse = $indexEndpointServiceClient->deleteIndexEndpoint($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexEndpointServiceClient->deleteIndexEndpoint($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexEndpointServiceClient->resumeOperation($operationName, 'deleteIndexEndpoint'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the IndexEndpoint resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteIndexEndpoint($name, array $optionalArgs = []) - { - $request = new DeleteIndexEndpointRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteIndexEndpoint', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deploys an Index into this IndexEndpoint, creating a DeployedIndex within - * it. - * Only non-empty Indexes can be deployed. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $formattedIndexEndpoint = $indexEndpointServiceClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - * $deployedIndex = new DeployedIndex(); - * $operationResponse = $indexEndpointServiceClient->deployIndex($formattedIndexEndpoint, $deployedIndex); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexEndpointServiceClient->deployIndex($formattedIndexEndpoint, $deployedIndex); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexEndpointServiceClient->resumeOperation($operationName, 'deployIndex'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $indexEndpoint Required. The name of the IndexEndpoint resource into which to deploy an - * Index. Format: - * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` - * @param DeployedIndex $deployedIndex Required. The DeployedIndex to be created within the IndexEndpoint. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deployIndex( - $indexEndpoint, - $deployedIndex, - array $optionalArgs = [] - ) { - $request = new DeployIndexRequest(); - $requestParamHeaders = []; - $request->setIndexEndpoint($indexEndpoint); - $request->setDeployedIndex($deployedIndex); - $requestParamHeaders['index_endpoint'] = $indexEndpoint; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeployIndex', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets an IndexEndpoint. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $formattedName = $indexEndpointServiceClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - * $response = $indexEndpointServiceClient->getIndexEndpoint($formattedName); - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the IndexEndpoint resource. - * Format: - * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\IndexEndpoint - * - * @throws ApiException if the remote call fails - */ - public function getIndexEndpoint($name, array $optionalArgs = []) - { - $request = new GetIndexEndpointRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIndexEndpoint', - IndexEndpoint::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists IndexEndpoints in a Location. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $formattedParent = $indexEndpointServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $indexEndpointServiceClient->listIndexEndpoints($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $indexEndpointServiceClient->listIndexEndpoints($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location from which to list the - * IndexEndpoints. Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. An expression for filtering the results of the request. For field - * names both snake_case and camelCase are supported. - * - * * `index_endpoint` supports = and !=. `index_endpoint` represents the - * IndexEndpoint ID, ie. the last segment of the IndexEndpoint's - * [resourcename][google.cloud.aiplatform.v1.IndexEndpoint.name]. - * * `display_name` supports =, != and regex() - * (uses [re2](https://github.com/google/re2/wiki/Syntax) syntax) - * * `labels` supports general map functions that is: - * `labels.key=value` - key:value equality - * `labels.key:* or labels:key - key existence - * A key including a space must be quoted. `labels."a key"`. - * - * Some examples: - * * `index_endpoint="1"` - * * `display_name="myDisplayName"` - * * `regex(display_name, "^A") -> The display name starts with an A. - * * `labels.myKey="myValue"` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Optional. Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listIndexEndpoints($parent, array $optionalArgs = []) - { - $request = new ListIndexEndpointsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListIndexEndpoints', - $optionalArgs, - ListIndexEndpointsResponse::class, - $request - ); - } - - /** - * Update an existing DeployedIndex under an IndexEndpoint. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $formattedIndexEndpoint = $indexEndpointServiceClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - * $deployedIndex = new DeployedIndex(); - * $operationResponse = $indexEndpointServiceClient->mutateDeployedIndex($formattedIndexEndpoint, $deployedIndex); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexEndpointServiceClient->mutateDeployedIndex($formattedIndexEndpoint, $deployedIndex); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexEndpointServiceClient->resumeOperation($operationName, 'mutateDeployedIndex'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $indexEndpoint Required. The name of the IndexEndpoint resource into which to deploy an - * Index. Format: - * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` - * @param DeployedIndex $deployedIndex Required. The DeployedIndex to be updated within the IndexEndpoint. - * Currently, the updatable fields are [DeployedIndex][automatic_resources] - * and [DeployedIndex][dedicated_resources] - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function mutateDeployedIndex( - $indexEndpoint, - $deployedIndex, - array $optionalArgs = [] - ) { - $request = new MutateDeployedIndexRequest(); - $requestParamHeaders = []; - $request->setIndexEndpoint($indexEndpoint); - $request->setDeployedIndex($deployedIndex); - $requestParamHeaders['index_endpoint'] = $indexEndpoint; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'MutateDeployedIndex', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it, - * and freeing all resources it's using. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $formattedIndexEndpoint = $indexEndpointServiceClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - * $deployedIndexId = 'deployed_index_id'; - * $operationResponse = $indexEndpointServiceClient->undeployIndex($formattedIndexEndpoint, $deployedIndexId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexEndpointServiceClient->undeployIndex($formattedIndexEndpoint, $deployedIndexId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexEndpointServiceClient->resumeOperation($operationName, 'undeployIndex'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $indexEndpoint Required. The name of the IndexEndpoint resource from which to undeploy an - * Index. Format: - * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` - * @param string $deployedIndexId Required. The ID of the DeployedIndex to be undeployed from the - * IndexEndpoint. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function undeployIndex( - $indexEndpoint, - $deployedIndexId, - array $optionalArgs = [] - ) { - $request = new UndeployIndexRequest(); - $requestParamHeaders = []; - $request->setIndexEndpoint($indexEndpoint); - $request->setDeployedIndexId($deployedIndexId); - $requestParamHeaders['index_endpoint'] = $indexEndpoint; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UndeployIndex', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates an IndexEndpoint. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $indexEndpoint = new IndexEndpoint(); - * $updateMask = new FieldMask(); - * $response = $indexEndpointServiceClient->updateIndexEndpoint($indexEndpoint, $updateMask); - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param IndexEndpoint $indexEndpoint Required. The IndexEndpoint which replaces the resource on the server. - * @param FieldMask $updateMask Required. The update mask applies to the resource. See - * [google.protobuf.FieldMask][google.protobuf.FieldMask]. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\IndexEndpoint - * - * @throws ApiException if the remote call fails - */ - public function updateIndexEndpoint( - $indexEndpoint, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateIndexEndpointRequest(); - $requestParamHeaders = []; - $request->setIndexEndpoint($indexEndpoint); - $request->setUpdateMask($updateMask); - $requestParamHeaders['index_endpoint.name'] = $indexEndpoint->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateIndexEndpoint', - IndexEndpoint::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $response = $indexEndpointServiceClient->getLocation(); - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $indexEndpointServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $indexEndpointServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $resource = 'resource'; - * $response = $indexEndpointServiceClient->getIamPolicy($resource); - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $indexEndpointServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $indexEndpointServiceClient = new IndexEndpointServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $indexEndpointServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $indexEndpointServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/IndexServiceGapicClient.php b/AiPlatform/src/V1/Gapic/IndexServiceGapicClient.php deleted file mode 100644 index 4baf2652b975..000000000000 --- a/AiPlatform/src/V1/Gapic/IndexServiceGapicClient.php +++ /dev/null @@ -1,1256 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $index = new Index(); - * $operationResponse = $indexServiceClient->createIndex($formattedParent, $index); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexServiceClient->createIndex($formattedParent, $index); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexServiceClient->resumeOperation($operationName, 'createIndex'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\IndexServiceClient}. - */ -class IndexServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.IndexService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $indexNameTemplate; - - private static $indexEndpointNameTemplate; - - private static $locationNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/index_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/index_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/index_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/index_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getIndexNameTemplate() - { - if (self::$indexNameTemplate == null) { - self::$indexNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/indexes/{index}' - ); - } - - return self::$indexNameTemplate; - } - - private static function getIndexEndpointNameTemplate() - { - if (self::$indexEndpointNameTemplate == null) { - self::$indexEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}' - ); - } - - return self::$indexEndpointNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'index' => self::getIndexNameTemplate(), - 'indexEndpoint' => self::getIndexEndpointNameTemplate(), - 'location' => self::getLocationNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a index - * resource. - * - * @param string $project - * @param string $location - * @param string $index - * - * @return string The formatted index resource. - */ - public static function indexName($project, $location, $index) - { - return self::getIndexNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'index' => $index, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * index_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $indexEndpoint - * - * @return string The formatted index_endpoint resource. - */ - public static function indexEndpointName( - $project, - $location, - $indexEndpoint - ) { - return self::getIndexEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'index_endpoint' => $indexEndpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - index: projects/{project}/locations/{location}/indexes/{index} - * - indexEndpoint: projects/{project}/locations/{location}/indexEndpoints/{index_endpoint} - * - location: projects/{project}/locations/{location} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates an Index. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $formattedParent = $indexServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $index = new Index(); - * $operationResponse = $indexServiceClient->createIndex($formattedParent, $index); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexServiceClient->createIndex($formattedParent, $index); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexServiceClient->resumeOperation($operationName, 'createIndex'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the Index in. - * Format: `projects/{project}/locations/{location}` - * @param Index $index Required. The Index to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createIndex($parent, $index, array $optionalArgs = []) - { - $request = new CreateIndexRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setIndex($index); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateIndex', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes an Index. - * An Index can only be deleted when all its - * [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had - * been undeployed. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $formattedName = $indexServiceClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - * $operationResponse = $indexServiceClient->deleteIndex($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexServiceClient->deleteIndex($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexServiceClient->resumeOperation($operationName, 'deleteIndex'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Index resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/indexes/{index}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteIndex($name, array $optionalArgs = []) - { - $request = new DeleteIndexRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteIndex', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets an Index. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $formattedName = $indexServiceClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - * $response = $indexServiceClient->getIndex($formattedName); - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Index resource. - * Format: - * `projects/{project}/locations/{location}/indexes/{index}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Index - * - * @throws ApiException if the remote call fails - */ - public function getIndex($name, array $optionalArgs = []) - { - $request = new GetIndexRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIndex', - Index::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists Indexes in a Location. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $formattedParent = $indexServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $indexServiceClient->listIndexes($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $indexServiceClient->listIndexes($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location from which to list the Indexes. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listIndexes($parent, array $optionalArgs = []) - { - $request = new ListIndexesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListIndexes', - $optionalArgs, - ListIndexesResponse::class, - $request - ); - } - - /** - * Remove Datapoints from an Index. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $formattedIndex = $indexServiceClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - * $response = $indexServiceClient->removeDatapoints($formattedIndex); - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param string $index Required. The name of the Index resource to be updated. - * Format: - * `projects/{project}/locations/{location}/indexes/{index}` - * @param array $optionalArgs { - * Optional. - * - * @type string[] $datapointIds - * A list of datapoint ids to be deleted. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\RemoveDatapointsResponse - * - * @throws ApiException if the remote call fails - */ - public function removeDatapoints($index, array $optionalArgs = []) - { - $request = new RemoveDatapointsRequest(); - $requestParamHeaders = []; - $request->setIndex($index); - $requestParamHeaders['index'] = $index; - if (isset($optionalArgs['datapointIds'])) { - $request->setDatapointIds($optionalArgs['datapointIds']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'RemoveDatapoints', - RemoveDatapointsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates an Index. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $index = new Index(); - * $operationResponse = $indexServiceClient->updateIndex($index); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $indexServiceClient->updateIndex($index); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $indexServiceClient->resumeOperation($operationName, 'updateIndex'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param Index $index Required. The Index which updates the resource on the server. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * The update mask applies to the resource. - * For the `FieldMask` definition, see - * [google.protobuf.FieldMask][google.protobuf.FieldMask]. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateIndex($index, array $optionalArgs = []) - { - $request = new UpdateIndexRequest(); - $requestParamHeaders = []; - $request->setIndex($index); - $requestParamHeaders['index.name'] = $index->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateIndex', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Add/update Datapoints into an Index. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $formattedIndex = $indexServiceClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - * $response = $indexServiceClient->upsertDatapoints($formattedIndex); - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param string $index Required. The name of the Index resource to be updated. - * Format: - * `projects/{project}/locations/{location}/indexes/{index}` - * @param array $optionalArgs { - * Optional. - * - * @type IndexDatapoint[] $datapoints - * A list of datapoints to be created/updated. - * @type FieldMask $updateMask - * Optional. Update mask is used to specify the fields to be overwritten in - * the datapoints by the update. The fields specified in the update_mask are - * relative to each IndexDatapoint inside datapoints, not the full request. - * - * Updatable fields: - * - * * Use `all_restricts` to update both restricts and numeric_restricts. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\UpsertDatapointsResponse - * - * @throws ApiException if the remote call fails - */ - public function upsertDatapoints($index, array $optionalArgs = []) - { - $request = new UpsertDatapointsRequest(); - $requestParamHeaders = []; - $request->setIndex($index); - $requestParamHeaders['index'] = $index; - if (isset($optionalArgs['datapoints'])) { - $request->setDatapoints($optionalArgs['datapoints']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpsertDatapoints', - UpsertDatapointsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $response = $indexServiceClient->getLocation(); - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $indexServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $indexServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $resource = 'resource'; - * $response = $indexServiceClient->getIamPolicy($resource); - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $indexServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $indexServiceClient = new IndexServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $indexServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $indexServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/JobServiceGapicClient.php b/AiPlatform/src/V1/Gapic/JobServiceGapicClient.php deleted file mode 100644 index 7b9aa5313d05..000000000000 --- a/AiPlatform/src/V1/Gapic/JobServiceGapicClient.php +++ /dev/null @@ -1,3852 +0,0 @@ -batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - * $jobServiceClient->cancelBatchPredictionJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\JobServiceClient}. - */ -class JobServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.JobService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - ]; - - private static $batchPredictionJobNameTemplate; - - private static $contextNameTemplate; - - private static $customJobNameTemplate; - - private static $dataLabelingJobNameTemplate; - - private static $datasetNameTemplate; - - private static $endpointNameTemplate; - - private static $hyperparameterTuningJobNameTemplate; - - private static $locationNameTemplate; - - private static $modelNameTemplate; - - private static $modelDeploymentMonitoringJobNameTemplate; - - private static $nasJobNameTemplate; - - private static $nasTrialDetailNameTemplate; - - private static $networkNameTemplate; - - private static $notificationChannelNameTemplate; - - private static $persistentResourceNameTemplate; - - private static $projectLocationEndpointNameTemplate; - - private static $projectLocationPublisherModelNameTemplate; - - private static $tensorboardNameTemplate; - - private static $trialNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/job_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/job_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/job_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/job_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getBatchPredictionJobNameTemplate() - { - if (self::$batchPredictionJobNameTemplate == null) { - self::$batchPredictionJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job}' - ); - } - - return self::$batchPredictionJobNameTemplate; - } - - private static function getContextNameTemplate() - { - if (self::$contextNameTemplate == null) { - self::$contextNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context}' - ); - } - - return self::$contextNameTemplate; - } - - private static function getCustomJobNameTemplate() - { - if (self::$customJobNameTemplate == null) { - self::$customJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/customJobs/{custom_job}' - ); - } - - return self::$customJobNameTemplate; - } - - private static function getDataLabelingJobNameTemplate() - { - if (self::$dataLabelingJobNameTemplate == null) { - self::$dataLabelingJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}' - ); - } - - return self::$dataLabelingJobNameTemplate; - } - - private static function getDatasetNameTemplate() - { - if (self::$datasetNameTemplate == null) { - self::$datasetNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/datasets/{dataset}' - ); - } - - return self::$datasetNameTemplate; - } - - private static function getEndpointNameTemplate() - { - if (self::$endpointNameTemplate == null) { - self::$endpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$endpointNameTemplate; - } - - private static function getHyperparameterTuningJobNameTemplate() - { - if (self::$hyperparameterTuningJobNameTemplate == null) { - self::$hyperparameterTuningJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/hyperparameterTuningJobs/{hyperparameter_tuning_job}' - ); - } - - return self::$hyperparameterTuningJobNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getModelNameTemplate() - { - if (self::$modelNameTemplate == null) { - self::$modelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/models/{model}' - ); - } - - return self::$modelNameTemplate; - } - - private static function getModelDeploymentMonitoringJobNameTemplate() - { - if (self::$modelDeploymentMonitoringJobNameTemplate == null) { - self::$modelDeploymentMonitoringJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}' - ); - } - - return self::$modelDeploymentMonitoringJobNameTemplate; - } - - private static function getNasJobNameTemplate() - { - if (self::$nasJobNameTemplate == null) { - self::$nasJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/nasJobs/{nas_job}' - ); - } - - return self::$nasJobNameTemplate; - } - - private static function getNasTrialDetailNameTemplate() - { - if (self::$nasTrialDetailNameTemplate == null) { - self::$nasTrialDetailNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/nasJobs/{nas_job}/nasTrialDetails/{nas_trial_detail}' - ); - } - - return self::$nasTrialDetailNameTemplate; - } - - private static function getNetworkNameTemplate() - { - if (self::$networkNameTemplate == null) { - self::$networkNameTemplate = new PathTemplate( - 'projects/{project}/global/networks/{network}' - ); - } - - return self::$networkNameTemplate; - } - - private static function getNotificationChannelNameTemplate() - { - if (self::$notificationChannelNameTemplate == null) { - self::$notificationChannelNameTemplate = new PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ); - } - - return self::$notificationChannelNameTemplate; - } - - private static function getPersistentResourceNameTemplate() - { - if (self::$persistentResourceNameTemplate == null) { - self::$persistentResourceNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/persistentResources/{persistent_resource}' - ); - } - - return self::$persistentResourceNameTemplate; - } - - private static function getProjectLocationEndpointNameTemplate() - { - if (self::$projectLocationEndpointNameTemplate == null) { - self::$projectLocationEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$projectLocationEndpointNameTemplate; - } - - private static function getProjectLocationPublisherModelNameTemplate() - { - if (self::$projectLocationPublisherModelNameTemplate == null) { - self::$projectLocationPublisherModelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/publishers/{publisher}/models/{model}' - ); - } - - return self::$projectLocationPublisherModelNameTemplate; - } - - private static function getTensorboardNameTemplate() - { - if (self::$tensorboardNameTemplate == null) { - self::$tensorboardNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/tensorboards/{tensorboard}' - ); - } - - return self::$tensorboardNameTemplate; - } - - private static function getTrialNameTemplate() - { - if (self::$trialNameTemplate == null) { - self::$trialNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/studies/{study}/trials/{trial}' - ); - } - - return self::$trialNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'batchPredictionJob' => self::getBatchPredictionJobNameTemplate(), - 'context' => self::getContextNameTemplate(), - 'customJob' => self::getCustomJobNameTemplate(), - 'dataLabelingJob' => self::getDataLabelingJobNameTemplate(), - 'dataset' => self::getDatasetNameTemplate(), - 'endpoint' => self::getEndpointNameTemplate(), - 'hyperparameterTuningJob' => self::getHyperparameterTuningJobNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'model' => self::getModelNameTemplate(), - 'modelDeploymentMonitoringJob' => self::getModelDeploymentMonitoringJobNameTemplate(), - 'nasJob' => self::getNasJobNameTemplate(), - 'nasTrialDetail' => self::getNasTrialDetailNameTemplate(), - 'network' => self::getNetworkNameTemplate(), - 'notificationChannel' => self::getNotificationChannelNameTemplate(), - 'persistentResource' => self::getPersistentResourceNameTemplate(), - 'projectLocationEndpoint' => self::getProjectLocationEndpointNameTemplate(), - 'projectLocationPublisherModel' => self::getProjectLocationPublisherModelNameTemplate(), - 'tensorboard' => self::getTensorboardNameTemplate(), - 'trial' => self::getTrialNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * batch_prediction_job resource. - * - * @param string $project - * @param string $location - * @param string $batchPredictionJob - * - * @return string The formatted batch_prediction_job resource. - */ - public static function batchPredictionJobName( - $project, - $location, - $batchPredictionJob - ) { - return self::getBatchPredictionJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'batch_prediction_job' => $batchPredictionJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a context - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $context - * - * @return string The formatted context resource. - */ - public static function contextName( - $project, - $location, - $metadataStore, - $context - ) { - return self::getContextNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'context' => $context, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a custom_job - * resource. - * - * @param string $project - * @param string $location - * @param string $customJob - * - * @return string The formatted custom_job resource. - */ - public static function customJobName($project, $location, $customJob) - { - return self::getCustomJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'custom_job' => $customJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * data_labeling_job resource. - * - * @param string $project - * @param string $location - * @param string $dataLabelingJob - * - * @return string The formatted data_labeling_job resource. - */ - public static function dataLabelingJobName( - $project, - $location, - $dataLabelingJob - ) { - return self::getDataLabelingJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'data_labeling_job' => $dataLabelingJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a dataset - * resource. - * - * @param string $project - * @param string $location - * @param string $dataset - * - * @return string The formatted dataset resource. - */ - public static function datasetName($project, $location, $dataset) - { - return self::getDatasetNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'dataset' => $dataset, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a endpoint - * resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted endpoint resource. - */ - public static function endpointName($project, $location, $endpoint) - { - return self::getEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * hyperparameter_tuning_job resource. - * - * @param string $project - * @param string $location - * @param string $hyperparameterTuningJob - * - * @return string The formatted hyperparameter_tuning_job resource. - */ - public static function hyperparameterTuningJobName( - $project, - $location, - $hyperparameterTuningJob - ) { - return self::getHyperparameterTuningJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'hyperparameter_tuning_job' => $hyperparameterTuningJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName($project, $location, $model) - { - return self::getModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * model_deployment_monitoring_job resource. - * - * @param string $project - * @param string $location - * @param string $modelDeploymentMonitoringJob - * - * @return string The formatted model_deployment_monitoring_job resource. - */ - public static function modelDeploymentMonitoringJobName( - $project, - $location, - $modelDeploymentMonitoringJob - ) { - return self::getModelDeploymentMonitoringJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model_deployment_monitoring_job' => $modelDeploymentMonitoringJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a nas_job - * resource. - * - * @param string $project - * @param string $location - * @param string $nasJob - * - * @return string The formatted nas_job resource. - */ - public static function nasJobName($project, $location, $nasJob) - { - return self::getNasJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'nas_job' => $nasJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * nas_trial_detail resource. - * - * @param string $project - * @param string $location - * @param string $nasJob - * @param string $nasTrialDetail - * - * @return string The formatted nas_trial_detail resource. - */ - public static function nasTrialDetailName( - $project, - $location, - $nasJob, - $nasTrialDetail - ) { - return self::getNasTrialDetailNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'nas_job' => $nasJob, - 'nas_trial_detail' => $nasTrialDetail, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a network - * resource. - * - * @param string $project - * @param string $network - * - * @return string The formatted network resource. - */ - public static function networkName($project, $network) - { - return self::getNetworkNameTemplate()->render([ - 'project' => $project, - 'network' => $network, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * notification_channel resource. - * - * @param string $project - * @param string $notificationChannel - * - * @return string The formatted notification_channel resource. - */ - public static function notificationChannelName( - $project, - $notificationChannel - ) { - return self::getNotificationChannelNameTemplate()->render([ - 'project' => $project, - 'notification_channel' => $notificationChannel, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * persistent_resource resource. - * - * @param string $project - * @param string $location - * @param string $persistentResource - * - * @return string The formatted persistent_resource resource. - */ - public static function persistentResourceName( - $project, - $location, - $persistentResource - ) { - return self::getPersistentResourceNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'persistent_resource' => $persistentResource, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted project_location_endpoint resource. - */ - public static function projectLocationEndpointName( - $project, - $location, - $endpoint - ) { - return self::getProjectLocationEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_publisher_model resource. - * - * @param string $project - * @param string $location - * @param string $publisher - * @param string $model - * - * @return string The formatted project_location_publisher_model resource. - */ - public static function projectLocationPublisherModelName( - $project, - $location, - $publisher, - $model - ) { - return self::getProjectLocationPublisherModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'publisher' => $publisher, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a tensorboard - * resource. - * - * @param string $project - * @param string $location - * @param string $tensorboard - * - * @return string The formatted tensorboard resource. - */ - public static function tensorboardName($project, $location, $tensorboard) - { - return self::getTensorboardNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'tensorboard' => $tensorboard, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a trial - * resource. - * - * @param string $project - * @param string $location - * @param string $study - * @param string $trial - * - * @return string The formatted trial resource. - */ - public static function trialName($project, $location, $study, $trial) - { - return self::getTrialNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'study' => $study, - 'trial' => $trial, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - batchPredictionJob: projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job} - * - context: projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context} - * - customJob: projects/{project}/locations/{location}/customJobs/{custom_job} - * - dataLabelingJob: projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job} - * - dataset: projects/{project}/locations/{location}/datasets/{dataset} - * - endpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - hyperparameterTuningJob: projects/{project}/locations/{location}/hyperparameterTuningJobs/{hyperparameter_tuning_job} - * - location: projects/{project}/locations/{location} - * - model: projects/{project}/locations/{location}/models/{model} - * - modelDeploymentMonitoringJob: projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job} - * - nasJob: projects/{project}/locations/{location}/nasJobs/{nas_job} - * - nasTrialDetail: projects/{project}/locations/{location}/nasJobs/{nas_job}/nasTrialDetails/{nas_trial_detail} - * - network: projects/{project}/global/networks/{network} - * - notificationChannel: projects/{project}/notificationChannels/{notification_channel} - * - persistentResource: projects/{project}/locations/{location}/persistentResources/{persistent_resource} - * - projectLocationEndpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - projectLocationPublisherModel: projects/{project}/locations/{location}/publishers/{publisher}/models/{model} - * - tensorboard: projects/{project}/locations/{location}/tensorboards/{tensorboard} - * - trial: projects/{project}/locations/{location}/studies/{study}/trials/{trial} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Cancels a BatchPredictionJob. - * - * Starts asynchronous cancellation on the BatchPredictionJob. The server - * makes the best effort to cancel the job, but success is not - * guaranteed. Clients can use - * [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob] - * or other methods to check whether the cancellation succeeded or whether the - * job completed despite cancellation. On a successful cancellation, - * the BatchPredictionJob is not deleted;instead its - * [BatchPredictionJob.state][google.cloud.aiplatform.v1.BatchPredictionJob.state] - * is set to `CANCELLED`. Any files already outputted by the job are not - * deleted. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - * $jobServiceClient->cancelBatchPredictionJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the BatchPredictionJob to cancel. - * Format: - * `projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function cancelBatchPredictionJob($name, array $optionalArgs = []) - { - $request = new CancelBatchPredictionJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CancelBatchPredictionJob', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Cancels a CustomJob. - * Starts asynchronous cancellation on the CustomJob. The server - * makes a best effort to cancel the job, but success is not - * guaranteed. Clients can use - * [JobService.GetCustomJob][google.cloud.aiplatform.v1.JobService.GetCustomJob] - * or other methods to check whether the cancellation succeeded or whether the - * job completed despite cancellation. On successful cancellation, - * the CustomJob is not deleted; instead it becomes a job with - * a [CustomJob.error][google.cloud.aiplatform.v1.CustomJob.error] value with - * a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - * `Code.CANCELLED`, and - * [CustomJob.state][google.cloud.aiplatform.v1.CustomJob.state] is set to - * `CANCELLED`. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - * $jobServiceClient->cancelCustomJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the CustomJob to cancel. - * Format: - * `projects/{project}/locations/{location}/customJobs/{custom_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function cancelCustomJob($name, array $optionalArgs = []) - { - $request = new CancelCustomJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CancelCustomJob', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Cancels a DataLabelingJob. Success of cancellation is not guaranteed. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - * $jobServiceClient->cancelDataLabelingJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the DataLabelingJob. - * Format: - * `projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function cancelDataLabelingJob($name, array $optionalArgs = []) - { - $request = new CancelDataLabelingJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CancelDataLabelingJob', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Cancels a HyperparameterTuningJob. - * Starts asynchronous cancellation on the HyperparameterTuningJob. The server - * makes a best effort to cancel the job, but success is not - * guaranteed. Clients can use - * [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob] - * or other methods to check whether the cancellation succeeded or whether the - * job completed despite cancellation. On successful cancellation, - * the HyperparameterTuningJob is not deleted; instead it becomes a job with - * a - * [HyperparameterTuningJob.error][google.cloud.aiplatform.v1.HyperparameterTuningJob.error] - * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`, and - * [HyperparameterTuningJob.state][google.cloud.aiplatform.v1.HyperparameterTuningJob.state] - * is set to `CANCELLED`. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - * $jobServiceClient->cancelHyperparameterTuningJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the HyperparameterTuningJob to cancel. - * Format: - * `projects/{project}/locations/{location}/hyperparameterTuningJobs/{hyperparameter_tuning_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function cancelHyperparameterTuningJob( - $name, - array $optionalArgs = [] - ) { - $request = new CancelHyperparameterTuningJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CancelHyperparameterTuningJob', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Cancels a NasJob. - * Starts asynchronous cancellation on the NasJob. The server - * makes a best effort to cancel the job, but success is not - * guaranteed. Clients can use - * [JobService.GetNasJob][google.cloud.aiplatform.v1.JobService.GetNasJob] or - * other methods to check whether the cancellation succeeded or whether the - * job completed despite cancellation. On successful cancellation, - * the NasJob is not deleted; instead it becomes a job with - * a [NasJob.error][google.cloud.aiplatform.v1.NasJob.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - * `Code.CANCELLED`, and - * [NasJob.state][google.cloud.aiplatform.v1.NasJob.state] is set to - * `CANCELLED`. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - * $jobServiceClient->cancelNasJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NasJob to cancel. - * Format: - * `projects/{project}/locations/{location}/nasJobs/{nas_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function cancelNasJob($name, array $optionalArgs = []) - { - $request = new CancelNasJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CancelNasJob', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a BatchPredictionJob. A BatchPredictionJob once created will - * right away be attempted to start. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $batchPredictionJob = new BatchPredictionJob(); - * $response = $jobServiceClient->createBatchPredictionJob($formattedParent, $batchPredictionJob); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the - * BatchPredictionJob in. Format: `projects/{project}/locations/{location}` - * @param BatchPredictionJob $batchPredictionJob Required. The BatchPredictionJob to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\BatchPredictionJob - * - * @throws ApiException if the remote call fails - */ - public function createBatchPredictionJob( - $parent, - $batchPredictionJob, - array $optionalArgs = [] - ) { - $request = new CreateBatchPredictionJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setBatchPredictionJob($batchPredictionJob); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateBatchPredictionJob', - BatchPredictionJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a CustomJob. A created CustomJob right away - * will be attempted to be run. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $customJob = new CustomJob(); - * $response = $jobServiceClient->createCustomJob($formattedParent, $customJob); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the CustomJob in. - * Format: `projects/{project}/locations/{location}` - * @param CustomJob $customJob Required. The CustomJob to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\CustomJob - * - * @throws ApiException if the remote call fails - */ - public function createCustomJob( - $parent, - $customJob, - array $optionalArgs = [] - ) { - $request = new CreateCustomJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setCustomJob($customJob); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateCustomJob', - CustomJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a DataLabelingJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $dataLabelingJob = new DataLabelingJob(); - * $response = $jobServiceClient->createDataLabelingJob($formattedParent, $dataLabelingJob); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent of the DataLabelingJob. - * Format: `projects/{project}/locations/{location}` - * @param DataLabelingJob $dataLabelingJob Required. The DataLabelingJob to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\DataLabelingJob - * - * @throws ApiException if the remote call fails - */ - public function createDataLabelingJob( - $parent, - $dataLabelingJob, - array $optionalArgs = [] - ) { - $request = new CreateDataLabelingJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDataLabelingJob($dataLabelingJob); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateDataLabelingJob', - DataLabelingJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a HyperparameterTuningJob - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $hyperparameterTuningJob = new HyperparameterTuningJob(); - * $response = $jobServiceClient->createHyperparameterTuningJob($formattedParent, $hyperparameterTuningJob); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the - * HyperparameterTuningJob in. Format: - * `projects/{project}/locations/{location}` - * @param HyperparameterTuningJob $hyperparameterTuningJob Required. The HyperparameterTuningJob to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\HyperparameterTuningJob - * - * @throws ApiException if the remote call fails - */ - public function createHyperparameterTuningJob( - $parent, - $hyperparameterTuningJob, - array $optionalArgs = [] - ) { - $request = new CreateHyperparameterTuningJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setHyperparameterTuningJob($hyperparameterTuningJob); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateHyperparameterTuningJob', - HyperparameterTuningJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a ModelDeploymentMonitoringJob. It will run periodically on a - * configured interval. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $modelDeploymentMonitoringJob = new ModelDeploymentMonitoringJob(); - * $response = $jobServiceClient->createModelDeploymentMonitoringJob($formattedParent, $modelDeploymentMonitoringJob); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent of the ModelDeploymentMonitoringJob. - * Format: `projects/{project}/locations/{location}` - * @param ModelDeploymentMonitoringJob $modelDeploymentMonitoringJob Required. The ModelDeploymentMonitoringJob to create - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob - * - * @throws ApiException if the remote call fails - */ - public function createModelDeploymentMonitoringJob( - $parent, - $modelDeploymentMonitoringJob, - array $optionalArgs = [] - ) { - $request = new CreateModelDeploymentMonitoringJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setModelDeploymentMonitoringJob( - $modelDeploymentMonitoringJob - ); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateModelDeploymentMonitoringJob', - ModelDeploymentMonitoringJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a NasJob - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $nasJob = new NasJob(); - * $response = $jobServiceClient->createNasJob($formattedParent, $nasJob); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the NasJob in. - * Format: `projects/{project}/locations/{location}` - * @param NasJob $nasJob Required. The NasJob to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\NasJob - * - * @throws ApiException if the remote call fails - */ - public function createNasJob($parent, $nasJob, array $optionalArgs = []) - { - $request = new CreateNasJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setNasJob($nasJob); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateNasJob', - NasJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes a BatchPredictionJob. Can only be called on jobs that already - * finished. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - * $operationResponse = $jobServiceClient->deleteBatchPredictionJob($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $jobServiceClient->deleteBatchPredictionJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobServiceClient->resumeOperation($operationName, 'deleteBatchPredictionJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the BatchPredictionJob resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteBatchPredictionJob($name, array $optionalArgs = []) - { - $request = new DeleteBatchPredictionJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteBatchPredictionJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a CustomJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - * $operationResponse = $jobServiceClient->deleteCustomJob($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $jobServiceClient->deleteCustomJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobServiceClient->resumeOperation($operationName, 'deleteCustomJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the CustomJob resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/customJobs/{custom_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteCustomJob($name, array $optionalArgs = []) - { - $request = new DeleteCustomJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteCustomJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a DataLabelingJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - * $operationResponse = $jobServiceClient->deleteDataLabelingJob($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $jobServiceClient->deleteDataLabelingJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobServiceClient->resumeOperation($operationName, 'deleteDataLabelingJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the DataLabelingJob to be deleted. - * Format: - * `projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteDataLabelingJob($name, array $optionalArgs = []) - { - $request = new DeleteDataLabelingJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteDataLabelingJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a HyperparameterTuningJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - * $operationResponse = $jobServiceClient->deleteHyperparameterTuningJob($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $jobServiceClient->deleteHyperparameterTuningJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobServiceClient->resumeOperation($operationName, 'deleteHyperparameterTuningJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the HyperparameterTuningJob resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/hyperparameterTuningJobs/{hyperparameter_tuning_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteHyperparameterTuningJob( - $name, - array $optionalArgs = [] - ) { - $request = new DeleteHyperparameterTuningJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteHyperparameterTuningJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a ModelDeploymentMonitoringJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - * $operationResponse = $jobServiceClient->deleteModelDeploymentMonitoringJob($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $jobServiceClient->deleteModelDeploymentMonitoringJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobServiceClient->resumeOperation($operationName, 'deleteModelDeploymentMonitoringJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the model monitoring job to delete. - * Format: - * `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteModelDeploymentMonitoringJob( - $name, - array $optionalArgs = [] - ) { - $request = new DeleteModelDeploymentMonitoringJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteModelDeploymentMonitoringJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a NasJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - * $operationResponse = $jobServiceClient->deleteNasJob($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $jobServiceClient->deleteNasJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobServiceClient->resumeOperation($operationName, 'deleteNasJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NasJob resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/nasJobs/{nas_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteNasJob($name, array $optionalArgs = []) - { - $request = new DeleteNasJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteNasJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets a BatchPredictionJob - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - * $response = $jobServiceClient->getBatchPredictionJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the BatchPredictionJob resource. - * Format: - * `projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\BatchPredictionJob - * - * @throws ApiException if the remote call fails - */ - public function getBatchPredictionJob($name, array $optionalArgs = []) - { - $request = new GetBatchPredictionJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetBatchPredictionJob', - BatchPredictionJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a CustomJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - * $response = $jobServiceClient->getCustomJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the CustomJob resource. - * Format: - * `projects/{project}/locations/{location}/customJobs/{custom_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\CustomJob - * - * @throws ApiException if the remote call fails - */ - public function getCustomJob($name, array $optionalArgs = []) - { - $request = new GetCustomJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetCustomJob', - CustomJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a DataLabelingJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - * $response = $jobServiceClient->getDataLabelingJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the DataLabelingJob. - * Format: - * `projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\DataLabelingJob - * - * @throws ApiException if the remote call fails - */ - public function getDataLabelingJob($name, array $optionalArgs = []) - { - $request = new GetDataLabelingJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetDataLabelingJob', - DataLabelingJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a HyperparameterTuningJob - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - * $response = $jobServiceClient->getHyperparameterTuningJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the HyperparameterTuningJob resource. - * Format: - * `projects/{project}/locations/{location}/hyperparameterTuningJobs/{hyperparameter_tuning_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\HyperparameterTuningJob - * - * @throws ApiException if the remote call fails - */ - public function getHyperparameterTuningJob($name, array $optionalArgs = []) - { - $request = new GetHyperparameterTuningJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetHyperparameterTuningJob', - HyperparameterTuningJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a ModelDeploymentMonitoringJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - * $response = $jobServiceClient->getModelDeploymentMonitoringJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the ModelDeploymentMonitoringJob. - * Format: - * `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob - * - * @throws ApiException if the remote call fails - */ - public function getModelDeploymentMonitoringJob( - $name, - array $optionalArgs = [] - ) { - $request = new GetModelDeploymentMonitoringJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetModelDeploymentMonitoringJob', - ModelDeploymentMonitoringJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a NasJob - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - * $response = $jobServiceClient->getNasJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NasJob resource. - * Format: - * `projects/{project}/locations/{location}/nasJobs/{nas_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\NasJob - * - * @throws ApiException if the remote call fails - */ - public function getNasJob($name, array $optionalArgs = []) - { - $request = new GetNasJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetNasJob', - NasJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a NasTrialDetail. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->nasTrialDetailName('[PROJECT]', '[LOCATION]', '[NAS_JOB]', '[NAS_TRIAL_DETAIL]'); - * $response = $jobServiceClient->getNasTrialDetail($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NasTrialDetail resource. - * Format: - * `projects/{project}/locations/{location}/nasJobs/{nas_job}/nasTrialDetails/{nas_trial_detail}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\NasTrialDetail - * - * @throws ApiException if the remote call fails - */ - public function getNasTrialDetail($name, array $optionalArgs = []) - { - $request = new GetNasTrialDetailRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetNasTrialDetail', - NasTrialDetail::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists BatchPredictionJobs in a Location. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $jobServiceClient->listBatchPredictionJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobServiceClient->listBatchPredictionJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the BatchPredictionJobs - * from. Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * - * Supported fields: - * - * * `display_name` supports `=`, `!=` comparisons, and `:` wildcard. - * * `model_display_name` supports `=`, `!=` comparisons. - * * `state` supports `=`, `!=` comparisons. - * * `create_time` supports `=`, `!=`,`<`, `<=`,`>`, `>=` comparisons. - * `create_time` must be in RFC 3339 format. - * * `labels` supports general map functions that is: - * `labels.key=value` - key:value equality - * `labels.key:* - key existence - * - * Some examples of using the filter are: - * - * * `state="JOB_STATE_SUCCEEDED" AND display_name:"my_job_*"` - * * `state!="JOB_STATE_FAILED" OR display_name="my_job"` - * * `NOT display_name="my_job"` - * * `create_time>"2021-05-18T00:00:00Z"` - * * `labels.keyA=valueA` - * * `labels.keyB:*` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listBatchPredictionJobs($parent, array $optionalArgs = []) - { - $request = new ListBatchPredictionJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListBatchPredictionJobs', - $optionalArgs, - ListBatchPredictionJobsResponse::class, - $request - ); - } - - /** - * Lists CustomJobs in a Location. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $jobServiceClient->listCustomJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobServiceClient->listCustomJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the CustomJobs from. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * - * Supported fields: - * - * * `display_name` supports `=`, `!=` comparisons, and `:` wildcard. - * * `state` supports `=`, `!=` comparisons. - * * `create_time` supports `=`, `!=`,`<`, `<=`,`>`, `>=` comparisons. - * `create_time` must be in RFC 3339 format. - * * `labels` supports general map functions that is: - * `labels.key=value` - key:value equality - * `labels.key:* - key existence - * - * Some examples of using the filter are: - * - * * `state="JOB_STATE_SUCCEEDED" AND display_name:"my_job_*"` - * * `state!="JOB_STATE_FAILED" OR display_name="my_job"` - * * `NOT display_name="my_job"` - * * `create_time>"2021-05-18T00:00:00Z"` - * * `labels.keyA=valueA` - * * `labels.keyB:*` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listCustomJobs($parent, array $optionalArgs = []) - { - $request = new ListCustomJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListCustomJobs', - $optionalArgs, - ListCustomJobsResponse::class, - $request - ); - } - - /** - * Lists DataLabelingJobs in a Location. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $jobServiceClient->listDataLabelingJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobServiceClient->listDataLabelingJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent of the DataLabelingJob. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * - * Supported fields: - * - * * `display_name` supports `=`, `!=` comparisons, and `:` wildcard. - * * `state` supports `=`, `!=` comparisons. - * * `create_time` supports `=`, `!=`,`<`, `<=`,`>`, `>=` comparisons. - * `create_time` must be in RFC 3339 format. - * * `labels` supports general map functions that is: - * `labels.key=value` - key:value equality - * `labels.key:* - key existence - * - * Some examples of using the filter are: - * - * * `state="JOB_STATE_SUCCEEDED" AND display_name:"my_job_*"` - * * `state!="JOB_STATE_FAILED" OR display_name="my_job"` - * * `NOT display_name="my_job"` - * * `create_time>"2021-05-18T00:00:00Z"` - * * `labels.keyA=valueA` - * * `labels.keyB:*` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. FieldMask represents a set of - * symbolic field paths. For example, the mask can be `paths: "name"`. The - * "name" here is a field in DataLabelingJob. - * If this field is not set, all fields of the DataLabelingJob are returned. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order by - * default. - * Use `desc` after a field name for descending. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listDataLabelingJobs($parent, array $optionalArgs = []) - { - $request = new ListDataLabelingJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListDataLabelingJobs', - $optionalArgs, - ListDataLabelingJobsResponse::class, - $request - ); - } - - /** - * Lists HyperparameterTuningJobs in a Location. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $jobServiceClient->listHyperparameterTuningJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobServiceClient->listHyperparameterTuningJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the - * HyperparameterTuningJobs from. Format: - * `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * - * Supported fields: - * - * * `display_name` supports `=`, `!=` comparisons, and `:` wildcard. - * * `state` supports `=`, `!=` comparisons. - * * `create_time` supports `=`, `!=`,`<`, `<=`,`>`, `>=` comparisons. - * `create_time` must be in RFC 3339 format. - * * `labels` supports general map functions that is: - * `labels.key=value` - key:value equality - * `labels.key:* - key existence - * - * Some examples of using the filter are: - * - * * `state="JOB_STATE_SUCCEEDED" AND display_name:"my_job_*"` - * * `state!="JOB_STATE_FAILED" OR display_name="my_job"` - * * `NOT display_name="my_job"` - * * `create_time>"2021-05-18T00:00:00Z"` - * * `labels.keyA=valueA` - * * `labels.keyB:*` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listHyperparameterTuningJobs( - $parent, - array $optionalArgs = [] - ) { - $request = new ListHyperparameterTuningJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListHyperparameterTuningJobs', - $optionalArgs, - ListHyperparameterTuningJobsResponse::class, - $request - ); - } - - /** - * Lists ModelDeploymentMonitoringJobs in a Location. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $jobServiceClient->listModelDeploymentMonitoringJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobServiceClient->listModelDeploymentMonitoringJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent of the ModelDeploymentMonitoringJob. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * - * Supported fields: - * - * * `display_name` supports `=`, `!=` comparisons, and `:` wildcard. - * * `state` supports `=`, `!=` comparisons. - * * `create_time` supports `=`, `!=`,`<`, `<=`,`>`, `>=` comparisons. - * `create_time` must be in RFC 3339 format. - * * `labels` supports general map functions that is: - * `labels.key=value` - key:value equality - * `labels.key:* - key existence - * - * Some examples of using the filter are: - * - * * `state="JOB_STATE_SUCCEEDED" AND display_name:"my_job_*"` - * * `state!="JOB_STATE_FAILED" OR display_name="my_job"` - * * `NOT display_name="my_job"` - * * `create_time>"2021-05-18T00:00:00Z"` - * * `labels.keyA=valueA` - * * `labels.keyB:*` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listModelDeploymentMonitoringJobs( - $parent, - array $optionalArgs = [] - ) { - $request = new ListModelDeploymentMonitoringJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListModelDeploymentMonitoringJobs', - $optionalArgs, - ListModelDeploymentMonitoringJobsResponse::class, - $request - ); - } - - /** - * Lists NasJobs in a Location. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $jobServiceClient->listNasJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobServiceClient->listNasJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the NasJobs - * from. Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * - * Supported fields: - * - * * `display_name` supports `=`, `!=` comparisons, and `:` wildcard. - * * `state` supports `=`, `!=` comparisons. - * * `create_time` supports `=`, `!=`,`<`, `<=`,`>`, `>=` comparisons. - * `create_time` must be in RFC 3339 format. - * * `labels` supports general map functions that is: - * `labels.key=value` - key:value equality - * `labels.key:* - key existence - * - * Some examples of using the filter are: - * - * * `state="JOB_STATE_SUCCEEDED" AND display_name:"my_job_*"` - * * `state!="JOB_STATE_FAILED" OR display_name="my_job"` - * * `NOT display_name="my_job"` - * * `create_time>"2021-05-18T00:00:00Z"` - * * `labels.keyA=valueA` - * * `labels.keyB:*` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listNasJobs($parent, array $optionalArgs = []) - { - $request = new ListNasJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListNasJobs', - $optionalArgs, - ListNasJobsResponse::class, - $request - ); - } - - /** - * List top NasTrialDetails of a NasJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedParent = $jobServiceClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - * // Iterate over pages of elements - * $pagedResponse = $jobServiceClient->listNasTrialDetails($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobServiceClient->listNasTrialDetails($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the NasJob resource. - * Format: - * `projects/{project}/locations/{location}/nasJobs/{nas_job}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listNasTrialDetails($parent, array $optionalArgs = []) - { - $request = new ListNasTrialDetailsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListNasTrialDetails', - $optionalArgs, - ListNasTrialDetailsResponse::class, - $request - ); - } - - /** - * Pauses a ModelDeploymentMonitoringJob. If the job is running, the server - * makes a best effort to cancel the job. Will mark - * [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state] - * to 'PAUSED'. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - * $jobServiceClient->pauseModelDeploymentMonitoringJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the ModelDeploymentMonitoringJob to pause. - * Format: - * `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function pauseModelDeploymentMonitoringJob( - $name, - array $optionalArgs = [] - ) { - $request = new PauseModelDeploymentMonitoringJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'PauseModelDeploymentMonitoringJob', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Resumes a paused ModelDeploymentMonitoringJob. It will start to run from - * next scheduled time. A deleted ModelDeploymentMonitoringJob can't be - * resumed. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedName = $jobServiceClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - * $jobServiceClient->resumeModelDeploymentMonitoringJob($formattedName); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the ModelDeploymentMonitoringJob to resume. - * Format: - * `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function resumeModelDeploymentMonitoringJob( - $name, - array $optionalArgs = [] - ) { - $request = new ResumeModelDeploymentMonitoringJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ResumeModelDeploymentMonitoringJob', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Searches Model Monitoring Statistics generated within a given time window. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $formattedModelDeploymentMonitoringJob = $jobServiceClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - * $deployedModelId = 'deployed_model_id'; - * $objectives = []; - * // Iterate over pages of elements - * $pagedResponse = $jobServiceClient->searchModelDeploymentMonitoringStatsAnomalies($formattedModelDeploymentMonitoringJob, $deployedModelId, $objectives); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobServiceClient->searchModelDeploymentMonitoringStatsAnomalies($formattedModelDeploymentMonitoringJob, $deployedModelId, $objectives); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $modelDeploymentMonitoringJob Required. ModelDeploymentMonitoring Job resource name. - * Format: - * `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}` - * @param string $deployedModelId Required. The DeployedModel ID of the - * [ModelDeploymentMonitoringObjectiveConfig.deployed_model_id]. - * @param StatsAnomaliesObjective[] $objectives Required. Objectives of the stats to retrieve. - * @param array $optionalArgs { - * Optional. - * - * @type string $featureDisplayName - * The feature display name. If specified, only return the stats belonging to - * this feature. Format: - * [ModelMonitoringStatsAnomalies.FeatureHistoricStatsAnomalies.feature_display_name][google.cloud.aiplatform.v1.ModelMonitoringStatsAnomalies.FeatureHistoricStatsAnomalies.feature_display_name], - * example: "user_destination". - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type Timestamp $startTime - * The earliest timestamp of stats being generated. - * If not set, indicates fetching stats till the earliest possible one. - * @type Timestamp $endTime - * The latest timestamp of stats being generated. - * If not set, indicates feching stats till the latest possible one. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function searchModelDeploymentMonitoringStatsAnomalies( - $modelDeploymentMonitoringJob, - $deployedModelId, - $objectives, - array $optionalArgs = [] - ) { - $request = new SearchModelDeploymentMonitoringStatsAnomaliesRequest(); - $requestParamHeaders = []; - $request->setModelDeploymentMonitoringJob( - $modelDeploymentMonitoringJob - ); - $request->setDeployedModelId($deployedModelId); - $request->setObjectives($objectives); - $requestParamHeaders[ - 'model_deployment_monitoring_job' - ] = $modelDeploymentMonitoringJob; - if (isset($optionalArgs['featureDisplayName'])) { - $request->setFeatureDisplayName( - $optionalArgs['featureDisplayName'] - ); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['startTime'])) { - $request->setStartTime($optionalArgs['startTime']); - } - - if (isset($optionalArgs['endTime'])) { - $request->setEndTime($optionalArgs['endTime']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'SearchModelDeploymentMonitoringStatsAnomalies', - $optionalArgs, - SearchModelDeploymentMonitoringStatsAnomaliesResponse::class, - $request - ); - } - - /** - * Updates a ModelDeploymentMonitoringJob. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $modelDeploymentMonitoringJob = new ModelDeploymentMonitoringJob(); - * $updateMask = new FieldMask(); - * $operationResponse = $jobServiceClient->updateModelDeploymentMonitoringJob($modelDeploymentMonitoringJob, $updateMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $jobServiceClient->updateModelDeploymentMonitoringJob($modelDeploymentMonitoringJob, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobServiceClient->resumeOperation($operationName, 'updateModelDeploymentMonitoringJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param ModelDeploymentMonitoringJob $modelDeploymentMonitoringJob Required. The model monitoring configuration which replaces the resource on - * the server. - * @param FieldMask $updateMask Required. The update mask is used to specify the fields to be overwritten - * in the ModelDeploymentMonitoringJob resource by the update. The fields - * specified in the update_mask are relative to the resource, not the full - * request. A field will be overwritten if it is in the mask. If the user does - * not provide a mask then only the non-empty fields present in the request - * will be overwritten. Set the update_mask to `*` to override all fields. For - * the objective config, the user can either provide the update mask for - * model_deployment_monitoring_objective_configs or any combination of its - * nested fields, such as: - * model_deployment_monitoring_objective_configs.objective_config.training_dataset. - * - * Updatable fields: - * - * * `display_name` - * * `model_deployment_monitoring_schedule_config` - * * `model_monitoring_alert_config` - * * `logging_sampling_strategy` - * * `labels` - * * `log_ttl` - * * `enable_monitoring_pipeline_logs` - * . and - * * `model_deployment_monitoring_objective_configs` - * . or - * * `model_deployment_monitoring_objective_configs.objective_config.training_dataset` - * * `model_deployment_monitoring_objective_configs.objective_config.training_prediction_skew_detection_config` - * * `model_deployment_monitoring_objective_configs.objective_config.prediction_drift_detection_config` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateModelDeploymentMonitoringJob( - $modelDeploymentMonitoringJob, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateModelDeploymentMonitoringJobRequest(); - $requestParamHeaders = []; - $request->setModelDeploymentMonitoringJob( - $modelDeploymentMonitoringJob - ); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'model_deployment_monitoring_job.name' - ] = $modelDeploymentMonitoringJob->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateModelDeploymentMonitoringJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $response = $jobServiceClient->getLocation(); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $jobServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $resource = 'resource'; - * $response = $jobServiceClient->getIamPolicy($resource); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $jobServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $jobServiceClient = new JobServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $jobServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $jobServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/LlmUtilityServiceGapicClient.php b/AiPlatform/src/V1/Gapic/LlmUtilityServiceGapicClient.php deleted file mode 100644 index 7226acea6a35..000000000000 --- a/AiPlatform/src/V1/Gapic/LlmUtilityServiceGapicClient.php +++ /dev/null @@ -1,820 +0,0 @@ -endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $instances = []; - * $response = $llmUtilityServiceClient->computeTokens($formattedEndpoint, $instances); - * } finally { - * $llmUtilityServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\LlmUtilityServiceClient}. - */ -class LlmUtilityServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.LlmUtilityService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $endpointNameTemplate; - - private static $projectLocationEndpointNameTemplate; - - private static $projectLocationPublisherModelNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/llm_utility_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/llm_utility_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/llm_utility_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/llm_utility_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getEndpointNameTemplate() - { - if (self::$endpointNameTemplate == null) { - self::$endpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$endpointNameTemplate; - } - - private static function getProjectLocationEndpointNameTemplate() - { - if (self::$projectLocationEndpointNameTemplate == null) { - self::$projectLocationEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$projectLocationEndpointNameTemplate; - } - - private static function getProjectLocationPublisherModelNameTemplate() - { - if (self::$projectLocationPublisherModelNameTemplate == null) { - self::$projectLocationPublisherModelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/publishers/{publisher}/models/{model}' - ); - } - - return self::$projectLocationPublisherModelNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'endpoint' => self::getEndpointNameTemplate(), - 'projectLocationEndpoint' => self::getProjectLocationEndpointNameTemplate(), - 'projectLocationPublisherModel' => self::getProjectLocationPublisherModelNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a endpoint - * resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted endpoint resource. - */ - public static function endpointName($project, $location, $endpoint) - { - return self::getEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted project_location_endpoint resource. - */ - public static function projectLocationEndpointName( - $project, - $location, - $endpoint - ) { - return self::getProjectLocationEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_publisher_model resource. - * - * @param string $project - * @param string $location - * @param string $publisher - * @param string $model - * - * @return string The formatted project_location_publisher_model resource. - */ - public static function projectLocationPublisherModelName( - $project, - $location, - $publisher, - $model - ) { - return self::getProjectLocationPublisherModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'publisher' => $publisher, - 'model' => $model, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - endpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - projectLocationEndpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - projectLocationPublisherModel: projects/{project}/locations/{location}/publishers/{publisher}/models/{model} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Return a list of tokens based on the input text. - * - * Sample code: - * ``` - * $llmUtilityServiceClient = new LlmUtilityServiceClient(); - * try { - * $formattedEndpoint = $llmUtilityServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $instances = []; - * $response = $llmUtilityServiceClient->computeTokens($formattedEndpoint, $instances); - * } finally { - * $llmUtilityServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint requested to get lists of tokens and - * token ids. - * @param Value[] $instances Required. The instances that are the input to token computing API call. - * Schema is identical to the prediction schema of the text model, even for - * the non-text models, like chat models, or Codey models. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ComputeTokensResponse - * - * @throws ApiException if the remote call fails - */ - public function computeTokens( - $endpoint, - $instances, - array $optionalArgs = [] - ) { - $request = new ComputeTokensRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $request->setInstances($instances); - $requestParamHeaders['endpoint'] = $endpoint; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ComputeTokens', - ComputeTokensResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Perform a token counting. - * - * Sample code: - * ``` - * $llmUtilityServiceClient = new LlmUtilityServiceClient(); - * try { - * $formattedEndpoint = $llmUtilityServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $model = 'model'; - * $instances = []; - * $contents = []; - * $response = $llmUtilityServiceClient->countTokens($formattedEndpoint, $model, $instances, $contents); - * } finally { - * $llmUtilityServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint requested to perform token counting. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param string $model Required. The name of the publisher model requested to serve the - * prediction. Format: - * `projects/{project}/locations/{location}/publishers/*/models/*` - * @param Value[] $instances Required. The instances that are the input to token counting call. - * Schema is identical to the prediction schema of the underlying model. - * @param Content[] $contents Required. Input content. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\CountTokensResponse - * - * @throws ApiException if the remote call fails - */ - public function countTokens( - $endpoint, - $model, - $instances, - $contents, - array $optionalArgs = [] - ) { - $request = new CountTokensRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $request->setModel($model); - $request->setInstances($instances); - $request->setContents($contents); - $requestParamHeaders['endpoint'] = $endpoint; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CountTokens', - CountTokensResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $llmUtilityServiceClient = new LlmUtilityServiceClient(); - * try { - * $response = $llmUtilityServiceClient->getLocation(); - * } finally { - * $llmUtilityServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $llmUtilityServiceClient = new LlmUtilityServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $llmUtilityServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $llmUtilityServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $llmUtilityServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $llmUtilityServiceClient = new LlmUtilityServiceClient(); - * try { - * $resource = 'resource'; - * $response = $llmUtilityServiceClient->getIamPolicy($resource); - * } finally { - * $llmUtilityServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $llmUtilityServiceClient = new LlmUtilityServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $llmUtilityServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $llmUtilityServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $llmUtilityServiceClient = new LlmUtilityServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $llmUtilityServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $llmUtilityServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/MatchServiceGapicClient.php b/AiPlatform/src/V1/Gapic/MatchServiceGapicClient.php deleted file mode 100644 index f70e2a320d41..000000000000 --- a/AiPlatform/src/V1/Gapic/MatchServiceGapicClient.php +++ /dev/null @@ -1,762 +0,0 @@ -indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - * $response = $matchServiceClient->findNeighbors($formattedIndexEndpoint); - * } finally { - * $matchServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\MatchServiceClient}. - */ -class MatchServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.MatchService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $indexEndpointNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/match_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/match_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/match_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/match_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getIndexEndpointNameTemplate() - { - if (self::$indexEndpointNameTemplate == null) { - self::$indexEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}' - ); - } - - return self::$indexEndpointNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'indexEndpoint' => self::getIndexEndpointNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * index_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $indexEndpoint - * - * @return string The formatted index_endpoint resource. - */ - public static function indexEndpointName( - $project, - $location, - $indexEndpoint - ) { - return self::getIndexEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'index_endpoint' => $indexEndpoint, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - indexEndpoint: projects/{project}/locations/{location}/indexEndpoints/{index_endpoint} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Finds the nearest neighbors of each vector within the request. - * - * Sample code: - * ``` - * $matchServiceClient = new MatchServiceClient(); - * try { - * $formattedIndexEndpoint = $matchServiceClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - * $response = $matchServiceClient->findNeighbors($formattedIndexEndpoint); - * } finally { - * $matchServiceClient->close(); - * } - * ``` - * - * @param string $indexEndpoint Required. The name of the index endpoint. - * Format: - * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type string $deployedIndexId - * The ID of the DeployedIndex that will serve the request. This request is - * sent to a specific IndexEndpoint, as per the IndexEndpoint.network. That - * IndexEndpoint also has IndexEndpoint.deployed_indexes, and each such index - * has a DeployedIndex.id field. - * The value of the field below must equal one of the DeployedIndex.id - * fields of the IndexEndpoint that is being called for this request. - * @type Query[] $queries - * The list of queries. - * @type bool $returnFullDatapoint - * If set to true, the full datapoints (including all vector values and - * restricts) of the nearest neighbors are returned. - * Note that returning full datapoint will significantly increase the - * latency and cost of the query. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\FindNeighborsResponse - * - * @throws ApiException if the remote call fails - */ - public function findNeighbors($indexEndpoint, array $optionalArgs = []) - { - $request = new FindNeighborsRequest(); - $requestParamHeaders = []; - $request->setIndexEndpoint($indexEndpoint); - $requestParamHeaders['index_endpoint'] = $indexEndpoint; - if (isset($optionalArgs['deployedIndexId'])) { - $request->setDeployedIndexId($optionalArgs['deployedIndexId']); - } - - if (isset($optionalArgs['queries'])) { - $request->setQueries($optionalArgs['queries']); - } - - if (isset($optionalArgs['returnFullDatapoint'])) { - $request->setReturnFullDatapoint( - $optionalArgs['returnFullDatapoint'] - ); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'FindNeighbors', - FindNeighborsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Reads the datapoints/vectors of the given IDs. - * A maximum of 1000 datapoints can be retrieved in a batch. - * - * Sample code: - * ``` - * $matchServiceClient = new MatchServiceClient(); - * try { - * $formattedIndexEndpoint = $matchServiceClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - * $response = $matchServiceClient->readIndexDatapoints($formattedIndexEndpoint); - * } finally { - * $matchServiceClient->close(); - * } - * ``` - * - * @param string $indexEndpoint Required. The name of the index endpoint. - * Format: - * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type string $deployedIndexId - * The ID of the DeployedIndex that will serve the request. - * @type string[] $ids - * IDs of the datapoints to be searched for. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ReadIndexDatapointsResponse - * - * @throws ApiException if the remote call fails - */ - public function readIndexDatapoints( - $indexEndpoint, - array $optionalArgs = [] - ) { - $request = new ReadIndexDatapointsRequest(); - $requestParamHeaders = []; - $request->setIndexEndpoint($indexEndpoint); - $requestParamHeaders['index_endpoint'] = $indexEndpoint; - if (isset($optionalArgs['deployedIndexId'])) { - $request->setDeployedIndexId($optionalArgs['deployedIndexId']); - } - - if (isset($optionalArgs['ids'])) { - $request->setIds($optionalArgs['ids']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ReadIndexDatapoints', - ReadIndexDatapointsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $matchServiceClient = new MatchServiceClient(); - * try { - * $response = $matchServiceClient->getLocation(); - * } finally { - * $matchServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $matchServiceClient = new MatchServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $matchServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $matchServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $matchServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $matchServiceClient = new MatchServiceClient(); - * try { - * $resource = 'resource'; - * $response = $matchServiceClient->getIamPolicy($resource); - * } finally { - * $matchServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $matchServiceClient = new MatchServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $matchServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $matchServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $matchServiceClient = new MatchServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $matchServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $matchServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/MetadataServiceGapicClient.php b/AiPlatform/src/V1/Gapic/MetadataServiceGapicClient.php deleted file mode 100644 index 6c1617c8240d..000000000000 --- a/AiPlatform/src/V1/Gapic/MetadataServiceGapicClient.php +++ /dev/null @@ -1,3302 +0,0 @@ -contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - * $response = $metadataServiceClient->addContextArtifactsAndExecutions($formattedContext); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient}. - */ -class MetadataServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.MetadataService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $artifactNameTemplate; - - private static $contextNameTemplate; - - private static $executionNameTemplate; - - private static $locationNameTemplate; - - private static $metadataSchemaNameTemplate; - - private static $metadataStoreNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/metadata_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/metadata_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/metadata_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/metadata_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getArtifactNameTemplate() - { - if (self::$artifactNameTemplate == null) { - self::$artifactNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact}' - ); - } - - return self::$artifactNameTemplate; - } - - private static function getContextNameTemplate() - { - if (self::$contextNameTemplate == null) { - self::$contextNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context}' - ); - } - - return self::$contextNameTemplate; - } - - private static function getExecutionNameTemplate() - { - if (self::$executionNameTemplate == null) { - self::$executionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/executions/{execution}' - ); - } - - return self::$executionNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getMetadataSchemaNameTemplate() - { - if (self::$metadataSchemaNameTemplate == null) { - self::$metadataSchemaNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/metadataSchemas/{metadata_schema}' - ); - } - - return self::$metadataSchemaNameTemplate; - } - - private static function getMetadataStoreNameTemplate() - { - if (self::$metadataStoreNameTemplate == null) { - self::$metadataStoreNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}' - ); - } - - return self::$metadataStoreNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'artifact' => self::getArtifactNameTemplate(), - 'context' => self::getContextNameTemplate(), - 'execution' => self::getExecutionNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'metadataSchema' => self::getMetadataSchemaNameTemplate(), - 'metadataStore' => self::getMetadataStoreNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a artifact - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $artifact - * - * @return string The formatted artifact resource. - */ - public static function artifactName( - $project, - $location, - $metadataStore, - $artifact - ) { - return self::getArtifactNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'artifact' => $artifact, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a context - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $context - * - * @return string The formatted context resource. - */ - public static function contextName( - $project, - $location, - $metadataStore, - $context - ) { - return self::getContextNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'context' => $context, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a execution - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $execution - * - * @return string The formatted execution resource. - */ - public static function executionName( - $project, - $location, - $metadataStore, - $execution - ) { - return self::getExecutionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'execution' => $execution, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * metadata_schema resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $metadataSchema - * - * @return string The formatted metadata_schema resource. - */ - public static function metadataSchemaName( - $project, - $location, - $metadataStore, - $metadataSchema - ) { - return self::getMetadataSchemaNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'metadata_schema' => $metadataSchema, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * metadata_store resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * - * @return string The formatted metadata_store resource. - */ - public static function metadataStoreName( - $project, - $location, - $metadataStore - ) { - return self::getMetadataStoreNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - artifact: projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact} - * - context: projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context} - * - execution: projects/{project}/locations/{location}/metadataStores/{metadata_store}/executions/{execution} - * - location: projects/{project}/locations/{location} - * - metadataSchema: projects/{project}/locations/{location}/metadataStores/{metadata_store}/metadataSchemas/{metadata_schema} - * - metadataStore: projects/{project}/locations/{location}/metadataStores/{metadata_store} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds a set of Artifacts and Executions to a Context. If any of the - * Artifacts or Executions have already been added to a Context, they are - * simply skipped. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedContext = $metadataServiceClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - * $response = $metadataServiceClient->addContextArtifactsAndExecutions($formattedContext); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $context Required. The resource name of the Context that the Artifacts and - * Executions belong to. Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}` - * @param array $optionalArgs { - * Optional. - * - * @type string[] $artifacts - * The resource names of the Artifacts to attribute to the Context. - * - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}` - * @type string[] $executions - * The resource names of the Executions to associate with the - * Context. - * - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\AddContextArtifactsAndExecutionsResponse - * - * @throws ApiException if the remote call fails - */ - public function addContextArtifactsAndExecutions( - $context, - array $optionalArgs = [] - ) { - $request = new AddContextArtifactsAndExecutionsRequest(); - $requestParamHeaders = []; - $request->setContext($context); - $requestParamHeaders['context'] = $context; - if (isset($optionalArgs['artifacts'])) { - $request->setArtifacts($optionalArgs['artifacts']); - } - - if (isset($optionalArgs['executions'])) { - $request->setExecutions($optionalArgs['executions']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'AddContextArtifactsAndExecutions', - AddContextArtifactsAndExecutionsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Adds a set of Contexts as children to a parent Context. If any of the - * child Contexts have already been added to the parent Context, they are - * simply skipped. If this call would create a cycle or cause any Context to - * have more than 10 parents, the request will fail with an INVALID_ARGUMENT - * error. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedContext = $metadataServiceClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - * $response = $metadataServiceClient->addContextChildren($formattedContext); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $context Required. The resource name of the parent Context. - * - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}` - * @param array $optionalArgs { - * Optional. - * - * @type string[] $childContexts - * The resource names of the child Contexts. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\AddContextChildrenResponse - * - * @throws ApiException if the remote call fails - */ - public function addContextChildren($context, array $optionalArgs = []) - { - $request = new AddContextChildrenRequest(); - $requestParamHeaders = []; - $request->setContext($context); - $requestParamHeaders['context'] = $context; - if (isset($optionalArgs['childContexts'])) { - $request->setChildContexts($optionalArgs['childContexts']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'AddContextChildren', - AddContextChildrenResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Adds Events to the specified Execution. An Event indicates whether an - * Artifact was used as an input or output for an Execution. If an Event - * already exists between the Execution and the Artifact, the Event is - * skipped. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedExecution = $metadataServiceClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - * $response = $metadataServiceClient->addExecutionEvents($formattedExecution); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $execution Required. The resource name of the Execution that the Events connect - * Artifacts with. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}` - * @param array $optionalArgs { - * Optional. - * - * @type Event[] $events - * The Events to create and add. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\AddExecutionEventsResponse - * - * @throws ApiException if the remote call fails - */ - public function addExecutionEvents($execution, array $optionalArgs = []) - { - $request = new AddExecutionEventsRequest(); - $requestParamHeaders = []; - $request->setExecution($execution); - $requestParamHeaders['execution'] = $execution; - if (isset($optionalArgs['events'])) { - $request->setEvents($optionalArgs['events']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'AddExecutionEvents', - AddExecutionEventsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates an Artifact associated with a MetadataStore. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * $artifact = new Artifact(); - * $response = $metadataServiceClient->createArtifact($formattedParent, $artifact); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the MetadataStore where the Artifact should - * be created. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param Artifact $artifact Required. The Artifact to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $artifactId - * The {artifact} portion of the resource name with the format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}` - * If not provided, the Artifact's ID will be a UUID generated by the service. - * Must be 4-128 characters in length. Valid characters are `/[a-z][0-9]-/`. - * Must be unique across all Artifacts in the parent MetadataStore. (Otherwise - * the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED if the - * caller can't view the preexisting Artifact.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Artifact - * - * @throws ApiException if the remote call fails - */ - public function createArtifact($parent, $artifact, array $optionalArgs = []) - { - $request = new CreateArtifactRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setArtifact($artifact); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['artifactId'])) { - $request->setArtifactId($optionalArgs['artifactId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateArtifact', - Artifact::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a Context associated with a MetadataStore. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * $context = new Context(); - * $response = $metadataServiceClient->createContext($formattedParent, $context); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the MetadataStore where the Context should - * be created. Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param Context $context Required. The Context to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $contextId - * The {context} portion of the resource name with the format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`. - * If not provided, the Context's ID will be a UUID generated by the service. - * Must be 4-128 characters in length. Valid characters are `/[a-z][0-9]-/`. - * Must be unique across all Contexts in the parent MetadataStore. (Otherwise - * the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED if the - * caller can't view the preexisting Context.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Context - * - * @throws ApiException if the remote call fails - */ - public function createContext($parent, $context, array $optionalArgs = []) - { - $request = new CreateContextRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setContext($context); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['contextId'])) { - $request->setContextId($optionalArgs['contextId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateContext', - Context::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates an Execution associated with a MetadataStore. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * $execution = new Execution(); - * $response = $metadataServiceClient->createExecution($formattedParent, $execution); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the MetadataStore where the Execution should - * be created. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param Execution $execution Required. The Execution to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $executionId - * The {execution} portion of the resource name with the format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}` - * If not provided, the Execution's ID will be a UUID generated by the - * service. - * Must be 4-128 characters in length. Valid characters are `/[a-z][0-9]-/`. - * Must be unique across all Executions in the parent MetadataStore. - * (Otherwise the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED - * if the caller can't view the preexisting Execution.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Execution - * - * @throws ApiException if the remote call fails - */ - public function createExecution( - $parent, - $execution, - array $optionalArgs = [] - ) { - $request = new CreateExecutionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setExecution($execution); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['executionId'])) { - $request->setExecutionId($optionalArgs['executionId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateExecution', - Execution::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a MetadataSchema. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * $metadataSchema = new MetadataSchema(); - * $response = $metadataServiceClient->createMetadataSchema($formattedParent, $metadataSchema); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the MetadataStore where the MetadataSchema - * should be created. Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param MetadataSchema $metadataSchema Required. The MetadataSchema to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $metadataSchemaId - * The {metadata_schema} portion of the resource name with the format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/metadataSchemas/{metadataschema}` - * If not provided, the MetadataStore's ID will be a UUID generated by the - * service. - * Must be 4-128 characters in length. Valid characters are `/[a-z][0-9]-/`. - * Must be unique across all MetadataSchemas in the parent Location. - * (Otherwise the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED - * if the caller can't view the preexisting MetadataSchema.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\MetadataSchema - * - * @throws ApiException if the remote call fails - */ - public function createMetadataSchema( - $parent, - $metadataSchema, - array $optionalArgs = [] - ) { - $request = new CreateMetadataSchemaRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setMetadataSchema($metadataSchema); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['metadataSchemaId'])) { - $request->setMetadataSchemaId($optionalArgs['metadataSchemaId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateMetadataSchema', - MetadataSchema::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Initializes a MetadataStore, including allocation of resources. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $metadataStore = new MetadataStore(); - * $operationResponse = $metadataServiceClient->createMetadataStore($formattedParent, $metadataStore); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $metadataServiceClient->createMetadataStore($formattedParent, $metadataStore); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $metadataServiceClient->resumeOperation($operationName, 'createMetadataStore'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location where the MetadataStore should - * be created. - * Format: `projects/{project}/locations/{location}/` - * @param MetadataStore $metadataStore Required. The MetadataStore to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $metadataStoreId - * The {metadatastore} portion of the resource name with the format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * If not provided, the MetadataStore's ID will be a UUID generated by the - * service. - * Must be 4-128 characters in length. Valid characters are `/[a-z][0-9]-/`. - * Must be unique across all MetadataStores in the parent Location. - * (Otherwise the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED - * if the caller can't view the preexisting MetadataStore.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createMetadataStore( - $parent, - $metadataStore, - array $optionalArgs = [] - ) { - $request = new CreateMetadataStoreRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setMetadataStore($metadataStore); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['metadataStoreId'])) { - $request->setMetadataStoreId($optionalArgs['metadataStoreId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateMetadataStore', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes an Artifact. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedName = $metadataServiceClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - * $operationResponse = $metadataServiceClient->deleteArtifact($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $metadataServiceClient->deleteArtifact($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $metadataServiceClient->resumeOperation($operationName, 'deleteArtifact'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Artifact to delete. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}` - * @param array $optionalArgs { - * Optional. - * - * @type string $etag - * Optional. The etag of the Artifact to delete. - * If this is provided, it must match the server's etag. Otherwise, the - * request will fail with a FAILED_PRECONDITION. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteArtifact($name, array $optionalArgs = []) - { - $request = new DeleteArtifactRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['etag'])) { - $request->setEtag($optionalArgs['etag']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteArtifact', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a stored Context. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedName = $metadataServiceClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - * $operationResponse = $metadataServiceClient->deleteContext($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $metadataServiceClient->deleteContext($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $metadataServiceClient->resumeOperation($operationName, 'deleteContext'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Context to delete. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}` - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * The force deletion semantics is still undefined. - * Users should not use this field. - * @type string $etag - * Optional. The etag of the Context to delete. - * If this is provided, it must match the server's etag. Otherwise, the - * request will fail with a FAILED_PRECONDITION. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteContext($name, array $optionalArgs = []) - { - $request = new DeleteContextRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - if (isset($optionalArgs['etag'])) { - $request->setEtag($optionalArgs['etag']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteContext', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes an Execution. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedName = $metadataServiceClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - * $operationResponse = $metadataServiceClient->deleteExecution($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $metadataServiceClient->deleteExecution($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $metadataServiceClient->resumeOperation($operationName, 'deleteExecution'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Execution to delete. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}` - * @param array $optionalArgs { - * Optional. - * - * @type string $etag - * Optional. The etag of the Execution to delete. - * If this is provided, it must match the server's etag. Otherwise, the - * request will fail with a FAILED_PRECONDITION. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteExecution($name, array $optionalArgs = []) - { - $request = new DeleteExecutionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['etag'])) { - $request->setEtag($optionalArgs['etag']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteExecution', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single MetadataStore and all its child resources (Artifacts, - * Executions, and Contexts). - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedName = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * $operationResponse = $metadataServiceClient->deleteMetadataStore($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $metadataServiceClient->deleteMetadataStore($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $metadataServiceClient->resumeOperation($operationName, 'deleteMetadataStore'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the MetadataStore to delete. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * Deprecated: Field is no longer supported. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteMetadataStore($name, array $optionalArgs = []) - { - $request = new DeleteMetadataStoreRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteMetadataStore', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Retrieves a specific Artifact. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedName = $metadataServiceClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - * $response = $metadataServiceClient->getArtifact($formattedName); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Artifact to retrieve. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Artifact - * - * @throws ApiException if the remote call fails - */ - public function getArtifact($name, array $optionalArgs = []) - { - $request = new GetArtifactRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetArtifact', - Artifact::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a specific Context. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedName = $metadataServiceClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - * $response = $metadataServiceClient->getContext($formattedName); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Context to retrieve. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Context - * - * @throws ApiException if the remote call fails - */ - public function getContext($name, array $optionalArgs = []) - { - $request = new GetContextRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetContext', - Context::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a specific Execution. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedName = $metadataServiceClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - * $response = $metadataServiceClient->getExecution($formattedName); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Execution to retrieve. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Execution - * - * @throws ApiException if the remote call fails - */ - public function getExecution($name, array $optionalArgs = []) - { - $request = new GetExecutionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetExecution', - Execution::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a specific MetadataSchema. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedName = $metadataServiceClient->metadataSchemaName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[METADATA_SCHEMA]'); - * $response = $metadataServiceClient->getMetadataSchema($formattedName); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the MetadataSchema to retrieve. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/metadataSchemas/{metadataschema}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\MetadataSchema - * - * @throws ApiException if the remote call fails - */ - public function getMetadataSchema($name, array $optionalArgs = []) - { - $request = new GetMetadataSchemaRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetMetadataSchema', - MetadataSchema::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a specific MetadataStore. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedName = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * $response = $metadataServiceClient->getMetadataStore($formattedName); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the MetadataStore to retrieve. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\MetadataStore - * - * @throws ApiException if the remote call fails - */ - public function getMetadataStore($name, array $optionalArgs = []) - { - $request = new GetMetadataStoreRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetMetadataStore', - MetadataStore::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists Artifacts in the MetadataStore. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * // Iterate over pages of elements - * $pagedResponse = $metadataServiceClient->listArtifacts($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $metadataServiceClient->listArtifacts($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The MetadataStore whose Artifacts should be listed. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * Filter specifying the boolean condition for the Artifacts to satisfy in - * order to be part of the result set. - * The syntax to define filter query is based on https://google.aip.dev/160. - * The supported set of filters include the following: - * - * * **Attribute filtering**: - * For example: `display_name = "test"`. - * Supported fields include: `name`, `display_name`, `uri`, `state`, - * `schema_title`, `create_time`, and `update_time`. - * Time fields, such as `create_time` and `update_time`, require values - * specified in RFC-3339 format. - * For example: `create_time = "2020-11-19T11:30:00-04:00"` - * * **Metadata field**: - * To filter on metadata fields use traversal operation as follows: - * `metadata..`. - * For example: `metadata.field_1.number_value = 10.0` - * In case the field name contains special characters (such as colon), one - * can embed it inside double quote. - * For example: `metadata."field:1".number_value = 10.0` - * * **Context based filtering**: - * To filter Artifacts based on the contexts to which they belong, use the - * function operator with the full resource name - * `in_context()`. - * For example: - * `in_context("projects//locations//metadataStores//contexts/")` - * - * Each of the above supported filter types can be combined together using - * logical operators (`AND` & `OR`). Maximum nested expression depth allowed - * is 5. - * - * For example: `display_name = "test" AND metadata.field1.bool_value = true`. - * @type string $orderBy - * How the list of messages is ordered. Specify the values to order by and an - * ordering operation. The default sorting order is ascending. To specify - * descending order for a field, users append a " desc" suffix; for example: - * "foo desc, bar". - * Subfields are specified with a `.` character, such as foo.bar. - * see https://google.aip.dev/132#ordering for more details. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listArtifacts($parent, array $optionalArgs = []) - { - $request = new ListArtifactsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListArtifacts', - $optionalArgs, - ListArtifactsResponse::class, - $request - ); - } - - /** - * Lists Contexts on the MetadataStore. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * // Iterate over pages of elements - * $pagedResponse = $metadataServiceClient->listContexts($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $metadataServiceClient->listContexts($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The MetadataStore whose Contexts should be listed. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * Filter specifying the boolean condition for the Contexts to satisfy in - * order to be part of the result set. - * The syntax to define filter query is based on https://google.aip.dev/160. - * Following are the supported set of filters: - * - * * **Attribute filtering**: - * For example: `display_name = "test"`. - * Supported fields include: `name`, `display_name`, `schema_title`, - * `create_time`, and `update_time`. - * Time fields, such as `create_time` and `update_time`, require values - * specified in RFC-3339 format. - * For example: `create_time = "2020-11-19T11:30:00-04:00"`. - * * **Metadata field**: - * To filter on metadata fields use traversal operation as follows: - * `metadata..`. - * For example: `metadata.field_1.number_value = 10.0`. - * In case the field name contains special characters (such as colon), one - * can embed it inside double quote. - * For example: `metadata."field:1".number_value = 10.0` - * * **Parent Child filtering**: - * To filter Contexts based on parent-child relationship use the HAS - * operator as follows: - * - * ``` - * parent_contexts: - * "projects//locations//metadataStores//contexts/" - * child_contexts: - * "projects//locations//metadataStores//contexts/" - * ``` - * - * Each of the above supported filters can be combined together using - * logical operators (`AND` & `OR`). Maximum nested expression depth allowed - * is 5. - * - * For example: `display_name = "test" AND metadata.field1.bool_value = true`. - * @type string $orderBy - * How the list of messages is ordered. Specify the values to order by and an - * ordering operation. The default sorting order is ascending. To specify - * descending order for a field, users append a " desc" suffix; for example: - * "foo desc, bar". - * Subfields are specified with a `.` character, such as foo.bar. - * see https://google.aip.dev/132#ordering for more details. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listContexts($parent, array $optionalArgs = []) - { - $request = new ListContextsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListContexts', - $optionalArgs, - ListContextsResponse::class, - $request - ); - } - - /** - * Lists Executions in the MetadataStore. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * // Iterate over pages of elements - * $pagedResponse = $metadataServiceClient->listExecutions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $metadataServiceClient->listExecutions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The MetadataStore whose Executions should be listed. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * Filter specifying the boolean condition for the Executions to satisfy in - * order to be part of the result set. - * The syntax to define filter query is based on https://google.aip.dev/160. - * Following are the supported set of filters: - * - * * **Attribute filtering**: - * For example: `display_name = "test"`. - * Supported fields include: `name`, `display_name`, `state`, - * `schema_title`, `create_time`, and `update_time`. - * Time fields, such as `create_time` and `update_time`, require values - * specified in RFC-3339 format. - * For example: `create_time = "2020-11-19T11:30:00-04:00"`. - * * **Metadata field**: - * To filter on metadata fields use traversal operation as follows: - * `metadata..` - * For example: `metadata.field_1.number_value = 10.0` - * In case the field name contains special characters (such as colon), one - * can embed it inside double quote. - * For example: `metadata."field:1".number_value = 10.0` - * * **Context based filtering**: - * To filter Executions based on the contexts to which they belong use - * the function operator with the full resource name: - * `in_context()`. - * For example: - * `in_context("projects//locations//metadataStores//contexts/")` - * - * Each of the above supported filters can be combined together using - * logical operators (`AND` & `OR`). Maximum nested expression depth allowed - * is 5. - * - * For example: `display_name = "test" AND metadata.field1.bool_value = true`. - * @type string $orderBy - * How the list of messages is ordered. Specify the values to order by and an - * ordering operation. The default sorting order is ascending. To specify - * descending order for a field, users append a " desc" suffix; for example: - * "foo desc, bar". - * Subfields are specified with a `.` character, such as foo.bar. - * see https://google.aip.dev/132#ordering for more details. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listExecutions($parent, array $optionalArgs = []) - { - $request = new ListExecutionsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListExecutions', - $optionalArgs, - ListExecutionsResponse::class, - $request - ); - } - - /** - * Lists MetadataSchemas. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * // Iterate over pages of elements - * $pagedResponse = $metadataServiceClient->listMetadataSchemas($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $metadataServiceClient->listMetadataSchemas($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The MetadataStore whose MetadataSchemas should be listed. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * A query to filter available MetadataSchemas for matching results. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listMetadataSchemas($parent, array $optionalArgs = []) - { - $request = new ListMetadataSchemasRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListMetadataSchemas', - $optionalArgs, - ListMetadataSchemasResponse::class, - $request - ); - } - - /** - * Lists MetadataStores for a Location. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $metadataServiceClient->listMetadataStores($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $metadataServiceClient->listMetadataStores($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The Location whose MetadataStores should be listed. - * Format: - * `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listMetadataStores($parent, array $optionalArgs = []) - { - $request = new ListMetadataStoresRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListMetadataStores', - $optionalArgs, - ListMetadataStoresResponse::class, - $request - ); - } - - /** - * Purges Artifacts. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * $filter = 'filter'; - * $operationResponse = $metadataServiceClient->purgeArtifacts($formattedParent, $filter); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $metadataServiceClient->purgeArtifacts($formattedParent, $filter); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $metadataServiceClient->resumeOperation($operationName, 'purgeArtifacts'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The metadata store to purge Artifacts from. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param string $filter Required. A required filter matching the Artifacts to be purged. - * E.g., `update_time <= 2020-11-19T11:30:00-04:00`. - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * Optional. Flag to indicate to actually perform the purge. - * If `force` is set to false, the method will return a sample of - * Artifact names that would be deleted. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function purgeArtifacts($parent, $filter, array $optionalArgs = []) - { - $request = new PurgeArtifactsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFilter($filter); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'PurgeArtifacts', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Purges Contexts. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * $filter = 'filter'; - * $operationResponse = $metadataServiceClient->purgeContexts($formattedParent, $filter); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $metadataServiceClient->purgeContexts($formattedParent, $filter); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $metadataServiceClient->resumeOperation($operationName, 'purgeContexts'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The metadata store to purge Contexts from. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param string $filter Required. A required filter matching the Contexts to be purged. - * E.g., `update_time <= 2020-11-19T11:30:00-04:00`. - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * Optional. Flag to indicate to actually perform the purge. - * If `force` is set to false, the method will return a sample of - * Context names that would be deleted. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function purgeContexts($parent, $filter, array $optionalArgs = []) - { - $request = new PurgeContextsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFilter($filter); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'PurgeContexts', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Purges Executions. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedParent = $metadataServiceClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - * $filter = 'filter'; - * $operationResponse = $metadataServiceClient->purgeExecutions($formattedParent, $filter); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $metadataServiceClient->purgeExecutions($formattedParent, $filter); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $metadataServiceClient->resumeOperation($operationName, 'purgeExecutions'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The metadata store to purge Executions from. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}` - * @param string $filter Required. A required filter matching the Executions to be purged. - * E.g., `update_time <= 2020-11-19T11:30:00-04:00`. - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * Optional. Flag to indicate to actually perform the purge. - * If `force` is set to false, the method will return a sample of - * Execution names that would be deleted. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function purgeExecutions($parent, $filter, array $optionalArgs = []) - { - $request = new PurgeExecutionsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFilter($filter); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'PurgeExecutions', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Retrieves lineage of an Artifact represented through Artifacts and - * Executions connected by Event edges and returned as a LineageSubgraph. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedArtifact = $metadataServiceClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - * $response = $metadataServiceClient->queryArtifactLineageSubgraph($formattedArtifact); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $artifact Required. The resource name of the Artifact whose Lineage needs to be - * retrieved as a LineageSubgraph. Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}` - * - * The request may error with FAILED_PRECONDITION if the number of Artifacts, - * the number of Executions, or the number of Events that would be returned - * for the Context exceeds 1000. - * @param array $optionalArgs { - * Optional. - * - * @type int $maxHops - * Specifies the size of the lineage graph in terms of number of hops from the - * specified artifact. - * Negative Value: INVALID_ARGUMENT error is returned - * 0: Only input artifact is returned. - * No value: Transitive closure is performed to return the complete graph. - * @type string $filter - * Filter specifying the boolean condition for the Artifacts to satisfy in - * order to be part of the Lineage Subgraph. - * The syntax to define filter query is based on https://google.aip.dev/160. - * The supported set of filters include the following: - * - * * **Attribute filtering**: - * For example: `display_name = "test"` - * Supported fields include: `name`, `display_name`, `uri`, `state`, - * `schema_title`, `create_time`, and `update_time`. - * Time fields, such as `create_time` and `update_time`, require values - * specified in RFC-3339 format. - * For example: `create_time = "2020-11-19T11:30:00-04:00"` - * * **Metadata field**: - * To filter on metadata fields use traversal operation as follows: - * `metadata..`. - * For example: `metadata.field_1.number_value = 10.0` - * In case the field name contains special characters (such as colon), one - * can embed it inside double quote. - * For example: `metadata."field:1".number_value = 10.0` - * - * Each of the above supported filter types can be combined together using - * logical operators (`AND` & `OR`). Maximum nested expression depth allowed - * is 5. - * - * For example: `display_name = "test" AND metadata.field1.bool_value = true`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\LineageSubgraph - * - * @throws ApiException if the remote call fails - */ - public function queryArtifactLineageSubgraph( - $artifact, - array $optionalArgs = [] - ) { - $request = new QueryArtifactLineageSubgraphRequest(); - $requestParamHeaders = []; - $request->setArtifact($artifact); - $requestParamHeaders['artifact'] = $artifact; - if (isset($optionalArgs['maxHops'])) { - $request->setMaxHops($optionalArgs['maxHops']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'QueryArtifactLineageSubgraph', - LineageSubgraph::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves Artifacts and Executions within the specified Context, connected - * by Event edges and returned as a LineageSubgraph. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedContext = $metadataServiceClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - * $response = $metadataServiceClient->queryContextLineageSubgraph($formattedContext); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $context Required. The resource name of the Context whose Artifacts and Executions - * should be retrieved as a LineageSubgraph. - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}` - * - * The request may error with FAILED_PRECONDITION if the number of Artifacts, - * the number of Executions, or the number of Events that would be returned - * for the Context exceeds 1000. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\LineageSubgraph - * - * @throws ApiException if the remote call fails - */ - public function queryContextLineageSubgraph( - $context, - array $optionalArgs = [] - ) { - $request = new QueryContextLineageSubgraphRequest(); - $requestParamHeaders = []; - $request->setContext($context); - $requestParamHeaders['context'] = $context; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'QueryContextLineageSubgraph', - LineageSubgraph::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Obtains the set of input and output Artifacts for this Execution, in the - * form of LineageSubgraph that also contains the Execution and connecting - * Events. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedExecution = $metadataServiceClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - * $response = $metadataServiceClient->queryExecutionInputsAndOutputs($formattedExecution); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $execution Required. The resource name of the Execution whose input and output - * Artifacts should be retrieved as a LineageSubgraph. Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\LineageSubgraph - * - * @throws ApiException if the remote call fails - */ - public function queryExecutionInputsAndOutputs( - $execution, - array $optionalArgs = [] - ) { - $request = new QueryExecutionInputsAndOutputsRequest(); - $requestParamHeaders = []; - $request->setExecution($execution); - $requestParamHeaders['execution'] = $execution; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'QueryExecutionInputsAndOutputs', - LineageSubgraph::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Remove a set of children contexts from a parent Context. If any of the - * child Contexts were NOT added to the parent Context, they are - * simply skipped. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $formattedContext = $metadataServiceClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - * $response = $metadataServiceClient->removeContextChildren($formattedContext); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $context Required. The resource name of the parent Context. - * - * Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}` - * @param array $optionalArgs { - * Optional. - * - * @type string[] $childContexts - * The resource names of the child Contexts. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\RemoveContextChildrenResponse - * - * @throws ApiException if the remote call fails - */ - public function removeContextChildren($context, array $optionalArgs = []) - { - $request = new RemoveContextChildrenRequest(); - $requestParamHeaders = []; - $request->setContext($context); - $requestParamHeaders['context'] = $context; - if (isset($optionalArgs['childContexts'])) { - $request->setChildContexts($optionalArgs['childContexts']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'RemoveContextChildren', - RemoveContextChildrenResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates a stored Artifact. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $artifact = new Artifact(); - * $response = $metadataServiceClient->updateArtifact($artifact); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param Artifact $artifact Required. The Artifact containing updates. - * The Artifact's [Artifact.name][google.cloud.aiplatform.v1.Artifact.name] - * field is used to identify the Artifact to be updated. Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Optional. A FieldMask indicating which fields should be updated. - * @type bool $allowMissing - * If set to true, and the [Artifact][google.cloud.aiplatform.v1.Artifact] is - * not found, a new [Artifact][google.cloud.aiplatform.v1.Artifact] is - * created. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Artifact - * - * @throws ApiException if the remote call fails - */ - public function updateArtifact($artifact, array $optionalArgs = []) - { - $request = new UpdateArtifactRequest(); - $requestParamHeaders = []; - $request->setArtifact($artifact); - $requestParamHeaders['artifact.name'] = $artifact->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['allowMissing'])) { - $request->setAllowMissing($optionalArgs['allowMissing']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateArtifact', - Artifact::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates a stored Context. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $context = new Context(); - * $response = $metadataServiceClient->updateContext($context); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param Context $context Required. The Context containing updates. - * The Context's [Context.name][google.cloud.aiplatform.v1.Context.name] field - * is used to identify the Context to be updated. Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Optional. A FieldMask indicating which fields should be updated. - * @type bool $allowMissing - * If set to true, and the [Context][google.cloud.aiplatform.v1.Context] is - * not found, a new [Context][google.cloud.aiplatform.v1.Context] is created. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Context - * - * @throws ApiException if the remote call fails - */ - public function updateContext($context, array $optionalArgs = []) - { - $request = new UpdateContextRequest(); - $requestParamHeaders = []; - $request->setContext($context); - $requestParamHeaders['context.name'] = $context->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['allowMissing'])) { - $request->setAllowMissing($optionalArgs['allowMissing']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateContext', - Context::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates a stored Execution. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $execution = new Execution(); - * $response = $metadataServiceClient->updateExecution($execution); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param Execution $execution Required. The Execution containing updates. - * The Execution's [Execution.name][google.cloud.aiplatform.v1.Execution.name] - * field is used to identify the Execution to be updated. Format: - * `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}` - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Optional. A FieldMask indicating which fields should be updated. - * @type bool $allowMissing - * If set to true, and the [Execution][google.cloud.aiplatform.v1.Execution] - * is not found, a new [Execution][google.cloud.aiplatform.v1.Execution] is - * created. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Execution - * - * @throws ApiException if the remote call fails - */ - public function updateExecution($execution, array $optionalArgs = []) - { - $request = new UpdateExecutionRequest(); - $requestParamHeaders = []; - $request->setExecution($execution); - $requestParamHeaders['execution.name'] = $execution->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['allowMissing'])) { - $request->setAllowMissing($optionalArgs['allowMissing']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateExecution', - Execution::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $response = $metadataServiceClient->getLocation(); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $metadataServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $metadataServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $resource = 'resource'; - * $response = $metadataServiceClient->getIamPolicy($resource); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $metadataServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $metadataServiceClient = new MetadataServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $metadataServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $metadataServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/MigrationServiceGapicClient.php b/AiPlatform/src/V1/Gapic/MigrationServiceGapicClient.php deleted file mode 100644 index 456549e003ad..000000000000 --- a/AiPlatform/src/V1/Gapic/MigrationServiceGapicClient.php +++ /dev/null @@ -1,1002 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $migrateResourceRequests = []; - * $operationResponse = $migrationServiceClient->batchMigrateResources($formattedParent, $migrateResourceRequests); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $migrationServiceClient->batchMigrateResources($formattedParent, $migrateResourceRequests); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $migrationServiceClient->resumeOperation($operationName, 'batchMigrateResources'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $migrationServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\MigrationServiceClient}. - */ -class MigrationServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.MigrationService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $annotatedDatasetNameTemplate; - - private static $datasetNameTemplate; - - private static $locationNameTemplate; - - private static $modelNameTemplate; - - private static $versionNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/migration_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/migration_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/migration_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/migration_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getAnnotatedDatasetNameTemplate() - { - if (self::$annotatedDatasetNameTemplate == null) { - self::$annotatedDatasetNameTemplate = new PathTemplate( - 'projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}' - ); - } - - return self::$annotatedDatasetNameTemplate; - } - - private static function getDatasetNameTemplate() - { - if (self::$datasetNameTemplate == null) { - self::$datasetNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/datasets/{dataset}' - ); - } - - return self::$datasetNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getModelNameTemplate() - { - if (self::$modelNameTemplate == null) { - self::$modelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/models/{model}' - ); - } - - return self::$modelNameTemplate; - } - - private static function getVersionNameTemplate() - { - if (self::$versionNameTemplate == null) { - self::$versionNameTemplate = new PathTemplate( - 'projects/{project}/models/{model}/versions/{version}' - ); - } - - return self::$versionNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'annotatedDataset' => self::getAnnotatedDatasetNameTemplate(), - 'dataset' => self::getDatasetNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'model' => self::getModelNameTemplate(), - 'version' => self::getVersionNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * annotated_dataset resource. - * - * @param string $project - * @param string $dataset - * @param string $annotatedDataset - * - * @return string The formatted annotated_dataset resource. - */ - public static function annotatedDatasetName( - $project, - $dataset, - $annotatedDataset - ) { - return self::getAnnotatedDatasetNameTemplate()->render([ - 'project' => $project, - 'dataset' => $dataset, - 'annotated_dataset' => $annotatedDataset, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a dataset - * resource. - * - * @param string $project - * @param string $location - * @param string $dataset - * - * @return string The formatted dataset resource. - */ - public static function datasetName($project, $location, $dataset) - { - return self::getDatasetNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'dataset' => $dataset, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName($project, $location, $model) - { - return self::getModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a version - * resource. - * - * @param string $project - * @param string $model - * @param string $version - * - * @return string The formatted version resource. - */ - public static function versionName($project, $model, $version) - { - return self::getVersionNameTemplate()->render([ - 'project' => $project, - 'model' => $model, - 'version' => $version, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - annotatedDataset: projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset} - * - dataset: projects/{project}/locations/{location}/datasets/{dataset} - * - location: projects/{project}/locations/{location} - * - model: projects/{project}/locations/{location}/models/{model} - * - version: projects/{project}/models/{model}/versions/{version} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Batch migrates resources from ml.googleapis.com, automl.googleapis.com, - * and datalabeling.googleapis.com to Vertex AI. - * - * Sample code: - * ``` - * $migrationServiceClient = new MigrationServiceClient(); - * try { - * $formattedParent = $migrationServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $migrateResourceRequests = []; - * $operationResponse = $migrationServiceClient->batchMigrateResources($formattedParent, $migrateResourceRequests); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $migrationServiceClient->batchMigrateResources($formattedParent, $migrateResourceRequests); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $migrationServiceClient->resumeOperation($operationName, 'batchMigrateResources'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $migrationServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The location of the migrated resource will live in. - * Format: `projects/{project}/locations/{location}` - * @param MigrateResourceRequest[] $migrateResourceRequests Required. The request messages specifying the resources to migrate. - * They must be in the same location as the destination. - * Up to 50 resources can be migrated in one batch. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function batchMigrateResources( - $parent, - $migrateResourceRequests, - array $optionalArgs = [] - ) { - $request = new BatchMigrateResourcesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setMigrateResourceRequests($migrateResourceRequests); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'BatchMigrateResources', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Searches all of the resources in automl.googleapis.com, - * datalabeling.googleapis.com and ml.googleapis.com that can be migrated to - * Vertex AI's given location. - * - * Sample code: - * ``` - * $migrationServiceClient = new MigrationServiceClient(); - * try { - * $formattedParent = $migrationServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $migrationServiceClient->searchMigratableResources($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $migrationServiceClient->searchMigratableResources($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $migrationServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The location that the migratable resources should be searched - * from. It's the Vertex AI location that the resources can be migrated to, - * not the resources' original location. Format: - * `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * A filter for your search. You can use the following types of filters: - * - * * Resource type filters. The following strings filter for a specific type - * of [MigratableResource][google.cloud.aiplatform.v1.MigratableResource]: - * * `ml_engine_model_version:*` - * * `automl_model:*` - * * `automl_dataset:*` - * * `data_labeling_dataset:*` - * * "Migrated or not" filters. The following strings filter for resources - * that either have or have not already been migrated: - * * `last_migrate_time:*` filters for migrated resources. - * * `NOT last_migrate_time:*` filters for not yet migrated resources. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function searchMigratableResources($parent, array $optionalArgs = []) - { - $request = new SearchMigratableResourcesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'SearchMigratableResources', - $optionalArgs, - SearchMigratableResourcesResponse::class, - $request - ); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $migrationServiceClient = new MigrationServiceClient(); - * try { - * $response = $migrationServiceClient->getLocation(); - * } finally { - * $migrationServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $migrationServiceClient = new MigrationServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $migrationServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $migrationServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $migrationServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $migrationServiceClient = new MigrationServiceClient(); - * try { - * $resource = 'resource'; - * $response = $migrationServiceClient->getIamPolicy($resource); - * } finally { - * $migrationServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $migrationServiceClient = new MigrationServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $migrationServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $migrationServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $migrationServiceClient = new MigrationServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $migrationServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $migrationServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/ModelGardenServiceGapicClient.php b/AiPlatform/src/V1/Gapic/ModelGardenServiceGapicClient.php deleted file mode 100644 index ece06875fd36..000000000000 --- a/AiPlatform/src/V1/Gapic/ModelGardenServiceGapicClient.php +++ /dev/null @@ -1,676 +0,0 @@ -publisherModelName('[PUBLISHER]', '[MODEL]'); - * $response = $modelGardenServiceClient->getPublisherModel($formattedName); - * } finally { - * $modelGardenServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\ModelGardenServiceClient}. - */ -class ModelGardenServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.ModelGardenService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $publisherModelNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/model_garden_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/model_garden_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/model_garden_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/model_garden_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getPublisherModelNameTemplate() - { - if (self::$publisherModelNameTemplate == null) { - self::$publisherModelNameTemplate = new PathTemplate( - 'publishers/{publisher}/models/{model}' - ); - } - - return self::$publisherModelNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'publisherModel' => self::getPublisherModelNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * publisher_model resource. - * - * @param string $publisher - * @param string $model - * - * @return string The formatted publisher_model resource. - */ - public static function publisherModelName($publisher, $model) - { - return self::getPublisherModelNameTemplate()->render([ - 'publisher' => $publisher, - 'model' => $model, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - publisherModel: publishers/{publisher}/models/{model} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Gets a Model Garden publisher model. - * - * Sample code: - * ``` - * $modelGardenServiceClient = new ModelGardenServiceClient(); - * try { - * $formattedName = $modelGardenServiceClient->publisherModelName('[PUBLISHER]', '[MODEL]'); - * $response = $modelGardenServiceClient->getPublisherModel($formattedName); - * } finally { - * $modelGardenServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the PublisherModel resource. - * Format: - * `publishers/{publisher}/models/{publisher_model}` - * @param array $optionalArgs { - * Optional. - * - * @type string $languageCode - * Optional. The IETF BCP-47 language code representing the language in which - * the publisher model's text information should be written in (see go/bcp47). - * @type int $view - * Optional. PublisherModel view specifying which fields to read. - * For allowed values, use constants defined on {@see \Google\Cloud\AIPlatform\V1\PublisherModelView} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\PublisherModel - * - * @throws ApiException if the remote call fails - */ - public function getPublisherModel($name, array $optionalArgs = []) - { - $request = new GetPublisherModelRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['languageCode'])) { - $request->setLanguageCode($optionalArgs['languageCode']); - } - - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetPublisherModel', - PublisherModel::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $modelGardenServiceClient = new ModelGardenServiceClient(); - * try { - * $response = $modelGardenServiceClient->getLocation(); - * } finally { - * $modelGardenServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $modelGardenServiceClient = new ModelGardenServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $modelGardenServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $modelGardenServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $modelGardenServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $modelGardenServiceClient = new ModelGardenServiceClient(); - * try { - * $resource = 'resource'; - * $response = $modelGardenServiceClient->getIamPolicy($resource); - * } finally { - * $modelGardenServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $modelGardenServiceClient = new ModelGardenServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $modelGardenServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $modelGardenServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $modelGardenServiceClient = new ModelGardenServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $modelGardenServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $modelGardenServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/ModelServiceGapicClient.php b/AiPlatform/src/V1/Gapic/ModelServiceGapicClient.php deleted file mode 100644 index 121596499e2b..000000000000 --- a/AiPlatform/src/V1/Gapic/ModelServiceGapicClient.php +++ /dev/null @@ -1,2396 +0,0 @@ -modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); - * $evaluatedAnnotations = []; - * $response = $modelServiceClient->batchImportEvaluatedAnnotations($formattedParent, $evaluatedAnnotations); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\ModelServiceClient}. - */ -class ModelServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.ModelService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $endpointNameTemplate; - - private static $locationNameTemplate; - - private static $modelNameTemplate; - - private static $modelEvaluationNameTemplate; - - private static $modelEvaluationSliceNameTemplate; - - private static $pipelineJobNameTemplate; - - private static $projectLocationEndpointNameTemplate; - - private static $projectLocationPublisherModelNameTemplate; - - private static $trainingPipelineNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/model_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/model_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/model_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/model_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getEndpointNameTemplate() - { - if (self::$endpointNameTemplate == null) { - self::$endpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$endpointNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getModelNameTemplate() - { - if (self::$modelNameTemplate == null) { - self::$modelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/models/{model}' - ); - } - - return self::$modelNameTemplate; - } - - private static function getModelEvaluationNameTemplate() - { - if (self::$modelEvaluationNameTemplate == null) { - self::$modelEvaluationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}' - ); - } - - return self::$modelEvaluationNameTemplate; - } - - private static function getModelEvaluationSliceNameTemplate() - { - if (self::$modelEvaluationSliceNameTemplate == null) { - self::$modelEvaluationSliceNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}' - ); - } - - return self::$modelEvaluationSliceNameTemplate; - } - - private static function getPipelineJobNameTemplate() - { - if (self::$pipelineJobNameTemplate == null) { - self::$pipelineJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}' - ); - } - - return self::$pipelineJobNameTemplate; - } - - private static function getProjectLocationEndpointNameTemplate() - { - if (self::$projectLocationEndpointNameTemplate == null) { - self::$projectLocationEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$projectLocationEndpointNameTemplate; - } - - private static function getProjectLocationPublisherModelNameTemplate() - { - if (self::$projectLocationPublisherModelNameTemplate == null) { - self::$projectLocationPublisherModelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/publishers/{publisher}/models/{model}' - ); - } - - return self::$projectLocationPublisherModelNameTemplate; - } - - private static function getTrainingPipelineNameTemplate() - { - if (self::$trainingPipelineNameTemplate == null) { - self::$trainingPipelineNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/trainingPipelines/{training_pipeline}' - ); - } - - return self::$trainingPipelineNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'endpoint' => self::getEndpointNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'model' => self::getModelNameTemplate(), - 'modelEvaluation' => self::getModelEvaluationNameTemplate(), - 'modelEvaluationSlice' => self::getModelEvaluationSliceNameTemplate(), - 'pipelineJob' => self::getPipelineJobNameTemplate(), - 'projectLocationEndpoint' => self::getProjectLocationEndpointNameTemplate(), - 'projectLocationPublisherModel' => self::getProjectLocationPublisherModelNameTemplate(), - 'trainingPipeline' => self::getTrainingPipelineNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a endpoint - * resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted endpoint resource. - */ - public static function endpointName($project, $location, $endpoint) - { - return self::getEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName($project, $location, $model) - { - return self::getModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * model_evaluation resource. - * - * @param string $project - * @param string $location - * @param string $model - * @param string $evaluation - * - * @return string The formatted model_evaluation resource. - */ - public static function modelEvaluationName( - $project, - $location, - $model, - $evaluation - ) { - return self::getModelEvaluationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - 'evaluation' => $evaluation, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * model_evaluation_slice resource. - * - * @param string $project - * @param string $location - * @param string $model - * @param string $evaluation - * @param string $slice - * - * @return string The formatted model_evaluation_slice resource. - */ - public static function modelEvaluationSliceName( - $project, - $location, - $model, - $evaluation, - $slice - ) { - return self::getModelEvaluationSliceNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - 'evaluation' => $evaluation, - 'slice' => $slice, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a pipeline_job - * resource. - * - * @param string $project - * @param string $location - * @param string $pipelineJob - * - * @return string The formatted pipeline_job resource. - */ - public static function pipelineJobName($project, $location, $pipelineJob) - { - return self::getPipelineJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'pipeline_job' => $pipelineJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted project_location_endpoint resource. - */ - public static function projectLocationEndpointName( - $project, - $location, - $endpoint - ) { - return self::getProjectLocationEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_publisher_model resource. - * - * @param string $project - * @param string $location - * @param string $publisher - * @param string $model - * - * @return string The formatted project_location_publisher_model resource. - */ - public static function projectLocationPublisherModelName( - $project, - $location, - $publisher, - $model - ) { - return self::getProjectLocationPublisherModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'publisher' => $publisher, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * training_pipeline resource. - * - * @param string $project - * @param string $location - * @param string $trainingPipeline - * - * @return string The formatted training_pipeline resource. - */ - public static function trainingPipelineName( - $project, - $location, - $trainingPipeline - ) { - return self::getTrainingPipelineNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'training_pipeline' => $trainingPipeline, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - endpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - location: projects/{project}/locations/{location} - * - model: projects/{project}/locations/{location}/models/{model} - * - modelEvaluation: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation} - * - modelEvaluationSlice: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice} - * - pipelineJob: projects/{project}/locations/{location}/pipelineJobs/{pipeline_job} - * - projectLocationEndpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - projectLocationPublisherModel: projects/{project}/locations/{location}/publishers/{publisher}/models/{model} - * - trainingPipeline: projects/{project}/locations/{location}/trainingPipelines/{training_pipeline} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Imports a list of externally generated EvaluatedAnnotations. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedParent = $modelServiceClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); - * $evaluatedAnnotations = []; - * $response = $modelServiceClient->batchImportEvaluatedAnnotations($formattedParent, $evaluatedAnnotations); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the parent ModelEvaluationSlice resource. - * Format: - * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}` - * @param EvaluatedAnnotation[] $evaluatedAnnotations Required. Evaluated annotations resource to be imported. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\BatchImportEvaluatedAnnotationsResponse - * - * @throws ApiException if the remote call fails - */ - public function batchImportEvaluatedAnnotations( - $parent, - $evaluatedAnnotations, - array $optionalArgs = [] - ) { - $request = new BatchImportEvaluatedAnnotationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setEvaluatedAnnotations($evaluatedAnnotations); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'BatchImportEvaluatedAnnotations', - BatchImportEvaluatedAnnotationsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Imports a list of externally generated ModelEvaluationSlice. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedParent = $modelServiceClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - * $modelEvaluationSlices = []; - * $response = $modelServiceClient->batchImportModelEvaluationSlices($formattedParent, $modelEvaluationSlices); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the parent ModelEvaluation resource. - * Format: - * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}` - * @param ModelEvaluationSlice[] $modelEvaluationSlices Required. Model evaluation slice resource to be imported. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\BatchImportModelEvaluationSlicesResponse - * - * @throws ApiException if the remote call fails - */ - public function batchImportModelEvaluationSlices( - $parent, - $modelEvaluationSlices, - array $optionalArgs = [] - ) { - $request = new BatchImportModelEvaluationSlicesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setModelEvaluationSlices($modelEvaluationSlices); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'BatchImportModelEvaluationSlices', - BatchImportModelEvaluationSlicesResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Copies an already existing Vertex AI Model into the specified Location. - * The source Model must exist in the same Project. - * When copying custom Models, the users themselves are responsible for - * [Model.metadata][google.cloud.aiplatform.v1.Model.metadata] content to be - * region-agnostic, as well as making sure that any resources (e.g. files) it - * depends on remain accessible. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedParent = $modelServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $formattedSourceModel = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * $operationResponse = $modelServiceClient->copyModel($formattedParent, $formattedSourceModel); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $modelServiceClient->copyModel($formattedParent, $formattedSourceModel); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $modelServiceClient->resumeOperation($operationName, 'copyModel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location into which to copy the Model. - * Format: `projects/{project}/locations/{location}` - * @param string $sourceModel Required. The resource name of the Model to copy. That Model must be in the - * same Project. Format: - * `projects/{project}/locations/{location}/models/{model}` - * @param array $optionalArgs { - * Optional. - * - * @type string $modelId - * Optional. Copy source_model into a new Model with this ID. The ID will - * become the final component of the model resource name. - * - * This value may be up to 63 characters, and valid characters are - * `[a-z0-9_-]`. The first character cannot be a number or hyphen. - * @type string $parentModel - * Optional. Specify this field to copy source_model into this existing - * Model as a new version. Format: - * `projects/{project}/locations/{location}/models/{model}` - * @type EncryptionSpec $encryptionSpec - * Customer-managed encryption key options. If this is set, - * then the Model copy will be encrypted with the provided encryption key. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function copyModel($parent, $sourceModel, array $optionalArgs = []) - { - $request = new CopyModelRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSourceModel($sourceModel); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['modelId'])) { - $request->setModelId($optionalArgs['modelId']); - } - - if (isset($optionalArgs['parentModel'])) { - $request->setParentModel($optionalArgs['parentModel']); - } - - if (isset($optionalArgs['encryptionSpec'])) { - $request->setEncryptionSpec($optionalArgs['encryptionSpec']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CopyModel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a Model. - * - * A model cannot be deleted if any - * [Endpoint][google.cloud.aiplatform.v1.Endpoint] resource has a - * [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] based on the - * model in its - * [deployed_models][google.cloud.aiplatform.v1.Endpoint.deployed_models] - * field. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedName = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * $operationResponse = $modelServiceClient->deleteModel($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $modelServiceClient->deleteModel($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $modelServiceClient->resumeOperation($operationName, 'deleteModel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Model resource to be deleted. - * Format: `projects/{project}/locations/{location}/models/{model}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteModel($name, array $optionalArgs = []) - { - $request = new DeleteModelRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteModel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a Model version. - * - * Model version can only be deleted if there are no - * [DeployedModels][google.cloud.aiplatform.v1.DeployedModel] created from it. - * Deleting the only version in the Model is not allowed. Use - * [DeleteModel][google.cloud.aiplatform.v1.ModelService.DeleteModel] for - * deleting the Model instead. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedName = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * $operationResponse = $modelServiceClient->deleteModelVersion($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $modelServiceClient->deleteModelVersion($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $modelServiceClient->resumeOperation($operationName, 'deleteModelVersion'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the model version to be deleted, with a version ID - * explicitly included. - * - * Example: `projects/{project}/locations/{location}/models/{model}@1234` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteModelVersion($name, array $optionalArgs = []) - { - $request = new DeleteModelVersionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteModelVersion', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Exports a trained, exportable Model to a location specified by the - * user. A Model is considered to be exportable if it has at least one - * [supported export - * format][google.cloud.aiplatform.v1.Model.supported_export_formats]. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedName = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * $outputConfig = new OutputConfig(); - * $operationResponse = $modelServiceClient->exportModel($formattedName, $outputConfig); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $modelServiceClient->exportModel($formattedName, $outputConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $modelServiceClient->resumeOperation($operationName, 'exportModel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Model to export. - * The resource name may contain version id or version alias to specify the - * version, if no version is specified, the default version will be exported. - * @param OutputConfig $outputConfig Required. The desired output location and configuration. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function exportModel($name, $outputConfig, array $optionalArgs = []) - { - $request = new ExportModelRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setOutputConfig($outputConfig); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'ExportModel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets a Model. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedName = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * $response = $modelServiceClient->getModel($formattedName); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Model resource. - * Format: `projects/{project}/locations/{location}/models/{model}` - * - * In order to retrieve a specific version of the model, also provide - * the version ID or version alias. - * Example: `projects/{project}/locations/{location}/models/{model}@2` - * or - * `projects/{project}/locations/{location}/models/{model}@golden` - * If no version ID or alias is specified, the "default" version will be - * returned. The "default" version alias is created for the first version of - * the model, and can be moved to other versions later on. There will be - * exactly one default version. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Model - * - * @throws ApiException if the remote call fails - */ - public function getModel($name, array $optionalArgs = []) - { - $request = new GetModelRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetModel', - Model::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a ModelEvaluation. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedName = $modelServiceClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - * $response = $modelServiceClient->getModelEvaluation($formattedName); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the ModelEvaluation resource. - * Format: - * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ModelEvaluation - * - * @throws ApiException if the remote call fails - */ - public function getModelEvaluation($name, array $optionalArgs = []) - { - $request = new GetModelEvaluationRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetModelEvaluation', - ModelEvaluation::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a ModelEvaluationSlice. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedName = $modelServiceClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); - * $response = $modelServiceClient->getModelEvaluationSlice($formattedName); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the ModelEvaluationSlice resource. - * Format: - * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ModelEvaluationSlice - * - * @throws ApiException if the remote call fails - */ - public function getModelEvaluationSlice($name, array $optionalArgs = []) - { - $request = new GetModelEvaluationSliceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetModelEvaluationSlice', - ModelEvaluationSlice::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Imports an externally generated ModelEvaluation. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedParent = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * $modelEvaluation = new ModelEvaluation(); - * $response = $modelServiceClient->importModelEvaluation($formattedParent, $modelEvaluation); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the parent model resource. - * Format: `projects/{project}/locations/{location}/models/{model}` - * @param ModelEvaluation $modelEvaluation Required. Model evaluation resource to be imported. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ModelEvaluation - * - * @throws ApiException if the remote call fails - */ - public function importModelEvaluation( - $parent, - $modelEvaluation, - array $optionalArgs = [] - ) { - $request = new ImportModelEvaluationRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setModelEvaluation($modelEvaluation); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ImportModelEvaluation', - ModelEvaluation::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists ModelEvaluationSlices in a ModelEvaluation. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedParent = $modelServiceClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - * // Iterate over pages of elements - * $pagedResponse = $modelServiceClient->listModelEvaluationSlices($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $modelServiceClient->listModelEvaluationSlices($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the ModelEvaluation to list the - * ModelEvaluationSlices from. Format: - * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * - * * `slice.dimension` - for =. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listModelEvaluationSlices($parent, array $optionalArgs = []) - { - $request = new ListModelEvaluationSlicesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListModelEvaluationSlices', - $optionalArgs, - ListModelEvaluationSlicesResponse::class, - $request - ); - } - - /** - * Lists ModelEvaluations in a Model. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedParent = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * // Iterate over pages of elements - * $pagedResponse = $modelServiceClient->listModelEvaluations($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $modelServiceClient->listModelEvaluations($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Model to list the ModelEvaluations from. - * Format: `projects/{project}/locations/{location}/models/{model}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listModelEvaluations($parent, array $optionalArgs = []) - { - $request = new ListModelEvaluationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListModelEvaluations', - $optionalArgs, - ListModelEvaluationsResponse::class, - $request - ); - } - - /** - * Lists versions of the specified model. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedName = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * // Iterate over pages of elements - * $pagedResponse = $modelServiceClient->listModelVersions($formattedName); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $modelServiceClient->listModelVersions($formattedName); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the model to list versions for. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * An expression for filtering the results of the request. For field names - * both snake_case and camelCase are supported. - * - * * `labels` supports general map functions that is: - * * `labels.key=value` - key:value equality - * * `labels.key:* or labels:key - key existence - * * A key including a space must be quoted. `labels."a key"`. - * - * Some examples: - * - * * `labels.myKey="myValue"` - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * Supported fields: - * - * * `create_time` - * * `update_time` - * - * Example: `update_time asc, create_time desc`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listModelVersions($name, array $optionalArgs = []) - { - $request = new ListModelVersionsRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListModelVersions', - $optionalArgs, - ListModelVersionsResponse::class, - $request - ); - } - - /** - * Lists Models in a Location. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedParent = $modelServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $modelServiceClient->listModels($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $modelServiceClient->listModels($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the Models from. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * An expression for filtering the results of the request. For field names - * both snake_case and camelCase are supported. - * - * * `model` supports = and !=. `model` represents the Model ID, - * i.e. the last segment of the Model's [resource - * name][google.cloud.aiplatform.v1.Model.name]. - * * `display_name` supports = and != - * * `labels` supports general map functions that is: - * * `labels.key=value` - key:value equality - * * `labels.key:* or labels:key - key existence - * * A key including a space must be quoted. `labels."a key"`. - * * `base_model_name` only supports = - * - * Some examples: - * - * * `model=1234` - * * `displayName="myDisplayName"` - * * `labels.myKey="myValue"` - * * `baseModelName="text-bison"` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type string $orderBy - * A comma-separated list of fields to order by, sorted in ascending order. - * Use "desc" after a field name for descending. - * Supported fields: - * - * * `display_name` - * * `create_time` - * * `update_time` - * - * Example: `display_name, create_time desc`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listModels($parent, array $optionalArgs = []) - { - $request = new ListModelsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListModels', - $optionalArgs, - ListModelsResponse::class, - $request - ); - } - - /** - * Merges a set of aliases for a Model version. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedName = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * $versionAliases = []; - * $response = $modelServiceClient->mergeVersionAliases($formattedName, $versionAliases); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the model version to merge aliases, with a version ID - * explicitly included. - * - * Example: `projects/{project}/locations/{location}/models/{model}@1234` - * @param string[] $versionAliases Required. The set of version aliases to merge. - * The alias should be at most 128 characters, and match - * `[a-z][a-zA-Z0-9-]{0,126}[a-z-0-9]`. - * Add the `-` prefix to an alias means removing that alias from the version. - * `-` is NOT counted in the 128 characters. Example: `-golden` means removing - * the `golden` alias from the version. - * - * There is NO ordering in aliases, which means - * 1) The aliases returned from GetModel API might not have the exactly same - * order from this MergeVersionAliases API. 2) Adding and deleting the same - * alias in the request is not recommended, and the 2 operations will be - * cancelled out. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Model - * - * @throws ApiException if the remote call fails - */ - public function mergeVersionAliases( - $name, - $versionAliases, - array $optionalArgs = [] - ) { - $request = new MergeVersionAliasesRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setVersionAliases($versionAliases); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'MergeVersionAliases', - Model::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Incrementally update the dataset used for an examples model. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedModel = $modelServiceClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - * $operationResponse = $modelServiceClient->updateExplanationDataset($formattedModel); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $modelServiceClient->updateExplanationDataset($formattedModel); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $modelServiceClient->resumeOperation($operationName, 'updateExplanationDataset'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $model Required. The resource name of the Model to update. - * Format: `projects/{project}/locations/{location}/models/{model}` - * @param array $optionalArgs { - * Optional. - * - * @type Examples $examples - * The example config containing the location of the dataset. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateExplanationDataset($model, array $optionalArgs = []) - { - $request = new UpdateExplanationDatasetRequest(); - $requestParamHeaders = []; - $request->setModel($model); - $requestParamHeaders['model'] = $model; - if (isset($optionalArgs['examples'])) { - $request->setExamples($optionalArgs['examples']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateExplanationDataset', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates a Model. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $model = new Model(); - * $updateMask = new FieldMask(); - * $response = $modelServiceClient->updateModel($model, $updateMask); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param Model $model Required. The Model which replaces the resource on the server. - * When Model Versioning is enabled, the model.name will be used to determine - * whether to update the model or model version. - * 1. model.name with the @ value, e.g. models/123@1, refers to a version - * specific update. - * 2. model.name without the @ value, e.g. models/123, refers to a model - * update. - * 3. model.name with @-, e.g. models/123@-, refers to a model update. - * 4. Supported model fields: display_name, description; supported - * version-specific fields: version_description. Labels are supported in both - * scenarios. Both the model labels and the version labels are merged when a - * model is returned. When updating labels, if the request is for - * model-specific update, model label gets updated. Otherwise, version labels - * get updated. - * 5. A model name or model version name fields update mismatch will cause a - * precondition error. - * 6. One request cannot update both the model and the version fields. You - * must update them separately. - * @param FieldMask $updateMask Required. The update mask applies to the resource. - * For the `FieldMask` definition, see - * [google.protobuf.FieldMask][google.protobuf.FieldMask]. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Model - * - * @throws ApiException if the remote call fails - */ - public function updateModel($model, $updateMask, array $optionalArgs = []) - { - $request = new UpdateModelRequest(); - $requestParamHeaders = []; - $request->setModel($model); - $request->setUpdateMask($updateMask); - $requestParamHeaders['model.name'] = $model->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateModel', - Model::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Uploads a Model artifact into Vertex AI. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $formattedParent = $modelServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $model = new Model(); - * $operationResponse = $modelServiceClient->uploadModel($formattedParent, $model); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $modelServiceClient->uploadModel($formattedParent, $model); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $modelServiceClient->resumeOperation($operationName, 'uploadModel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location into which to upload the Model. - * Format: `projects/{project}/locations/{location}` - * @param Model $model Required. The Model to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $parentModel - * Optional. The resource name of the model into which to upload the version. - * Only specify this field when uploading a new version. - * @type string $modelId - * Optional. The ID to use for the uploaded Model, which will become the final - * component of the model resource name. - * - * This value may be up to 63 characters, and valid characters are - * `[a-z0-9_-]`. The first character cannot be a number or hyphen. - * @type string $serviceAccount - * Optional. The user-provided custom service account to use to do the model - * upload. If empty, [Vertex AI Service - * Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) - * will be used to access resources needed to upload the model. This account - * must belong to the target project where the model is uploaded to, i.e., the - * project specified in the `parent` field of this request and have necessary - * read permissions (to Google Cloud Storage, Artifact Registry, etc.). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function uploadModel($parent, $model, array $optionalArgs = []) - { - $request = new UploadModelRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setModel($model); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['parentModel'])) { - $request->setParentModel($optionalArgs['parentModel']); - } - - if (isset($optionalArgs['modelId'])) { - $request->setModelId($optionalArgs['modelId']); - } - - if (isset($optionalArgs['serviceAccount'])) { - $request->setServiceAccount($optionalArgs['serviceAccount']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UploadModel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $response = $modelServiceClient->getLocation(); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $modelServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $modelServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $resource = 'resource'; - * $response = $modelServiceClient->getIamPolicy($resource); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $modelServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $modelServiceClient = new ModelServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $modelServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $modelServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/NotebookServiceGapicClient.php b/AiPlatform/src/V1/Gapic/NotebookServiceGapicClient.php deleted file mode 100644 index 4f508eed4361..000000000000 --- a/AiPlatform/src/V1/Gapic/NotebookServiceGapicClient.php +++ /dev/null @@ -1,1740 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $formattedNotebookRuntimeTemplate = $notebookServiceClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - * $notebookRuntime = new NotebookRuntime(); - * $operationResponse = $notebookServiceClient->assignNotebookRuntime($formattedParent, $formattedNotebookRuntimeTemplate, $notebookRuntime); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $notebookServiceClient->assignNotebookRuntime($formattedParent, $formattedNotebookRuntimeTemplate, $notebookRuntime); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'assignNotebookRuntime'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\NotebookServiceClient}. - */ -class NotebookServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.NotebookService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $locationNameTemplate; - - private static $networkNameTemplate; - - private static $notebookRuntimeNameTemplate; - - private static $notebookRuntimeTemplateNameTemplate; - - private static $subnetworkNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/notebook_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/notebook_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/notebook_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/notebook_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getNetworkNameTemplate() - { - if (self::$networkNameTemplate == null) { - self::$networkNameTemplate = new PathTemplate( - 'projects/{project}/global/networks/{network}' - ); - } - - return self::$networkNameTemplate; - } - - private static function getNotebookRuntimeNameTemplate() - { - if (self::$notebookRuntimeNameTemplate == null) { - self::$notebookRuntimeNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/notebookRuntimes/{notebook_runtime}' - ); - } - - return self::$notebookRuntimeNameTemplate; - } - - private static function getNotebookRuntimeTemplateNameTemplate() - { - if (self::$notebookRuntimeTemplateNameTemplate == null) { - self::$notebookRuntimeTemplateNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/notebookRuntimeTemplates/{notebook_runtime_template}' - ); - } - - return self::$notebookRuntimeTemplateNameTemplate; - } - - private static function getSubnetworkNameTemplate() - { - if (self::$subnetworkNameTemplate == null) { - self::$subnetworkNameTemplate = new PathTemplate( - 'projects/{project}/regions/{region}/subnetworks/{subnetwork}' - ); - } - - return self::$subnetworkNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'location' => self::getLocationNameTemplate(), - 'network' => self::getNetworkNameTemplate(), - 'notebookRuntime' => self::getNotebookRuntimeNameTemplate(), - 'notebookRuntimeTemplate' => self::getNotebookRuntimeTemplateNameTemplate(), - 'subnetwork' => self::getSubnetworkNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a network - * resource. - * - * @param string $project - * @param string $network - * - * @return string The formatted network resource. - */ - public static function networkName($project, $network) - { - return self::getNetworkNameTemplate()->render([ - 'project' => $project, - 'network' => $network, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * notebook_runtime resource. - * - * @param string $project - * @param string $location - * @param string $notebookRuntime - * - * @return string The formatted notebook_runtime resource. - */ - public static function notebookRuntimeName( - $project, - $location, - $notebookRuntime - ) { - return self::getNotebookRuntimeNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'notebook_runtime' => $notebookRuntime, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * notebook_runtime_template resource. - * - * @param string $project - * @param string $location - * @param string $notebookRuntimeTemplate - * - * @return string The formatted notebook_runtime_template resource. - */ - public static function notebookRuntimeTemplateName( - $project, - $location, - $notebookRuntimeTemplate - ) { - return self::getNotebookRuntimeTemplateNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'notebook_runtime_template' => $notebookRuntimeTemplate, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a subnetwork - * resource. - * - * @param string $project - * @param string $region - * @param string $subnetwork - * - * @return string The formatted subnetwork resource. - */ - public static function subnetworkName($project, $region, $subnetwork) - { - return self::getSubnetworkNameTemplate()->render([ - 'project' => $project, - 'region' => $region, - 'subnetwork' => $subnetwork, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - location: projects/{project}/locations/{location} - * - network: projects/{project}/global/networks/{network} - * - notebookRuntime: projects/{project}/locations/{location}/notebookRuntimes/{notebook_runtime} - * - notebookRuntimeTemplate: projects/{project}/locations/{location}/notebookRuntimeTemplates/{notebook_runtime_template} - * - subnetwork: projects/{project}/regions/{region}/subnetworks/{subnetwork} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Assigns a NotebookRuntime to a user for a particular Notebook file. This - * method will either returns an existing assignment or generates a new one. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedParent = $notebookServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $formattedNotebookRuntimeTemplate = $notebookServiceClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - * $notebookRuntime = new NotebookRuntime(); - * $operationResponse = $notebookServiceClient->assignNotebookRuntime($formattedParent, $formattedNotebookRuntimeTemplate, $notebookRuntime); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $notebookServiceClient->assignNotebookRuntime($formattedParent, $formattedNotebookRuntimeTemplate, $notebookRuntime); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'assignNotebookRuntime'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to get the NotebookRuntime - * assignment. Format: `projects/{project}/locations/{location}` - * @param string $notebookRuntimeTemplate Required. The resource name of the NotebookRuntimeTemplate based on which a - * NotebookRuntime will be assigned (reuse or create a new one). - * @param NotebookRuntime $notebookRuntime Required. Provide runtime specific information (e.g. runtime owner, - * notebook id) used for NotebookRuntime assignment. - * @param array $optionalArgs { - * Optional. - * - * @type string $notebookRuntimeId - * Optional. User specified ID for the notebook runtime. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function assignNotebookRuntime( - $parent, - $notebookRuntimeTemplate, - $notebookRuntime, - array $optionalArgs = [] - ) { - $request = new AssignNotebookRuntimeRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setNotebookRuntimeTemplate($notebookRuntimeTemplate); - $request->setNotebookRuntime($notebookRuntime); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['notebookRuntimeId'])) { - $request->setNotebookRuntimeId($optionalArgs['notebookRuntimeId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'AssignNotebookRuntime', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a NotebookRuntimeTemplate. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedParent = $notebookServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $notebookRuntimeTemplate = new NotebookRuntimeTemplate(); - * $operationResponse = $notebookServiceClient->createNotebookRuntimeTemplate($formattedParent, $notebookRuntimeTemplate); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $notebookServiceClient->createNotebookRuntimeTemplate($formattedParent, $notebookRuntimeTemplate); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'createNotebookRuntimeTemplate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the - * NotebookRuntimeTemplate. Format: `projects/{project}/locations/{location}` - * @param NotebookRuntimeTemplate $notebookRuntimeTemplate Required. The NotebookRuntimeTemplate to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $notebookRuntimeTemplateId - * Optional. User specified ID for the notebook runtime template. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createNotebookRuntimeTemplate( - $parent, - $notebookRuntimeTemplate, - array $optionalArgs = [] - ) { - $request = new CreateNotebookRuntimeTemplateRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setNotebookRuntimeTemplate($notebookRuntimeTemplate); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['notebookRuntimeTemplateId'])) { - $request->setNotebookRuntimeTemplateId( - $optionalArgs['notebookRuntimeTemplateId'] - ); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateNotebookRuntimeTemplate', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a NotebookRuntime. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedName = $notebookServiceClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - * $operationResponse = $notebookServiceClient->deleteNotebookRuntime($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $notebookServiceClient->deleteNotebookRuntime($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'deleteNotebookRuntime'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NotebookRuntime resource to be deleted. - * Instead of checking whether the name is in valid NotebookRuntime resource - * name format, directly throw NotFound exception if there is no such - * NotebookRuntime in spanner. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteNotebookRuntime($name, array $optionalArgs = []) - { - $request = new DeleteNotebookRuntimeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteNotebookRuntime', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a NotebookRuntimeTemplate. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedName = $notebookServiceClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - * $operationResponse = $notebookServiceClient->deleteNotebookRuntimeTemplate($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $notebookServiceClient->deleteNotebookRuntimeTemplate($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'deleteNotebookRuntimeTemplate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NotebookRuntimeTemplate resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/notebookRuntimeTemplates/{notebook_runtime_template}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteNotebookRuntimeTemplate( - $name, - array $optionalArgs = [] - ) { - $request = new DeleteNotebookRuntimeTemplateRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteNotebookRuntimeTemplate', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets a NotebookRuntime. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedName = $notebookServiceClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - * $response = $notebookServiceClient->getNotebookRuntime($formattedName); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NotebookRuntime resource. - * Instead of checking whether the name is in valid NotebookRuntime resource - * name format, directly throw NotFound exception if there is no such - * NotebookRuntime in spanner. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\NotebookRuntime - * - * @throws ApiException if the remote call fails - */ - public function getNotebookRuntime($name, array $optionalArgs = []) - { - $request = new GetNotebookRuntimeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetNotebookRuntime', - NotebookRuntime::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a NotebookRuntimeTemplate. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedName = $notebookServiceClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - * $response = $notebookServiceClient->getNotebookRuntimeTemplate($formattedName); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NotebookRuntimeTemplate resource. - * Format: - * `projects/{project}/locations/{location}/notebookRuntimeTemplates/{notebook_runtime_template}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\NotebookRuntimeTemplate - * - * @throws ApiException if the remote call fails - */ - public function getNotebookRuntimeTemplate($name, array $optionalArgs = []) - { - $request = new GetNotebookRuntimeTemplateRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetNotebookRuntimeTemplate', - NotebookRuntimeTemplate::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists NotebookRuntimeTemplates in a Location. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedParent = $notebookServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $notebookServiceClient->listNotebookRuntimeTemplates($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $notebookServiceClient->listNotebookRuntimeTemplates($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location from which to list the - * NotebookRuntimeTemplates. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. An expression for filtering the results of the request. For field - * names both snake_case and camelCase are supported. - * - * * `notebookRuntimeTemplate` supports = and !=. `notebookRuntimeTemplate` - * represents the NotebookRuntimeTemplate ID, - * i.e. the last segment of the NotebookRuntimeTemplate's [resource name] - * [google.cloud.aiplatform.v1.NotebookRuntimeTemplate.name]. - * * `display_name` supports = and != - * * `labels` supports general map functions that is: - * * `labels.key=value` - key:value equality - * * `labels.key:* or labels:key - key existence - * * A key including a space must be quoted. `labels."a key"`. - * * `notebookRuntimeType` supports = and !=. notebookRuntimeType enum: - * [USER_DEFINED, ONE_CLICK]. - * - * Some examples: - * - * * `notebookRuntimeTemplate=notebookRuntimeTemplate123` - * * `displayName="myDisplayName"` - * * `labels.myKey="myValue"` - * * `notebookRuntimeType=USER_DEFINED` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Optional. Mask specifying which fields to read. - * @type string $orderBy - * Optional. A comma-separated list of fields to order by, sorted in ascending - * order. Use "desc" after a field name for descending. Supported fields: - * - * * `display_name` - * * `create_time` - * * `update_time` - * - * Example: `display_name, create_time desc`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listNotebookRuntimeTemplates( - $parent, - array $optionalArgs = [] - ) { - $request = new ListNotebookRuntimeTemplatesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListNotebookRuntimeTemplates', - $optionalArgs, - ListNotebookRuntimeTemplatesResponse::class, - $request - ); - } - - /** - * Lists NotebookRuntimes in a Location. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedParent = $notebookServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $notebookServiceClient->listNotebookRuntimes($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $notebookServiceClient->listNotebookRuntimes($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location from which to list the - * NotebookRuntimes. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. An expression for filtering the results of the request. For field - * names both snake_case and camelCase are supported. - * - * * `notebookRuntime` supports = and !=. `notebookRuntime` represents the - * NotebookRuntime ID, - * i.e. the last segment of the NotebookRuntime's [resource name] - * [google.cloud.aiplatform.v1.NotebookRuntime.name]. - * * `displayName` supports = and != and regex. - * * `notebookRuntimeTemplate` supports = and !=. `notebookRuntimeTemplate` - * represents the NotebookRuntimeTemplate ID, - * i.e. the last segment of the NotebookRuntimeTemplate's [resource name] - * [google.cloud.aiplatform.v1.NotebookRuntimeTemplate.name]. - * * `healthState` supports = and !=. healthState enum: [HEALTHY, UNHEALTHY, - * HEALTH_STATE_UNSPECIFIED]. - * * `runtimeState` supports = and !=. runtimeState enum: - * [RUNTIME_STATE_UNSPECIFIED, RUNNING, BEING_STARTED, BEING_STOPPED, - * STOPPED, BEING_UPGRADED, ERROR, INVALID]. - * * `runtimeUser` supports = and !=. - * * API version is UI only: `uiState` supports = and !=. uiState enum: - * [UI_RESOURCE_STATE_UNSPECIFIED, UI_RESOURCE_STATE_BEING_CREATED, - * UI_RESOURCE_STATE_ACTIVE, UI_RESOURCE_STATE_BEING_DELETED, - * UI_RESOURCE_STATE_CREATION_FAILED]. - * * `notebookRuntimeType` supports = and !=. notebookRuntimeType enum: - * [USER_DEFINED, ONE_CLICK]. - * - * Some examples: - * - * * `notebookRuntime="notebookRuntime123"` - * * `displayName="myDisplayName"` and `displayName=~"myDisplayNameRegex"` - * * `notebookRuntimeTemplate="notebookRuntimeTemplate321"` - * * `healthState=HEALTHY` - * * `runtimeState=RUNNING` - * * `runtimeUser="test@google.com"` - * * `uiState=UI_RESOURCE_STATE_BEING_DELETED` - * * `notebookRuntimeType=USER_DEFINED` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Optional. Mask specifying which fields to read. - * @type string $orderBy - * Optional. A comma-separated list of fields to order by, sorted in ascending - * order. Use "desc" after a field name for descending. Supported fields: - * - * * `display_name` - * * `create_time` - * * `update_time` - * - * Example: `display_name, create_time desc`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listNotebookRuntimes($parent, array $optionalArgs = []) - { - $request = new ListNotebookRuntimesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListNotebookRuntimes', - $optionalArgs, - ListNotebookRuntimesResponse::class, - $request - ); - } - - /** - * Starts a NotebookRuntime. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedName = $notebookServiceClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - * $operationResponse = $notebookServiceClient->startNotebookRuntime($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $notebookServiceClient->startNotebookRuntime($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'startNotebookRuntime'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NotebookRuntime resource to be started. - * Instead of checking whether the name is in valid NotebookRuntime resource - * name format, directly throw NotFound exception if there is no such - * NotebookRuntime in spanner. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function startNotebookRuntime($name, array $optionalArgs = []) - { - $request = new StartNotebookRuntimeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'StartNotebookRuntime', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates a NotebookRuntimeTemplate. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $notebookRuntimeTemplate = new NotebookRuntimeTemplate(); - * $updateMask = new FieldMask(); - * $response = $notebookServiceClient->updateNotebookRuntimeTemplate($notebookRuntimeTemplate, $updateMask); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param NotebookRuntimeTemplate $notebookRuntimeTemplate Required. The NotebookRuntimeTemplate to update. - * @param FieldMask $updateMask Required. The update mask applies to the resource. - * For the `FieldMask` definition, see - * [google.protobuf.FieldMask][google.protobuf.FieldMask]. Input format: - * `{paths: "${updated_filed}"}` Updatable fields: - * - * * `encryption_spec.kms_key_name` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\NotebookRuntimeTemplate - * - * @throws ApiException if the remote call fails - */ - public function updateNotebookRuntimeTemplate( - $notebookRuntimeTemplate, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateNotebookRuntimeTemplateRequest(); - $requestParamHeaders = []; - $request->setNotebookRuntimeTemplate($notebookRuntimeTemplate); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'notebook_runtime_template.name' - ] = $notebookRuntimeTemplate->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateNotebookRuntimeTemplate', - NotebookRuntimeTemplate::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Upgrades a NotebookRuntime. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $formattedName = $notebookServiceClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - * $operationResponse = $notebookServiceClient->upgradeNotebookRuntime($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $notebookServiceClient->upgradeNotebookRuntime($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'upgradeNotebookRuntime'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the NotebookRuntime resource to be upgrade. - * Instead of checking whether the name is in valid NotebookRuntime resource - * name format, directly throw NotFound exception if there is no such - * NotebookRuntime in spanner. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function upgradeNotebookRuntime($name, array $optionalArgs = []) - { - $request = new UpgradeNotebookRuntimeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpgradeNotebookRuntime', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $response = $notebookServiceClient->getLocation(); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $notebookServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $notebookServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $resource = 'resource'; - * $response = $notebookServiceClient->getIamPolicy($resource); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $notebookServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $notebookServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/PersistentResourceServiceGapicClient.php b/AiPlatform/src/V1/Gapic/PersistentResourceServiceGapicClient.php deleted file mode 100644 index fc35629dfebf..000000000000 --- a/AiPlatform/src/V1/Gapic/PersistentResourceServiceGapicClient.php +++ /dev/null @@ -1,1206 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $persistentResource = new PersistentResource(); - * $persistentResourceId = 'persistent_resource_id'; - * $operationResponse = $persistentResourceServiceClient->createPersistentResource($formattedParent, $persistentResource, $persistentResourceId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $persistentResourceServiceClient->createPersistentResource($formattedParent, $persistentResource, $persistentResourceId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $persistentResourceServiceClient->resumeOperation($operationName, 'createPersistentResource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\PersistentResourceServiceClient}. - */ -class PersistentResourceServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.PersistentResourceService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $locationNameTemplate; - - private static $networkNameTemplate; - - private static $persistentResourceNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/persistent_resource_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/persistent_resource_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/persistent_resource_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/persistent_resource_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getNetworkNameTemplate() - { - if (self::$networkNameTemplate == null) { - self::$networkNameTemplate = new PathTemplate( - 'projects/{project}/global/networks/{network}' - ); - } - - return self::$networkNameTemplate; - } - - private static function getPersistentResourceNameTemplate() - { - if (self::$persistentResourceNameTemplate == null) { - self::$persistentResourceNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/persistentResources/{persistent_resource}' - ); - } - - return self::$persistentResourceNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'location' => self::getLocationNameTemplate(), - 'network' => self::getNetworkNameTemplate(), - 'persistentResource' => self::getPersistentResourceNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a network - * resource. - * - * @param string $project - * @param string $network - * - * @return string The formatted network resource. - */ - public static function networkName($project, $network) - { - return self::getNetworkNameTemplate()->render([ - 'project' => $project, - 'network' => $network, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * persistent_resource resource. - * - * @param string $project - * @param string $location - * @param string $persistentResource - * - * @return string The formatted persistent_resource resource. - */ - public static function persistentResourceName( - $project, - $location, - $persistentResource - ) { - return self::getPersistentResourceNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'persistent_resource' => $persistentResource, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - location: projects/{project}/locations/{location} - * - network: projects/{project}/global/networks/{network} - * - persistentResource: projects/{project}/locations/{location}/persistentResources/{persistent_resource} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates a PersistentResource. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $formattedParent = $persistentResourceServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $persistentResource = new PersistentResource(); - * $persistentResourceId = 'persistent_resource_id'; - * $operationResponse = $persistentResourceServiceClient->createPersistentResource($formattedParent, $persistentResource, $persistentResourceId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $persistentResourceServiceClient->createPersistentResource($formattedParent, $persistentResource, $persistentResourceId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $persistentResourceServiceClient->resumeOperation($operationName, 'createPersistentResource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the - * PersistentResource in. Format: `projects/{project}/locations/{location}` - * @param PersistentResource $persistentResource Required. The PersistentResource to create. - * @param string $persistentResourceId Required. The ID to use for the PersistentResource, which become the final - * component of the PersistentResource's resource name. - * - * The maximum length is 63 characters, and valid characters - * are `/^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createPersistentResource( - $parent, - $persistentResource, - $persistentResourceId, - array $optionalArgs = [] - ) { - $request = new CreatePersistentResourceRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPersistentResource($persistentResource); - $request->setPersistentResourceId($persistentResourceId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreatePersistentResource', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a PersistentResource. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $formattedName = $persistentResourceServiceClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - * $operationResponse = $persistentResourceServiceClient->deletePersistentResource($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $persistentResourceServiceClient->deletePersistentResource($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $persistentResourceServiceClient->resumeOperation($operationName, 'deletePersistentResource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the PersistentResource to be deleted. - * Format: - * `projects/{project}/locations/{location}/persistentResources/{persistent_resource}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deletePersistentResource($name, array $optionalArgs = []) - { - $request = new DeletePersistentResourceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeletePersistentResource', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets a PersistentResource. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $formattedName = $persistentResourceServiceClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - * $response = $persistentResourceServiceClient->getPersistentResource($formattedName); - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the PersistentResource resource. - * Format: - * `projects/{project_id_or_number}/locations/{location_id}/persistentResources/{persistent_resource_id}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\PersistentResource - * - * @throws ApiException if the remote call fails - */ - public function getPersistentResource($name, array $optionalArgs = []) - { - $request = new GetPersistentResourceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetPersistentResource', - PersistentResource::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists PersistentResources in a Location. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $formattedParent = $persistentResourceServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $persistentResourceServiceClient->listPersistentResources($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $persistentResourceServiceClient->listPersistentResources($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the PersistentResources - * from. Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listPersistentResources($parent, array $optionalArgs = []) - { - $request = new ListPersistentResourcesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListPersistentResources', - $optionalArgs, - ListPersistentResourcesResponse::class, - $request - ); - } - - /** - * Reboots a PersistentResource. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $formattedName = $persistentResourceServiceClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - * $operationResponse = $persistentResourceServiceClient->rebootPersistentResource($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $persistentResourceServiceClient->rebootPersistentResource($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $persistentResourceServiceClient->resumeOperation($operationName, 'rebootPersistentResource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the PersistentResource resource. - * Format: - * `projects/{project_id_or_number}/locations/{location_id}/persistentResources/{persistent_resource_id}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function rebootPersistentResource($name, array $optionalArgs = []) - { - $request = new RebootPersistentResourceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'RebootPersistentResource', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates a PersistentResource. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $persistentResource = new PersistentResource(); - * $updateMask = new FieldMask(); - * $operationResponse = $persistentResourceServiceClient->updatePersistentResource($persistentResource, $updateMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $persistentResourceServiceClient->updatePersistentResource($persistentResource, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $persistentResourceServiceClient->resumeOperation($operationName, 'updatePersistentResource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param PersistentResource $persistentResource Required. The PersistentResource to update. - * - * The PersistentResource's `name` field is used to identify the - * PersistentResource to update. Format: - * `projects/{project}/locations/{location}/persistentResources/{persistent_resource}` - * @param FieldMask $updateMask Required. Specify the fields to be overwritten in the PersistentResource by - * the update method. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updatePersistentResource( - $persistentResource, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdatePersistentResourceRequest(); - $requestParamHeaders = []; - $request->setPersistentResource($persistentResource); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'persistent_resource.name' - ] = $persistentResource->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdatePersistentResource', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $response = $persistentResourceServiceClient->getLocation(); - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $persistentResourceServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $persistentResourceServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $resource = 'resource'; - * $response = $persistentResourceServiceClient->getIamPolicy($resource); - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $persistentResourceServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $persistentResourceServiceClient = new PersistentResourceServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $persistentResourceServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $persistentResourceServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/PipelineServiceGapicClient.php b/AiPlatform/src/V1/Gapic/PipelineServiceGapicClient.php deleted file mode 100644 index 55131849e3b5..000000000000 --- a/AiPlatform/src/V1/Gapic/PipelineServiceGapicClient.php +++ /dev/null @@ -1,2053 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $formattedNames = [ - * $pipelineServiceClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - * ]; - * $operationResponse = $pipelineServiceClient->batchCancelPipelineJobs($formattedParent, $formattedNames); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $pipelineServiceClient->batchCancelPipelineJobs($formattedParent, $formattedNames); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $pipelineServiceClient->resumeOperation($operationName, 'batchCancelPipelineJobs'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\PipelineServiceClient}. - */ -class PipelineServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.PipelineService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $artifactNameTemplate; - - private static $contextNameTemplate; - - private static $customJobNameTemplate; - - private static $endpointNameTemplate; - - private static $executionNameTemplate; - - private static $locationNameTemplate; - - private static $metadataStoreNameTemplate; - - private static $modelNameTemplate; - - private static $networkNameTemplate; - - private static $pipelineJobNameTemplate; - - private static $projectLocationEndpointNameTemplate; - - private static $projectLocationPublisherModelNameTemplate; - - private static $trainingPipelineNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/pipeline_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/pipeline_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/pipeline_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/pipeline_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getArtifactNameTemplate() - { - if (self::$artifactNameTemplate == null) { - self::$artifactNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact}' - ); - } - - return self::$artifactNameTemplate; - } - - private static function getContextNameTemplate() - { - if (self::$contextNameTemplate == null) { - self::$contextNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context}' - ); - } - - return self::$contextNameTemplate; - } - - private static function getCustomJobNameTemplate() - { - if (self::$customJobNameTemplate == null) { - self::$customJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/customJobs/{custom_job}' - ); - } - - return self::$customJobNameTemplate; - } - - private static function getEndpointNameTemplate() - { - if (self::$endpointNameTemplate == null) { - self::$endpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$endpointNameTemplate; - } - - private static function getExecutionNameTemplate() - { - if (self::$executionNameTemplate == null) { - self::$executionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/executions/{execution}' - ); - } - - return self::$executionNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getMetadataStoreNameTemplate() - { - if (self::$metadataStoreNameTemplate == null) { - self::$metadataStoreNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}' - ); - } - - return self::$metadataStoreNameTemplate; - } - - private static function getModelNameTemplate() - { - if (self::$modelNameTemplate == null) { - self::$modelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/models/{model}' - ); - } - - return self::$modelNameTemplate; - } - - private static function getNetworkNameTemplate() - { - if (self::$networkNameTemplate == null) { - self::$networkNameTemplate = new PathTemplate( - 'projects/{project}/global/networks/{network}' - ); - } - - return self::$networkNameTemplate; - } - - private static function getPipelineJobNameTemplate() - { - if (self::$pipelineJobNameTemplate == null) { - self::$pipelineJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}' - ); - } - - return self::$pipelineJobNameTemplate; - } - - private static function getProjectLocationEndpointNameTemplate() - { - if (self::$projectLocationEndpointNameTemplate == null) { - self::$projectLocationEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$projectLocationEndpointNameTemplate; - } - - private static function getProjectLocationPublisherModelNameTemplate() - { - if (self::$projectLocationPublisherModelNameTemplate == null) { - self::$projectLocationPublisherModelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/publishers/{publisher}/models/{model}' - ); - } - - return self::$projectLocationPublisherModelNameTemplate; - } - - private static function getTrainingPipelineNameTemplate() - { - if (self::$trainingPipelineNameTemplate == null) { - self::$trainingPipelineNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/trainingPipelines/{training_pipeline}' - ); - } - - return self::$trainingPipelineNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'artifact' => self::getArtifactNameTemplate(), - 'context' => self::getContextNameTemplate(), - 'customJob' => self::getCustomJobNameTemplate(), - 'endpoint' => self::getEndpointNameTemplate(), - 'execution' => self::getExecutionNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'metadataStore' => self::getMetadataStoreNameTemplate(), - 'model' => self::getModelNameTemplate(), - 'network' => self::getNetworkNameTemplate(), - 'pipelineJob' => self::getPipelineJobNameTemplate(), - 'projectLocationEndpoint' => self::getProjectLocationEndpointNameTemplate(), - 'projectLocationPublisherModel' => self::getProjectLocationPublisherModelNameTemplate(), - 'trainingPipeline' => self::getTrainingPipelineNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a artifact - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $artifact - * - * @return string The formatted artifact resource. - */ - public static function artifactName( - $project, - $location, - $metadataStore, - $artifact - ) { - return self::getArtifactNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'artifact' => $artifact, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a context - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $context - * - * @return string The formatted context resource. - */ - public static function contextName( - $project, - $location, - $metadataStore, - $context - ) { - return self::getContextNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'context' => $context, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a custom_job - * resource. - * - * @param string $project - * @param string $location - * @param string $customJob - * - * @return string The formatted custom_job resource. - */ - public static function customJobName($project, $location, $customJob) - { - return self::getCustomJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'custom_job' => $customJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a endpoint - * resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted endpoint resource. - */ - public static function endpointName($project, $location, $endpoint) - { - return self::getEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a execution - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $execution - * - * @return string The formatted execution resource. - */ - public static function executionName( - $project, - $location, - $metadataStore, - $execution - ) { - return self::getExecutionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'execution' => $execution, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * metadata_store resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * - * @return string The formatted metadata_store resource. - */ - public static function metadataStoreName( - $project, - $location, - $metadataStore - ) { - return self::getMetadataStoreNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName($project, $location, $model) - { - return self::getModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a network - * resource. - * - * @param string $project - * @param string $network - * - * @return string The formatted network resource. - */ - public static function networkName($project, $network) - { - return self::getNetworkNameTemplate()->render([ - 'project' => $project, - 'network' => $network, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a pipeline_job - * resource. - * - * @param string $project - * @param string $location - * @param string $pipelineJob - * - * @return string The formatted pipeline_job resource. - */ - public static function pipelineJobName($project, $location, $pipelineJob) - { - return self::getPipelineJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'pipeline_job' => $pipelineJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted project_location_endpoint resource. - */ - public static function projectLocationEndpointName( - $project, - $location, - $endpoint - ) { - return self::getProjectLocationEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_publisher_model resource. - * - * @param string $project - * @param string $location - * @param string $publisher - * @param string $model - * - * @return string The formatted project_location_publisher_model resource. - */ - public static function projectLocationPublisherModelName( - $project, - $location, - $publisher, - $model - ) { - return self::getProjectLocationPublisherModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'publisher' => $publisher, - 'model' => $model, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * training_pipeline resource. - * - * @param string $project - * @param string $location - * @param string $trainingPipeline - * - * @return string The formatted training_pipeline resource. - */ - public static function trainingPipelineName( - $project, - $location, - $trainingPipeline - ) { - return self::getTrainingPipelineNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'training_pipeline' => $trainingPipeline, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - artifact: projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact} - * - context: projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context} - * - customJob: projects/{project}/locations/{location}/customJobs/{custom_job} - * - endpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - execution: projects/{project}/locations/{location}/metadataStores/{metadata_store}/executions/{execution} - * - location: projects/{project}/locations/{location} - * - metadataStore: projects/{project}/locations/{location}/metadataStores/{metadata_store} - * - model: projects/{project}/locations/{location}/models/{model} - * - network: projects/{project}/global/networks/{network} - * - pipelineJob: projects/{project}/locations/{location}/pipelineJobs/{pipeline_job} - * - projectLocationEndpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - projectLocationPublisherModel: projects/{project}/locations/{location}/publishers/{publisher}/models/{model} - * - trainingPipeline: projects/{project}/locations/{location}/trainingPipelines/{training_pipeline} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Batch cancel PipelineJobs. - * Firstly the server will check if all the jobs are in non-terminal states, - * and skip the jobs that are already terminated. - * If the operation failed, none of the pipeline jobs are cancelled. - * The server will poll the states of all the pipeline jobs periodically - * to check the cancellation status. - * This operation will return an LRO. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedParent = $pipelineServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $formattedNames = [ - * $pipelineServiceClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - * ]; - * $operationResponse = $pipelineServiceClient->batchCancelPipelineJobs($formattedParent, $formattedNames); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $pipelineServiceClient->batchCancelPipelineJobs($formattedParent, $formattedNames); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $pipelineServiceClient->resumeOperation($operationName, 'batchCancelPipelineJobs'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the PipelineJobs' parent resource. - * Format: `projects/{project}/locations/{location}` - * @param string[] $names Required. The names of the PipelineJobs to cancel. - * A maximum of 32 PipelineJobs can be cancelled in a batch. - * Format: - * `projects/{project}/locations/{location}/pipelineJobs/{pipelineJob}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function batchCancelPipelineJobs( - $parent, - $names, - array $optionalArgs = [] - ) { - $request = new BatchCancelPipelineJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setNames($names); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'BatchCancelPipelineJobs', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Batch deletes PipelineJobs - * The Operation is atomic. If it fails, none of the PipelineJobs are deleted. - * If it succeeds, all of the PipelineJobs are deleted. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedParent = $pipelineServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $formattedNames = [ - * $pipelineServiceClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - * ]; - * $operationResponse = $pipelineServiceClient->batchDeletePipelineJobs($formattedParent, $formattedNames); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $pipelineServiceClient->batchDeletePipelineJobs($formattedParent, $formattedNames); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $pipelineServiceClient->resumeOperation($operationName, 'batchDeletePipelineJobs'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the PipelineJobs' parent resource. - * Format: `projects/{project}/locations/{location}` - * @param string[] $names Required. The names of the PipelineJobs to delete. - * A maximum of 32 PipelineJobs can be deleted in a batch. - * Format: - * `projects/{project}/locations/{location}/pipelineJobs/{pipelineJob}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function batchDeletePipelineJobs( - $parent, - $names, - array $optionalArgs = [] - ) { - $request = new BatchDeletePipelineJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setNames($names); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'BatchDeletePipelineJobs', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Cancels a PipelineJob. - * Starts asynchronous cancellation on the PipelineJob. The server - * makes a best effort to cancel the pipeline, but success is not - * guaranteed. Clients can use - * [PipelineService.GetPipelineJob][google.cloud.aiplatform.v1.PipelineService.GetPipelineJob] - * or other methods to check whether the cancellation succeeded or whether the - * pipeline completed despite cancellation. On successful cancellation, - * the PipelineJob is not deleted; instead it becomes a pipeline with - * a [PipelineJob.error][google.cloud.aiplatform.v1.PipelineJob.error] value - * with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding - * to `Code.CANCELLED`, and - * [PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to - * `CANCELLED`. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedName = $pipelineServiceClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - * $pipelineServiceClient->cancelPipelineJob($formattedName); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the PipelineJob to cancel. - * Format: - * `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function cancelPipelineJob($name, array $optionalArgs = []) - { - $request = new CancelPipelineJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CancelPipelineJob', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Cancels a TrainingPipeline. - * Starts asynchronous cancellation on the TrainingPipeline. The server - * makes a best effort to cancel the pipeline, but success is not - * guaranteed. Clients can use - * [PipelineService.GetTrainingPipeline][google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline] - * or other methods to check whether the cancellation succeeded or whether the - * pipeline completed despite cancellation. On successful cancellation, - * the TrainingPipeline is not deleted; instead it becomes a pipeline with - * a - * [TrainingPipeline.error][google.cloud.aiplatform.v1.TrainingPipeline.error] - * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`, and - * [TrainingPipeline.state][google.cloud.aiplatform.v1.TrainingPipeline.state] - * is set to `CANCELLED`. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedName = $pipelineServiceClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - * $pipelineServiceClient->cancelTrainingPipeline($formattedName); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TrainingPipeline to cancel. - * Format: - * `projects/{project}/locations/{location}/trainingPipelines/{training_pipeline}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function cancelTrainingPipeline($name, array $optionalArgs = []) - { - $request = new CancelTrainingPipelineRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CancelTrainingPipeline', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a PipelineJob. A PipelineJob will run immediately when created. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedParent = $pipelineServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $pipelineJob = new PipelineJob(); - * $response = $pipelineServiceClient->createPipelineJob($formattedParent, $pipelineJob); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the PipelineJob in. - * Format: `projects/{project}/locations/{location}` - * @param PipelineJob $pipelineJob Required. The PipelineJob to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $pipelineJobId - * The ID to use for the PipelineJob, which will become the final component of - * the PipelineJob name. If not provided, an ID will be automatically - * generated. - * - * This value should be less than 128 characters, and valid characters - * are `/[a-z][0-9]-/`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\PipelineJob - * - * @throws ApiException if the remote call fails - */ - public function createPipelineJob( - $parent, - $pipelineJob, - array $optionalArgs = [] - ) { - $request = new CreatePipelineJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPipelineJob($pipelineJob); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pipelineJobId'])) { - $request->setPipelineJobId($optionalArgs['pipelineJobId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreatePipelineJob', - PipelineJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a TrainingPipeline. A created TrainingPipeline right away will be - * attempted to be run. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedParent = $pipelineServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $trainingPipeline = new TrainingPipeline(); - * $response = $pipelineServiceClient->createTrainingPipeline($formattedParent, $trainingPipeline); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the TrainingPipeline - * in. Format: `projects/{project}/locations/{location}` - * @param TrainingPipeline $trainingPipeline Required. The TrainingPipeline to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TrainingPipeline - * - * @throws ApiException if the remote call fails - */ - public function createTrainingPipeline( - $parent, - $trainingPipeline, - array $optionalArgs = [] - ) { - $request = new CreateTrainingPipelineRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setTrainingPipeline($trainingPipeline); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateTrainingPipeline', - TrainingPipeline::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes a PipelineJob. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedName = $pipelineServiceClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - * $operationResponse = $pipelineServiceClient->deletePipelineJob($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $pipelineServiceClient->deletePipelineJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $pipelineServiceClient->resumeOperation($operationName, 'deletePipelineJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the PipelineJob resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deletePipelineJob($name, array $optionalArgs = []) - { - $request = new DeletePipelineJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeletePipelineJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a TrainingPipeline. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedName = $pipelineServiceClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - * $operationResponse = $pipelineServiceClient->deleteTrainingPipeline($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $pipelineServiceClient->deleteTrainingPipeline($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $pipelineServiceClient->resumeOperation($operationName, 'deleteTrainingPipeline'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TrainingPipeline resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/trainingPipelines/{training_pipeline}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteTrainingPipeline($name, array $optionalArgs = []) - { - $request = new DeleteTrainingPipelineRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteTrainingPipeline', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets a PipelineJob. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedName = $pipelineServiceClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - * $response = $pipelineServiceClient->getPipelineJob($formattedName); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the PipelineJob resource. - * Format: - * `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\PipelineJob - * - * @throws ApiException if the remote call fails - */ - public function getPipelineJob($name, array $optionalArgs = []) - { - $request = new GetPipelineJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetPipelineJob', - PipelineJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a TrainingPipeline. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedName = $pipelineServiceClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - * $response = $pipelineServiceClient->getTrainingPipeline($formattedName); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TrainingPipeline resource. - * Format: - * `projects/{project}/locations/{location}/trainingPipelines/{training_pipeline}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TrainingPipeline - * - * @throws ApiException if the remote call fails - */ - public function getTrainingPipeline($name, array $optionalArgs = []) - { - $request = new GetTrainingPipelineRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetTrainingPipeline', - TrainingPipeline::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists PipelineJobs in a Location. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedParent = $pipelineServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $pipelineServiceClient->listPipelineJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $pipelineServiceClient->listPipelineJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the PipelineJobs from. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the PipelineJobs that match the filter expression. The following - * fields are supported: - * - * * `pipeline_name`: Supports `=` and `!=` comparisons. - * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard. - * * `pipeline_job_user_id`: Supports `=`, `!=` comparisons, and `:` wildcard. - * for example, can check if pipeline's display_name contains *step* by - * doing display_name:\"*step*\" - * * `state`: Supports `=` and `!=` comparisons. - * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be in RFC 3339 format. - * * `update_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be in RFC 3339 format. - * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be in RFC 3339 format. - * * `labels`: Supports key-value equality and key presence. - * * `template_uri`: Supports `=`, `!=` comparisons, and `:` wildcard. - * * `template_metadata.version`: Supports `=`, `!=` comparisons, and `:` - * wildcard. - * - * Filter expressions can be combined together using logical operators - * (`AND` & `OR`). - * For example: `pipeline_name="test" AND create_time>"2020-05-18T13:30:00Z"`. - * - * The syntax to define filter expression is based on - * https://google.aip.dev/160. - * - * Examples: - * - * * `create_time>"2021-05-18T00:00:00Z" OR - * update_time>"2020-05-18T00:00:00Z"` PipelineJobs created or updated - * after 2020-05-18 00:00:00 UTC. - * * `labels.env = "prod"` - * PipelineJobs with label "env" set to "prod". - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by. The default sort order is in - * ascending order. Use "desc" after a field name for descending. You can have - * multiple order_by fields provided e.g. "create_time desc, end_time", - * "end_time, start_time, update_time" For example, using "create_time desc, - * end_time" will order results by create time in descending order, and if - * there are multiple jobs having the same create time, order them by the end - * time in ascending order. if order_by is not specified, it will order by - * default order is create time in descending order. Supported fields: - * - * * `create_time` - * * `update_time` - * * `end_time` - * * `start_time` - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listPipelineJobs($parent, array $optionalArgs = []) - { - $request = new ListPipelineJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListPipelineJobs', - $optionalArgs, - ListPipelineJobsResponse::class, - $request - ); - } - - /** - * Lists TrainingPipelines in a Location. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $formattedParent = $pipelineServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $pipelineServiceClient->listTrainingPipelines($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $pipelineServiceClient->listTrainingPipelines($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the TrainingPipelines - * from. Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * The standard list filter. - * - * Supported fields: - * - * * `display_name` supports `=`, `!=` comparisons, and `:` wildcard. - * * `state` supports `=`, `!=` comparisons. - * * `training_task_definition` `=`, `!=` comparisons, and `:` wildcard. - * * `create_time` supports `=`, `!=`,`<`, `<=`,`>`, `>=` comparisons. - * `create_time` must be in RFC 3339 format. - * * `labels` supports general map functions that is: - * `labels.key=value` - key:value equality - * `labels.key:* - key existence - * - * Some examples of using the filter are: - * - * * `state="PIPELINE_STATE_SUCCEEDED" AND display_name:"my_pipeline_*"` - * * `state!="PIPELINE_STATE_FAILED" OR display_name="my_pipeline"` - * * `NOT display_name="my_pipeline"` - * * `create_time>"2021-05-18T00:00:00Z"` - * * `training_task_definition:"*automl_text_classification*"` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTrainingPipelines($parent, array $optionalArgs = []) - { - $request = new ListTrainingPipelinesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListTrainingPipelines', - $optionalArgs, - ListTrainingPipelinesResponse::class, - $request - ); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $response = $pipelineServiceClient->getLocation(); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $pipelineServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $pipelineServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $resource = 'resource'; - * $response = $pipelineServiceClient->getIamPolicy($resource); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $pipelineServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $pipelineServiceClient = new PipelineServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $pipelineServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $pipelineServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/PredictionServiceGapicClient.php b/AiPlatform/src/V1/Gapic/PredictionServiceGapicClient.php deleted file mode 100644 index 4b7f7d104396..000000000000 --- a/AiPlatform/src/V1/Gapic/PredictionServiceGapicClient.php +++ /dev/null @@ -1,1699 +0,0 @@ -endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $response = $predictionServiceClient->directPredict($formattedEndpoint); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\PredictionServiceClient}. - */ -class PredictionServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.PredictionService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - ]; - - private static $endpointNameTemplate; - - private static $projectLocationEndpointNameTemplate; - - private static $projectLocationPublisherModelNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/prediction_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/prediction_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/prediction_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/prediction_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getEndpointNameTemplate() - { - if (self::$endpointNameTemplate == null) { - self::$endpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$endpointNameTemplate; - } - - private static function getProjectLocationEndpointNameTemplate() - { - if (self::$projectLocationEndpointNameTemplate == null) { - self::$projectLocationEndpointNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/endpoints/{endpoint}' - ); - } - - return self::$projectLocationEndpointNameTemplate; - } - - private static function getProjectLocationPublisherModelNameTemplate() - { - if (self::$projectLocationPublisherModelNameTemplate == null) { - self::$projectLocationPublisherModelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/publishers/{publisher}/models/{model}' - ); - } - - return self::$projectLocationPublisherModelNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'endpoint' => self::getEndpointNameTemplate(), - 'projectLocationEndpoint' => self::getProjectLocationEndpointNameTemplate(), - 'projectLocationPublisherModel' => self::getProjectLocationPublisherModelNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a endpoint - * resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted endpoint resource. - */ - public static function endpointName($project, $location, $endpoint) - { - return self::getEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_endpoint resource. - * - * @param string $project - * @param string $location - * @param string $endpoint - * - * @return string The formatted project_location_endpoint resource. - */ - public static function projectLocationEndpointName( - $project, - $location, - $endpoint - ) { - return self::getProjectLocationEndpointNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'endpoint' => $endpoint, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_publisher_model resource. - * - * @param string $project - * @param string $location - * @param string $publisher - * @param string $model - * - * @return string The formatted project_location_publisher_model resource. - */ - public static function projectLocationPublisherModelName( - $project, - $location, - $publisher, - $model - ) { - return self::getProjectLocationPublisherModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'publisher' => $publisher, - 'model' => $model, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - endpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - projectLocationEndpoint: projects/{project}/locations/{location}/endpoints/{endpoint} - * - projectLocationPublisherModel: projects/{project}/locations/{location}/publishers/{publisher}/models/{model} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Perform an unary online prediction request to a gRPC model server for - * Vertex first-party products and frameworks. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $formattedEndpoint = $predictionServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $response = $predictionServiceClient->directPredict($formattedEndpoint); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint requested to serve the prediction. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type Tensor[] $inputs - * The prediction input. - * @type Tensor $parameters - * The parameters that govern the prediction. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\DirectPredictResponse - * - * @throws ApiException if the remote call fails - */ - public function directPredict($endpoint, array $optionalArgs = []) - { - $request = new DirectPredictRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $requestParamHeaders['endpoint'] = $endpoint; - if (isset($optionalArgs['inputs'])) { - $request->setInputs($optionalArgs['inputs']); - } - - if (isset($optionalArgs['parameters'])) { - $request->setParameters($optionalArgs['parameters']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'DirectPredict', - DirectPredictResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Perform an unary online prediction request to a gRPC model server for - * custom containers. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $formattedEndpoint = $predictionServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $response = $predictionServiceClient->directRawPredict($formattedEndpoint); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint requested to serve the prediction. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type string $methodName - * Fully qualified name of the API method being invoked to perform - * predictions. - * - * Format: - * `/namespace.Service/Method/` - * Example: - * `/tensorflow.serving.PredictionService/Predict` - * @type string $input - * The prediction input. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\DirectRawPredictResponse - * - * @throws ApiException if the remote call fails - */ - public function directRawPredict($endpoint, array $optionalArgs = []) - { - $request = new DirectRawPredictRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $requestParamHeaders['endpoint'] = $endpoint; - if (isset($optionalArgs['methodName'])) { - $request->setMethodName($optionalArgs['methodName']); - } - - if (isset($optionalArgs['input'])) { - $request->setInput($optionalArgs['input']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'DirectRawPredict', - DirectRawPredictResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Perform an online explanation. - * - * If - * [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] - * is specified, the corresponding DeployModel must have - * [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] - * populated. If - * [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] - * is not specified, all DeployedModels must have - * [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] - * populated. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $formattedEndpoint = $predictionServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $instances = []; - * $response = $predictionServiceClient->explain($formattedEndpoint, $instances); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint requested to serve the explanation. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param Value[] $instances Required. The instances that are the input to the explanation call. - * A DeployedModel may have an upper limit on the number of instances it - * supports per request, and when it is exceeded the explanation call errors - * in case of AutoML Models, or, in case of customer created Models, the - * behaviour is as documented by that Model. - * The schema of any single instance may be specified via Endpoint's - * DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] - * [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] - * [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri]. - * @param array $optionalArgs { - * Optional. - * - * @type Value $parameters - * The parameters that govern the prediction. The schema of the parameters may - * be specified via Endpoint's DeployedModels' [Model's - * ][google.cloud.aiplatform.v1.DeployedModel.model] - * [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] - * [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri]. - * @type ExplanationSpecOverride $explanationSpecOverride - * If specified, overrides the - * [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] - * of the DeployedModel. Can be used for explaining prediction results with - * different configurations, such as: - * - Explaining top-5 predictions results as opposed to top-1; - * - Increasing path count or step count of the attribution methods to reduce - * approximate errors; - * - Using different baselines for explaining the prediction results. - * @type string $deployedModelId - * If specified, this ExplainRequest will be served by the chosen - * DeployedModel, overriding - * [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split]. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ExplainResponse - * - * @throws ApiException if the remote call fails - */ - public function explain($endpoint, $instances, array $optionalArgs = []) - { - $request = new ExplainRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $request->setInstances($instances); - $requestParamHeaders['endpoint'] = $endpoint; - if (isset($optionalArgs['parameters'])) { - $request->setParameters($optionalArgs['parameters']); - } - - if (isset($optionalArgs['explanationSpecOverride'])) { - $request->setExplanationSpecOverride( - $optionalArgs['explanationSpecOverride'] - ); - } - - if (isset($optionalArgs['deployedModelId'])) { - $request->setDeployedModelId($optionalArgs['deployedModelId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'Explain', - ExplainResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Generate content with multimodal inputs. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $model = 'model'; - * $contents = []; - * $response = $predictionServiceClient->generateContent($model, $contents); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $model Required. The name of the publisher model requested to serve the - * prediction. Format: - * `projects/{project}/locations/{location}/publishers/*/models/*` - * @param Content[] $contents Required. The content of the current conversation with the model. - * - * For single-turn queries, this is a single instance. For multi-turn queries, - * this is a repeated field that contains conversation history + latest - * request. - * @param array $optionalArgs { - * Optional. - * - * @type Content $systemInstruction - * Optional. The user provided system instructions for the model. - * Note: only text should be used in parts and content in each part will be in - * a separate paragraph. - * @type Tool[] $tools - * Optional. A list of `Tools` the model may use to generate the next - * response. - * - * A `Tool` is a piece of code that enables the system to interact with - * external systems to perform an action, or set of actions, outside of - * knowledge and scope of the model. - * @type ToolConfig $toolConfig - * Optional. Tool config. This config is shared for all tools provided in the - * request. - * @type SafetySetting[] $safetySettings - * Optional. Per request settings for blocking unsafe content. - * Enforced on GenerateContentResponse.candidates. - * @type GenerationConfig $generationConfig - * Optional. Generation config. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\GenerateContentResponse - * - * @throws ApiException if the remote call fails - */ - public function generateContent($model, $contents, array $optionalArgs = []) - { - $request = new GenerateContentRequest(); - $requestParamHeaders = []; - $request->setModel($model); - $request->setContents($contents); - $requestParamHeaders['model'] = $model; - if (isset($optionalArgs['systemInstruction'])) { - $request->setSystemInstruction($optionalArgs['systemInstruction']); - } - - if (isset($optionalArgs['tools'])) { - $request->setTools($optionalArgs['tools']); - } - - if (isset($optionalArgs['toolConfig'])) { - $request->setToolConfig($optionalArgs['toolConfig']); - } - - if (isset($optionalArgs['safetySettings'])) { - $request->setSafetySettings($optionalArgs['safetySettings']); - } - - if (isset($optionalArgs['generationConfig'])) { - $request->setGenerationConfig($optionalArgs['generationConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GenerateContent', - GenerateContentResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Perform an online prediction. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $formattedEndpoint = $predictionServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $instances = []; - * $response = $predictionServiceClient->predict($formattedEndpoint, $instances); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint requested to serve the prediction. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param Value[] $instances Required. The instances that are the input to the prediction call. - * A DeployedModel may have an upper limit on the number of instances it - * supports per request, and when it is exceeded the prediction call errors - * in case of AutoML Models, or, in case of customer created Models, the - * behaviour is as documented by that Model. - * The schema of any single instance may be specified via Endpoint's - * DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] - * [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] - * [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri]. - * @param array $optionalArgs { - * Optional. - * - * @type Value $parameters - * The parameters that govern the prediction. The schema of the parameters may - * be specified via Endpoint's DeployedModels' [Model's - * ][google.cloud.aiplatform.v1.DeployedModel.model] - * [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] - * [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri]. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\PredictResponse - * - * @throws ApiException if the remote call fails - */ - public function predict($endpoint, $instances, array $optionalArgs = []) - { - $request = new PredictRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $request->setInstances($instances); - $requestParamHeaders['endpoint'] = $endpoint; - if (isset($optionalArgs['parameters'])) { - $request->setParameters($optionalArgs['parameters']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'Predict', - PredictResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Perform an online prediction with an arbitrary HTTP payload. - * - * The response includes the following HTTP headers: - * - * * `X-Vertex-AI-Endpoint-Id`: ID of the - * [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this - * prediction. - * - * * `X-Vertex-AI-Deployed-Model-Id`: ID of the Endpoint's - * [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this - * prediction. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $formattedEndpoint = $predictionServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * $response = $predictionServiceClient->rawPredict($formattedEndpoint); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint requested to serve the prediction. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type HttpBody $httpBody - * The prediction input. Supports HTTP headers and arbitrary data payload. - * - * A [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] may have an - * upper limit on the number of instances it supports per request. When this - * limit it is exceeded for an AutoML model, the - * [RawPredict][google.cloud.aiplatform.v1.PredictionService.RawPredict] - * method returns an error. When this limit is exceeded for a custom-trained - * model, the behavior varies depending on the model. - * - * You can specify the schema for each instance in the - * [predict_schemata.instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri] - * field when you create a [Model][google.cloud.aiplatform.v1.Model]. This - * schema applies when you deploy the `Model` as a `DeployedModel` to an - * [Endpoint][google.cloud.aiplatform.v1.Endpoint] and use the `RawPredict` - * method. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Api\HttpBody - * - * @throws ApiException if the remote call fails - */ - public function rawPredict($endpoint, array $optionalArgs = []) - { - $request = new RawPredictRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $requestParamHeaders['endpoint'] = $endpoint; - if (isset($optionalArgs['httpBody'])) { - $request->setHttpBody($optionalArgs['httpBody']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'RawPredict', - HttpBody::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Perform a server-side streaming online prediction request for Vertex - * LLM streaming. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $formattedEndpoint = $predictionServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * // Read all responses until the stream is complete - * $stream = $predictionServiceClient->serverStreamingPredict($formattedEndpoint); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint requested to serve the prediction. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type Tensor[] $inputs - * The prediction input. - * @type Tensor $parameters - * The parameters that govern the prediction. - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function serverStreamingPredict($endpoint, array $optionalArgs = []) - { - $request = new StreamingPredictRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $requestParamHeaders['endpoint'] = $endpoint; - if (isset($optionalArgs['inputs'])) { - $request->setInputs($optionalArgs['inputs']); - } - - if (isset($optionalArgs['parameters'])) { - $request->setParameters($optionalArgs['parameters']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ServerStreamingPredict', - StreamingPredictResponse::class, - $optionalArgs, - $request, - Call::SERVER_STREAMING_CALL - ); - } - - /** - * Perform a streaming online prediction request to a gRPC model server for - * Vertex first-party products and frameworks. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $endpoint = 'endpoint'; - * $request = new StreamDirectPredictRequest(); - * $request->setEndpoint($endpoint); - * // Write all requests to the server, then read all responses until the - * // stream is complete - * $requests = [ - * $request, - * ]; - * $stream = $predictionServiceClient->streamDirectPredict(); - * $stream->writeAll($requests); - * foreach ($stream->closeWriteAndReadAll() as $element) { - * // doSomethingWith($element); - * } - * // Alternatively: - * // Write requests individually, making read() calls if - * // required. Call closeWrite() once writes are complete, and read the - * // remaining responses from the server. - * $requests = [ - * $request, - * ]; - * $stream = $predictionServiceClient->streamDirectPredict(); - * foreach ($requests as $request) { - * $stream->write($request); - * // if required, read a single response from the stream - * $element = $stream->read(); - * // doSomethingWith($element) - * } - * $stream->closeWrite(); - * $element = $stream->read(); - * while (!is_null($element)) { - * // doSomethingWith($element) - * $element = $stream->read(); - * } - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\BidiStream - * - * @throws ApiException if the remote call fails - */ - public function streamDirectPredict(array $optionalArgs = []) - { - return $this->startCall( - 'StreamDirectPredict', - StreamDirectPredictResponse::class, - $optionalArgs, - null, - Call::BIDI_STREAMING_CALL - ); - } - - /** - * Perform a streaming online prediction request to a gRPC model server for - * custom containers. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $endpoint = 'endpoint'; - * $request = new StreamDirectRawPredictRequest(); - * $request->setEndpoint($endpoint); - * // Write all requests to the server, then read all responses until the - * // stream is complete - * $requests = [ - * $request, - * ]; - * $stream = $predictionServiceClient->streamDirectRawPredict(); - * $stream->writeAll($requests); - * foreach ($stream->closeWriteAndReadAll() as $element) { - * // doSomethingWith($element); - * } - * // Alternatively: - * // Write requests individually, making read() calls if - * // required. Call closeWrite() once writes are complete, and read the - * // remaining responses from the server. - * $requests = [ - * $request, - * ]; - * $stream = $predictionServiceClient->streamDirectRawPredict(); - * foreach ($requests as $request) { - * $stream->write($request); - * // if required, read a single response from the stream - * $element = $stream->read(); - * // doSomethingWith($element) - * } - * $stream->closeWrite(); - * $element = $stream->read(); - * while (!is_null($element)) { - * // doSomethingWith($element) - * $element = $stream->read(); - * } - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\BidiStream - * - * @throws ApiException if the remote call fails - */ - public function streamDirectRawPredict(array $optionalArgs = []) - { - return $this->startCall( - 'StreamDirectRawPredict', - StreamDirectRawPredictResponse::class, - $optionalArgs, - null, - Call::BIDI_STREAMING_CALL - ); - } - - /** - * Generate content with multimodal inputs with streaming support. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $model = 'model'; - * $contents = []; - * // Read all responses until the stream is complete - * $stream = $predictionServiceClient->streamGenerateContent($model, $contents); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $model Required. The name of the publisher model requested to serve the - * prediction. Format: - * `projects/{project}/locations/{location}/publishers/*/models/*` - * @param Content[] $contents Required. The content of the current conversation with the model. - * - * For single-turn queries, this is a single instance. For multi-turn queries, - * this is a repeated field that contains conversation history + latest - * request. - * @param array $optionalArgs { - * Optional. - * - * @type Content $systemInstruction - * Optional. The user provided system instructions for the model. - * Note: only text should be used in parts and content in each part will be in - * a separate paragraph. - * @type Tool[] $tools - * Optional. A list of `Tools` the model may use to generate the next - * response. - * - * A `Tool` is a piece of code that enables the system to interact with - * external systems to perform an action, or set of actions, outside of - * knowledge and scope of the model. - * @type ToolConfig $toolConfig - * Optional. Tool config. This config is shared for all tools provided in the - * request. - * @type SafetySetting[] $safetySettings - * Optional. Per request settings for blocking unsafe content. - * Enforced on GenerateContentResponse.candidates. - * @type GenerationConfig $generationConfig - * Optional. Generation config. - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function streamGenerateContent( - $model, - $contents, - array $optionalArgs = [] - ) { - $request = new GenerateContentRequest(); - $requestParamHeaders = []; - $request->setModel($model); - $request->setContents($contents); - $requestParamHeaders['model'] = $model; - if (isset($optionalArgs['systemInstruction'])) { - $request->setSystemInstruction($optionalArgs['systemInstruction']); - } - - if (isset($optionalArgs['tools'])) { - $request->setTools($optionalArgs['tools']); - } - - if (isset($optionalArgs['toolConfig'])) { - $request->setToolConfig($optionalArgs['toolConfig']); - } - - if (isset($optionalArgs['safetySettings'])) { - $request->setSafetySettings($optionalArgs['safetySettings']); - } - - if (isset($optionalArgs['generationConfig'])) { - $request->setGenerationConfig($optionalArgs['generationConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'StreamGenerateContent', - GenerateContentResponse::class, - $optionalArgs, - $request, - Call::SERVER_STREAMING_CALL - ); - } - - /** - * Perform a streaming online prediction with an arbitrary HTTP payload. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $formattedEndpoint = $predictionServiceClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - * // Read all responses until the stream is complete - * $stream = $predictionServiceClient->streamRawPredict($formattedEndpoint); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $endpoint Required. The name of the Endpoint requested to serve the prediction. - * Format: - * `projects/{project}/locations/{location}/endpoints/{endpoint}` - * @param array $optionalArgs { - * Optional. - * - * @type HttpBody $httpBody - * The prediction input. Supports HTTP headers and arbitrary data payload. - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function streamRawPredict($endpoint, array $optionalArgs = []) - { - $request = new StreamRawPredictRequest(); - $requestParamHeaders = []; - $request->setEndpoint($endpoint); - $requestParamHeaders['endpoint'] = $endpoint; - if (isset($optionalArgs['httpBody'])) { - $request->setHttpBody($optionalArgs['httpBody']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'StreamRawPredict', - HttpBody::class, - $optionalArgs, - $request, - Call::SERVER_STREAMING_CALL - ); - } - - /** - * Perform a streaming online prediction request for Vertex first-party - * products and frameworks. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $endpoint = 'endpoint'; - * $request = new StreamingPredictRequest(); - * $request->setEndpoint($endpoint); - * // Write all requests to the server, then read all responses until the - * // stream is complete - * $requests = [ - * $request, - * ]; - * $stream = $predictionServiceClient->streamingPredict(); - * $stream->writeAll($requests); - * foreach ($stream->closeWriteAndReadAll() as $element) { - * // doSomethingWith($element); - * } - * // Alternatively: - * // Write requests individually, making read() calls if - * // required. Call closeWrite() once writes are complete, and read the - * // remaining responses from the server. - * $requests = [ - * $request, - * ]; - * $stream = $predictionServiceClient->streamingPredict(); - * foreach ($requests as $request) { - * $stream->write($request); - * // if required, read a single response from the stream - * $element = $stream->read(); - * // doSomethingWith($element) - * } - * $stream->closeWrite(); - * $element = $stream->read(); - * while (!is_null($element)) { - * // doSomethingWith($element) - * $element = $stream->read(); - * } - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\BidiStream - * - * @throws ApiException if the remote call fails - */ - public function streamingPredict(array $optionalArgs = []) - { - return $this->startCall( - 'StreamingPredict', - StreamingPredictResponse::class, - $optionalArgs, - null, - Call::BIDI_STREAMING_CALL - ); - } - - /** - * Perform a streaming online prediction request through gRPC. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $endpoint = 'endpoint'; - * $request = new StreamingRawPredictRequest(); - * $request->setEndpoint($endpoint); - * // Write all requests to the server, then read all responses until the - * // stream is complete - * $requests = [ - * $request, - * ]; - * $stream = $predictionServiceClient->streamingRawPredict(); - * $stream->writeAll($requests); - * foreach ($stream->closeWriteAndReadAll() as $element) { - * // doSomethingWith($element); - * } - * // Alternatively: - * // Write requests individually, making read() calls if - * // required. Call closeWrite() once writes are complete, and read the - * // remaining responses from the server. - * $requests = [ - * $request, - * ]; - * $stream = $predictionServiceClient->streamingRawPredict(); - * foreach ($requests as $request) { - * $stream->write($request); - * // if required, read a single response from the stream - * $element = $stream->read(); - * // doSomethingWith($element) - * } - * $stream->closeWrite(); - * $element = $stream->read(); - * while (!is_null($element)) { - * // doSomethingWith($element) - * $element = $stream->read(); - * } - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\BidiStream - * - * @throws ApiException if the remote call fails - */ - public function streamingRawPredict(array $optionalArgs = []) - { - return $this->startCall( - 'StreamingRawPredict', - StreamingRawPredictResponse::class, - $optionalArgs, - null, - Call::BIDI_STREAMING_CALL - ); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $response = $predictionServiceClient->getLocation(); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $predictionServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $predictionServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $resource = 'resource'; - * $response = $predictionServiceClient->getIamPolicy($resource); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $predictionServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $predictionServiceClient = new PredictionServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $predictionServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $predictionServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/ScheduleServiceGapicClient.php b/AiPlatform/src/V1/Gapic/ScheduleServiceGapicClient.php deleted file mode 100644 index d71a12bf6817..000000000000 --- a/AiPlatform/src/V1/Gapic/ScheduleServiceGapicClient.php +++ /dev/null @@ -1,1445 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $schedule = new Schedule(); - * $response = $scheduleServiceClient->createSchedule($formattedParent, $schedule); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\ScheduleServiceClient}. - */ -class ScheduleServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.ScheduleService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $artifactNameTemplate; - - private static $contextNameTemplate; - - private static $customJobNameTemplate; - - private static $executionNameTemplate; - - private static $locationNameTemplate; - - private static $metadataStoreNameTemplate; - - private static $networkNameTemplate; - - private static $pipelineJobNameTemplate; - - private static $scheduleNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/schedule_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/schedule_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/schedule_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/schedule_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getArtifactNameTemplate() - { - if (self::$artifactNameTemplate == null) { - self::$artifactNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact}' - ); - } - - return self::$artifactNameTemplate; - } - - private static function getContextNameTemplate() - { - if (self::$contextNameTemplate == null) { - self::$contextNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context}' - ); - } - - return self::$contextNameTemplate; - } - - private static function getCustomJobNameTemplate() - { - if (self::$customJobNameTemplate == null) { - self::$customJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/customJobs/{custom_job}' - ); - } - - return self::$customJobNameTemplate; - } - - private static function getExecutionNameTemplate() - { - if (self::$executionNameTemplate == null) { - self::$executionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}/executions/{execution}' - ); - } - - return self::$executionNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getMetadataStoreNameTemplate() - { - if (self::$metadataStoreNameTemplate == null) { - self::$metadataStoreNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/metadataStores/{metadata_store}' - ); - } - - return self::$metadataStoreNameTemplate; - } - - private static function getNetworkNameTemplate() - { - if (self::$networkNameTemplate == null) { - self::$networkNameTemplate = new PathTemplate( - 'projects/{project}/global/networks/{network}' - ); - } - - return self::$networkNameTemplate; - } - - private static function getPipelineJobNameTemplate() - { - if (self::$pipelineJobNameTemplate == null) { - self::$pipelineJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}' - ); - } - - return self::$pipelineJobNameTemplate; - } - - private static function getScheduleNameTemplate() - { - if (self::$scheduleNameTemplate == null) { - self::$scheduleNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/schedules/{schedule}' - ); - } - - return self::$scheduleNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'artifact' => self::getArtifactNameTemplate(), - 'context' => self::getContextNameTemplate(), - 'customJob' => self::getCustomJobNameTemplate(), - 'execution' => self::getExecutionNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'metadataStore' => self::getMetadataStoreNameTemplate(), - 'network' => self::getNetworkNameTemplate(), - 'pipelineJob' => self::getPipelineJobNameTemplate(), - 'schedule' => self::getScheduleNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a artifact - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $artifact - * - * @return string The formatted artifact resource. - */ - public static function artifactName( - $project, - $location, - $metadataStore, - $artifact - ) { - return self::getArtifactNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'artifact' => $artifact, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a context - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $context - * - * @return string The formatted context resource. - */ - public static function contextName( - $project, - $location, - $metadataStore, - $context - ) { - return self::getContextNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'context' => $context, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a custom_job - * resource. - * - * @param string $project - * @param string $location - * @param string $customJob - * - * @return string The formatted custom_job resource. - */ - public static function customJobName($project, $location, $customJob) - { - return self::getCustomJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'custom_job' => $customJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a execution - * resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * @param string $execution - * - * @return string The formatted execution resource. - */ - public static function executionName( - $project, - $location, - $metadataStore, - $execution - ) { - return self::getExecutionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - 'execution' => $execution, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * metadata_store resource. - * - * @param string $project - * @param string $location - * @param string $metadataStore - * - * @return string The formatted metadata_store resource. - */ - public static function metadataStoreName( - $project, - $location, - $metadataStore - ) { - return self::getMetadataStoreNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'metadata_store' => $metadataStore, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a network - * resource. - * - * @param string $project - * @param string $network - * - * @return string The formatted network resource. - */ - public static function networkName($project, $network) - { - return self::getNetworkNameTemplate()->render([ - 'project' => $project, - 'network' => $network, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a pipeline_job - * resource. - * - * @param string $project - * @param string $location - * @param string $pipelineJob - * - * @return string The formatted pipeline_job resource. - */ - public static function pipelineJobName($project, $location, $pipelineJob) - { - return self::getPipelineJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'pipeline_job' => $pipelineJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a schedule - * resource. - * - * @param string $project - * @param string $location - * @param string $schedule - * - * @return string The formatted schedule resource. - */ - public static function scheduleName($project, $location, $schedule) - { - return self::getScheduleNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'schedule' => $schedule, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - artifact: projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact} - * - context: projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context} - * - customJob: projects/{project}/locations/{location}/customJobs/{custom_job} - * - execution: projects/{project}/locations/{location}/metadataStores/{metadata_store}/executions/{execution} - * - location: projects/{project}/locations/{location} - * - metadataStore: projects/{project}/locations/{location}/metadataStores/{metadata_store} - * - network: projects/{project}/global/networks/{network} - * - pipelineJob: projects/{project}/locations/{location}/pipelineJobs/{pipeline_job} - * - schedule: projects/{project}/locations/{location}/schedules/{schedule} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates a Schedule. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $formattedParent = $scheduleServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $schedule = new Schedule(); - * $response = $scheduleServiceClient->createSchedule($formattedParent, $schedule); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the Schedule in. - * Format: `projects/{project}/locations/{location}` - * @param Schedule $schedule Required. The Schedule to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Schedule - * - * @throws ApiException if the remote call fails - */ - public function createSchedule($parent, $schedule, array $optionalArgs = []) - { - $request = new CreateScheduleRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSchedule($schedule); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateSchedule', - Schedule::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes a Schedule. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $formattedName = $scheduleServiceClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - * $operationResponse = $scheduleServiceClient->deleteSchedule($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $scheduleServiceClient->deleteSchedule($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $scheduleServiceClient->resumeOperation($operationName, 'deleteSchedule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Schedule resource to be deleted. - * Format: - * `projects/{project}/locations/{location}/schedules/{schedule}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteSchedule($name, array $optionalArgs = []) - { - $request = new DeleteScheduleRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteSchedule', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets a Schedule. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $formattedName = $scheduleServiceClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - * $response = $scheduleServiceClient->getSchedule($formattedName); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Schedule resource. - * Format: - * `projects/{project}/locations/{location}/schedules/{schedule}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Schedule - * - * @throws ApiException if the remote call fails - */ - public function getSchedule($name, array $optionalArgs = []) - { - $request = new GetScheduleRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetSchedule', - Schedule::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists Schedules in a Location. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $formattedParent = $scheduleServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $scheduleServiceClient->listSchedules($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $scheduleServiceClient->listSchedules($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the Schedules from. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the Schedules that match the filter expression. The following - * fields are supported: - * - * * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard. - * * `state`: Supports `=` and `!=` comparisons. - * * `request`: Supports existence of the check. - * (e.g. `create_pipeline_job_request:*` --> Schedule has - * create_pipeline_job_request). - * * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be in RFC 3339 format. - * * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons. - * Values must be in RFC 3339 format. - * * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*` - * existence check. Values must be in RFC 3339 format. - * * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` - * comparisons. Values must be in RFC 3339 format. - * - * - * Filter expressions can be combined together using logical operators - * (`NOT`, `AND` & `OR`). - * The syntax to define filter expression is based on - * https://google.aip.dev/160. - * - * Examples: - * - * * `state="ACTIVE" AND display_name:"my_schedule_*"` - * * `NOT display_name="my_schedule"` - * * `create_time>"2021-05-18T00:00:00Z"` - * * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*` - * * `create_pipeline_job_request:*` - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * A comma-separated list of fields to order by. The default sort order is in - * ascending order. Use "desc" after a field name for descending. You can have - * multiple order_by fields provided. - * - * For example, using "create_time desc, end_time" will order results by - * create time in descending order, and if there are multiple schedules having - * the same create time, order them by the end time in ascending order. - * - * If order_by is not specified, it will order by default with create_time in - * descending order. - * - * Supported fields: - * - * * `create_time` - * * `start_time` - * * `end_time` - * * `next_run_time` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSchedules($parent, array $optionalArgs = []) - { - $request = new ListSchedulesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListSchedules', - $optionalArgs, - ListSchedulesResponse::class, - $request - ); - } - - /** - * Pauses a Schedule. Will mark - * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If - * the schedule is paused, no new runs will be created. Already created runs - * will NOT be paused or canceled. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $formattedName = $scheduleServiceClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - * $scheduleServiceClient->pauseSchedule($formattedName); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Schedule resource to be paused. - * Format: - * `projects/{project}/locations/{location}/schedules/{schedule}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function pauseSchedule($name, array $optionalArgs = []) - { - $request = new PauseScheduleRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'PauseSchedule', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Resumes a paused Schedule to start scheduling new runs. Will mark - * [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'. - * Only paused Schedule can be resumed. - * - * When the Schedule is resumed, new runs will be scheduled starting from the - * next execution time after the current time based on the time_specification - * in the Schedule. If [Schedule.catchUp][] is set up true, all - * missed runs will be scheduled for backfill first. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $formattedName = $scheduleServiceClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - * $scheduleServiceClient->resumeSchedule($formattedName); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Schedule resource to be resumed. - * Format: - * `projects/{project}/locations/{location}/schedules/{schedule}` - * @param array $optionalArgs { - * Optional. - * - * @type bool $catchUp - * Optional. Whether to backfill missed runs when the schedule is resumed from - * PAUSED state. If set to true, all missed runs will be scheduled. New runs - * will be scheduled after the backfill is complete. This will also update - * [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] field. - * Default to false. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function resumeSchedule($name, array $optionalArgs = []) - { - $request = new ResumeScheduleRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['catchUp'])) { - $request->setCatchUp($optionalArgs['catchUp']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ResumeSchedule', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates an active or paused Schedule. - * - * When the Schedule is updated, new runs will be scheduled starting from the - * updated next execution time after the update time based on the - * time_specification in the updated Schedule. All unstarted runs before the - * update time will be skipped while already created runs will NOT be paused - * or canceled. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $schedule = new Schedule(); - * $updateMask = new FieldMask(); - * $response = $scheduleServiceClient->updateSchedule($schedule, $updateMask); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param Schedule $schedule Required. The Schedule which replaces the resource on the server. - * The following restrictions will be applied: - * - * * The scheduled request type cannot be changed. - * * The non-empty fields cannot be unset. - * * The output_only fields will be ignored if specified. - * @param FieldMask $updateMask Required. The update mask applies to the resource. See - * [google.protobuf.FieldMask][google.protobuf.FieldMask]. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Schedule - * - * @throws ApiException if the remote call fails - */ - public function updateSchedule( - $schedule, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateScheduleRequest(); - $requestParamHeaders = []; - $request->setSchedule($schedule); - $request->setUpdateMask($updateMask); - $requestParamHeaders['schedule.name'] = $schedule->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateSchedule', - Schedule::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $response = $scheduleServiceClient->getLocation(); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $scheduleServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $scheduleServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $resource = 'resource'; - * $response = $scheduleServiceClient->getIamPolicy($resource); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $scheduleServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $scheduleServiceClient = new ScheduleServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $scheduleServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $scheduleServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/SpecialistPoolServiceGapicClient.php b/AiPlatform/src/V1/Gapic/SpecialistPoolServiceGapicClient.php deleted file mode 100644 index b484a3a3880c..000000000000 --- a/AiPlatform/src/V1/Gapic/SpecialistPoolServiceGapicClient.php +++ /dev/null @@ -1,1102 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $specialistPool = new SpecialistPool(); - * $operationResponse = $specialistPoolServiceClient->createSpecialistPool($formattedParent, $specialistPool); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $specialistPoolServiceClient->createSpecialistPool($formattedParent, $specialistPool); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $specialistPoolServiceClient->resumeOperation($operationName, 'createSpecialistPool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\SpecialistPoolServiceClient}. - */ -class SpecialistPoolServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.SpecialistPoolService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $locationNameTemplate; - - private static $specialistPoolNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/specialist_pool_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/specialist_pool_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/specialist_pool_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/specialist_pool_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getSpecialistPoolNameTemplate() - { - if (self::$specialistPoolNameTemplate == null) { - self::$specialistPoolNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/specialistPools/{specialist_pool}' - ); - } - - return self::$specialistPoolNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'location' => self::getLocationNameTemplate(), - 'specialistPool' => self::getSpecialistPoolNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * specialist_pool resource. - * - * @param string $project - * @param string $location - * @param string $specialistPool - * - * @return string The formatted specialist_pool resource. - */ - public static function specialistPoolName( - $project, - $location, - $specialistPool - ) { - return self::getSpecialistPoolNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'specialist_pool' => $specialistPool, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - location: projects/{project}/locations/{location} - * - specialistPool: projects/{project}/locations/{location}/specialistPools/{specialist_pool} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates a SpecialistPool. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * $formattedParent = $specialistPoolServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $specialistPool = new SpecialistPool(); - * $operationResponse = $specialistPoolServiceClient->createSpecialistPool($formattedParent, $specialistPool); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $specialistPoolServiceClient->createSpecialistPool($formattedParent, $specialistPool); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $specialistPoolServiceClient->resumeOperation($operationName, 'createSpecialistPool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent Project name for the new SpecialistPool. - * The form is `projects/{project}/locations/{location}`. - * @param SpecialistPool $specialistPool Required. The SpecialistPool to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createSpecialistPool( - $parent, - $specialistPool, - array $optionalArgs = [] - ) { - $request = new CreateSpecialistPoolRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSpecialistPool($specialistPool); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateSpecialistPool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a SpecialistPool as well as all Specialists in the pool. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * $formattedName = $specialistPoolServiceClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - * $operationResponse = $specialistPoolServiceClient->deleteSpecialistPool($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $specialistPoolServiceClient->deleteSpecialistPool($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $specialistPoolServiceClient->resumeOperation($operationName, 'deleteSpecialistPool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the SpecialistPool to delete. Format: - * `projects/{project}/locations/{location}/specialistPools/{specialist_pool}` - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * If set to true, any specialist managers in this SpecialistPool will also be - * deleted. (Otherwise, the request will only work if the SpecialistPool has - * no specialist managers.) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteSpecialistPool($name, array $optionalArgs = []) - { - $request = new DeleteSpecialistPoolRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteSpecialistPool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets a SpecialistPool. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * $formattedName = $specialistPoolServiceClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - * $response = $specialistPoolServiceClient->getSpecialistPool($formattedName); - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the SpecialistPool resource. - * The form is - * `projects/{project}/locations/{location}/specialistPools/{specialist_pool}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\SpecialistPool - * - * @throws ApiException if the remote call fails - */ - public function getSpecialistPool($name, array $optionalArgs = []) - { - $request = new GetSpecialistPoolRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetSpecialistPool', - SpecialistPool::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists SpecialistPools in a Location. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * $formattedParent = $specialistPoolServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $specialistPoolServiceClient->listSpecialistPools($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $specialistPoolServiceClient->listSpecialistPools($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the SpecialistPool's parent resource. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type FieldMask $readMask - * Mask specifying which fields to read. FieldMask represents a set of - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSpecialistPools($parent, array $optionalArgs = []) - { - $request = new ListSpecialistPoolsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListSpecialistPools', - $optionalArgs, - ListSpecialistPoolsResponse::class, - $request - ); - } - - /** - * Updates a SpecialistPool. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * $specialistPool = new SpecialistPool(); - * $updateMask = new FieldMask(); - * $operationResponse = $specialistPoolServiceClient->updateSpecialistPool($specialistPool, $updateMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $specialistPoolServiceClient->updateSpecialistPool($specialistPool, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $specialistPoolServiceClient->resumeOperation($operationName, 'updateSpecialistPool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param SpecialistPool $specialistPool Required. The SpecialistPool which replaces the resource on the server. - * @param FieldMask $updateMask Required. The update mask applies to the resource. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateSpecialistPool( - $specialistPool, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateSpecialistPoolRequest(); - $requestParamHeaders = []; - $request->setSpecialistPool($specialistPool); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'specialist_pool.name' - ] = $specialistPool->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateSpecialistPool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * $response = $specialistPoolServiceClient->getLocation(); - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $specialistPoolServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $specialistPoolServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * $resource = 'resource'; - * $response = $specialistPoolServiceClient->getIamPolicy($resource); - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $specialistPoolServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $specialistPoolServiceClient = new SpecialistPoolServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $specialistPoolServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $specialistPoolServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/TensorboardServiceGapicClient.php b/AiPlatform/src/V1/Gapic/TensorboardServiceGapicClient.php deleted file mode 100644 index ad2229b7ff37..000000000000 --- a/AiPlatform/src/V1/Gapic/TensorboardServiceGapicClient.php +++ /dev/null @@ -1,2943 +0,0 @@ -tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - * $requests = []; - * $response = $tensorboardServiceClient->batchCreateTensorboardRuns($formattedParent, $requests); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient}. - */ -class TensorboardServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.TensorboardService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - ]; - - private static $locationNameTemplate; - - private static $tensorboardNameTemplate; - - private static $tensorboardExperimentNameTemplate; - - private static $tensorboardRunNameTemplate; - - private static $tensorboardTimeSeriesNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/tensorboard_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/tensorboard_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/tensorboard_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/tensorboard_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getTensorboardNameTemplate() - { - if (self::$tensorboardNameTemplate == null) { - self::$tensorboardNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/tensorboards/{tensorboard}' - ); - } - - return self::$tensorboardNameTemplate; - } - - private static function getTensorboardExperimentNameTemplate() - { - if (self::$tensorboardExperimentNameTemplate == null) { - self::$tensorboardExperimentNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}' - ); - } - - return self::$tensorboardExperimentNameTemplate; - } - - private static function getTensorboardRunNameTemplate() - { - if (self::$tensorboardRunNameTemplate == null) { - self::$tensorboardRunNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}' - ); - } - - return self::$tensorboardRunNameTemplate; - } - - private static function getTensorboardTimeSeriesNameTemplate() - { - if (self::$tensorboardTimeSeriesNameTemplate == null) { - self::$tensorboardTimeSeriesNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}' - ); - } - - return self::$tensorboardTimeSeriesNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'location' => self::getLocationNameTemplate(), - 'tensorboard' => self::getTensorboardNameTemplate(), - 'tensorboardExperiment' => self::getTensorboardExperimentNameTemplate(), - 'tensorboardRun' => self::getTensorboardRunNameTemplate(), - 'tensorboardTimeSeries' => self::getTensorboardTimeSeriesNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a tensorboard - * resource. - * - * @param string $project - * @param string $location - * @param string $tensorboard - * - * @return string The formatted tensorboard resource. - */ - public static function tensorboardName($project, $location, $tensorboard) - { - return self::getTensorboardNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'tensorboard' => $tensorboard, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * tensorboard_experiment resource. - * - * @param string $project - * @param string $location - * @param string $tensorboard - * @param string $experiment - * - * @return string The formatted tensorboard_experiment resource. - */ - public static function tensorboardExperimentName( - $project, - $location, - $tensorboard, - $experiment - ) { - return self::getTensorboardExperimentNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'tensorboard' => $tensorboard, - 'experiment' => $experiment, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * tensorboard_run resource. - * - * @param string $project - * @param string $location - * @param string $tensorboard - * @param string $experiment - * @param string $run - * - * @return string The formatted tensorboard_run resource. - */ - public static function tensorboardRunName( - $project, - $location, - $tensorboard, - $experiment, - $run - ) { - return self::getTensorboardRunNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'tensorboard' => $tensorboard, - 'experiment' => $experiment, - 'run' => $run, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * tensorboard_time_series resource. - * - * @param string $project - * @param string $location - * @param string $tensorboard - * @param string $experiment - * @param string $run - * @param string $timeSeries - * - * @return string The formatted tensorboard_time_series resource. - */ - public static function tensorboardTimeSeriesName( - $project, - $location, - $tensorboard, - $experiment, - $run, - $timeSeries - ) { - return self::getTensorboardTimeSeriesNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'tensorboard' => $tensorboard, - 'experiment' => $experiment, - 'run' => $run, - 'time_series' => $timeSeries, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - location: projects/{project}/locations/{location} - * - tensorboard: projects/{project}/locations/{location}/tensorboards/{tensorboard} - * - tensorboardExperiment: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment} - * - tensorboardRun: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run} - * - tensorboardTimeSeries: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Batch create TensorboardRuns. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - * $requests = []; - * $response = $tensorboardServiceClient->batchCreateTensorboardRuns($formattedParent, $requests); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the TensorboardExperiment to create the - * TensorboardRuns in. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}` - * The parent field in the CreateTensorboardRunRequest messages must match - * this field. - * @param CreateTensorboardRunRequest[] $requests Required. The request message specifying the TensorboardRuns to create. - * A maximum of 1000 TensorboardRuns can be created in a batch. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\BatchCreateTensorboardRunsResponse - * - * @throws ApiException if the remote call fails - */ - public function batchCreateTensorboardRuns( - $parent, - $requests, - array $optionalArgs = [] - ) { - $request = new BatchCreateTensorboardRunsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setRequests($requests); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'BatchCreateTensorboardRuns', - BatchCreateTensorboardRunsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Batch create TensorboardTimeSeries that belong to a TensorboardExperiment. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - * $requests = []; - * $response = $tensorboardServiceClient->batchCreateTensorboardTimeSeries($formattedParent, $requests); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the TensorboardExperiment to create the - * TensorboardTimeSeries in. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}` - * The TensorboardRuns referenced by the parent fields in the - * CreateTensorboardTimeSeriesRequest messages must be sub resources of this - * TensorboardExperiment. - * @param CreateTensorboardTimeSeriesRequest[] $requests Required. The request message specifying the TensorboardTimeSeries to - * create. A maximum of 1000 TensorboardTimeSeries can be created in a batch. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\BatchCreateTensorboardTimeSeriesResponse - * - * @throws ApiException if the remote call fails - */ - public function batchCreateTensorboardTimeSeries( - $parent, - $requests, - array $optionalArgs = [] - ) { - $request = new BatchCreateTensorboardTimeSeriesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setRequests($requests); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'BatchCreateTensorboardTimeSeries', - BatchCreateTensorboardTimeSeriesResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Reads multiple TensorboardTimeSeries' data. The data point number limit is - * 1000 for scalars, 100 for tensors and blob references. If the number of - * data points stored is less than the limit, all data is returned. - * Otherwise, the number limit of data points is randomly selected from - * this time series and returned. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedTensorboard = $tensorboardServiceClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - * $formattedTimeSeries = [ - * $tensorboardServiceClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'), - * ]; - * $response = $tensorboardServiceClient->batchReadTensorboardTimeSeriesData($formattedTensorboard, $formattedTimeSeries); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $tensorboard Required. The resource name of the Tensorboard containing - * TensorboardTimeSeries to read data from. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}`. - * The TensorboardTimeSeries referenced by - * [time_series][google.cloud.aiplatform.v1.BatchReadTensorboardTimeSeriesDataRequest.time_series] - * must be sub resources of this Tensorboard. - * @param string[] $timeSeries Required. The resource names of the TensorboardTimeSeries to read data - * from. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataResponse - * - * @throws ApiException if the remote call fails - */ - public function batchReadTensorboardTimeSeriesData( - $tensorboard, - $timeSeries, - array $optionalArgs = [] - ) { - $request = new BatchReadTensorboardTimeSeriesDataRequest(); - $requestParamHeaders = []; - $request->setTensorboard($tensorboard); - $request->setTimeSeries($timeSeries); - $requestParamHeaders['tensorboard'] = $tensorboard; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'BatchReadTensorboardTimeSeriesData', - BatchReadTensorboardTimeSeriesDataResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a Tensorboard. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - * $tensorboard = new Tensorboard(); - * $operationResponse = $tensorboardServiceClient->createTensorboard($formattedParent, $tensorboard); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tensorboardServiceClient->createTensorboard($formattedParent, $tensorboard); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tensorboardServiceClient->resumeOperation($operationName, 'createTensorboard'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the Tensorboard in. - * Format: `projects/{project}/locations/{location}` - * @param Tensorboard $tensorboard Required. The Tensorboard to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createTensorboard( - $parent, - $tensorboard, - array $optionalArgs = [] - ) { - $request = new CreateTensorboardRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setTensorboard($tensorboard); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateTensorboard', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a TensorboardExperiment. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - * $tensorboardExperimentId = 'tensorboard_experiment_id'; - * $response = $tensorboardServiceClient->createTensorboardExperiment($formattedParent, $tensorboardExperimentId); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Tensorboard to create the - * TensorboardExperiment in. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}` - * @param string $tensorboardExperimentId Required. The ID to use for the Tensorboard experiment, which becomes the - * final component of the Tensorboard experiment's resource name. - * - * This value should be 1-128 characters, and valid characters - * are `/[a-z][0-9]-/`. - * @param array $optionalArgs { - * Optional. - * - * @type TensorboardExperiment $tensorboardExperiment - * The TensorboardExperiment to create. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TensorboardExperiment - * - * @throws ApiException if the remote call fails - */ - public function createTensorboardExperiment( - $parent, - $tensorboardExperimentId, - array $optionalArgs = [] - ) { - $request = new CreateTensorboardExperimentRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setTensorboardExperimentId($tensorboardExperimentId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['tensorboardExperiment'])) { - $request->setTensorboardExperiment( - $optionalArgs['tensorboardExperiment'] - ); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateTensorboardExperiment', - TensorboardExperiment::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a TensorboardRun. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - * $tensorboardRun = new TensorboardRun(); - * $tensorboardRunId = 'tensorboard_run_id'; - * $response = $tensorboardServiceClient->createTensorboardRun($formattedParent, $tensorboardRun, $tensorboardRunId); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the TensorboardExperiment to create the - * TensorboardRun in. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}` - * @param TensorboardRun $tensorboardRun Required. The TensorboardRun to create. - * @param string $tensorboardRunId Required. The ID to use for the Tensorboard run, which becomes the final - * component of the Tensorboard run's resource name. - * - * This value should be 1-128 characters, and valid characters - * are `/[a-z][0-9]-/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TensorboardRun - * - * @throws ApiException if the remote call fails - */ - public function createTensorboardRun( - $parent, - $tensorboardRun, - $tensorboardRunId, - array $optionalArgs = [] - ) { - $request = new CreateTensorboardRunRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setTensorboardRun($tensorboardRun); - $request->setTensorboardRunId($tensorboardRunId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateTensorboardRun', - TensorboardRun::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a TensorboardTimeSeries. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - * $tensorboardTimeSeries = new TensorboardTimeSeries(); - * $response = $tensorboardServiceClient->createTensorboardTimeSeries($formattedParent, $tensorboardTimeSeries); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the TensorboardRun to create the - * TensorboardTimeSeries in. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}` - * @param TensorboardTimeSeries $tensorboardTimeSeries Required. The TensorboardTimeSeries to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $tensorboardTimeSeriesId - * Optional. The user specified unique ID to use for the - * TensorboardTimeSeries, which becomes the final component of the - * TensorboardTimeSeries's resource name. This value should match - * "[a-z0-9][a-z0-9-]{0, 127}" - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TensorboardTimeSeries - * - * @throws ApiException if the remote call fails - */ - public function createTensorboardTimeSeries( - $parent, - $tensorboardTimeSeries, - array $optionalArgs = [] - ) { - $request = new CreateTensorboardTimeSeriesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setTensorboardTimeSeries($tensorboardTimeSeries); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['tensorboardTimeSeriesId'])) { - $request->setTensorboardTimeSeriesId( - $optionalArgs['tensorboardTimeSeriesId'] - ); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateTensorboardTimeSeries', - TensorboardTimeSeries::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes a Tensorboard. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedName = $tensorboardServiceClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - * $operationResponse = $tensorboardServiceClient->deleteTensorboard($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tensorboardServiceClient->deleteTensorboard($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tensorboardServiceClient->resumeOperation($operationName, 'deleteTensorboard'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Tensorboard to be deleted. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteTensorboard($name, array $optionalArgs = []) - { - $request = new DeleteTensorboardRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteTensorboard', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a TensorboardExperiment. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedName = $tensorboardServiceClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - * $operationResponse = $tensorboardServiceClient->deleteTensorboardExperiment($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tensorboardServiceClient->deleteTensorboardExperiment($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tensorboardServiceClient->resumeOperation($operationName, 'deleteTensorboardExperiment'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TensorboardExperiment to be deleted. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteTensorboardExperiment($name, array $optionalArgs = []) - { - $request = new DeleteTensorboardExperimentRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteTensorboardExperiment', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a TensorboardRun. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedName = $tensorboardServiceClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - * $operationResponse = $tensorboardServiceClient->deleteTensorboardRun($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tensorboardServiceClient->deleteTensorboardRun($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tensorboardServiceClient->resumeOperation($operationName, 'deleteTensorboardRun'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TensorboardRun to be deleted. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteTensorboardRun($name, array $optionalArgs = []) - { - $request = new DeleteTensorboardRunRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteTensorboardRun', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a TensorboardTimeSeries. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedName = $tensorboardServiceClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - * $operationResponse = $tensorboardServiceClient->deleteTensorboardTimeSeries($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tensorboardServiceClient->deleteTensorboardTimeSeries($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tensorboardServiceClient->resumeOperation($operationName, 'deleteTensorboardTimeSeries'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TensorboardTimeSeries to be deleted. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteTensorboardTimeSeries($name, array $optionalArgs = []) - { - $request = new DeleteTensorboardTimeSeriesRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteTensorboardTimeSeries', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Exports a TensorboardTimeSeries' data. Data is returned in paginated - * responses. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedTensorboardTimeSeries = $tensorboardServiceClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - * // Iterate over pages of elements - * $pagedResponse = $tensorboardServiceClient->exportTensorboardTimeSeriesData($formattedTensorboardTimeSeries); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tensorboardServiceClient->exportTensorboardTimeSeriesData($formattedTensorboardTimeSeries); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $tensorboardTimeSeries Required. The resource name of the TensorboardTimeSeries to export data - * from. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Exports the TensorboardTimeSeries' data that match the filter expression. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * Field to use to sort the TensorboardTimeSeries' data. - * By default, TensorboardTimeSeries' data is returned in a pseudo random - * order. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function exportTensorboardTimeSeriesData( - $tensorboardTimeSeries, - array $optionalArgs = [] - ) { - $request = new ExportTensorboardTimeSeriesDataRequest(); - $requestParamHeaders = []; - $request->setTensorboardTimeSeries($tensorboardTimeSeries); - $requestParamHeaders[ - 'tensorboard_time_series' - ] = $tensorboardTimeSeries; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ExportTensorboardTimeSeriesData', - $optionalArgs, - ExportTensorboardTimeSeriesDataResponse::class, - $request - ); - } - - /** - * Gets a Tensorboard. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedName = $tensorboardServiceClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - * $response = $tensorboardServiceClient->getTensorboard($formattedName); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Tensorboard resource. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Tensorboard - * - * @throws ApiException if the remote call fails - */ - public function getTensorboard($name, array $optionalArgs = []) - { - $request = new GetTensorboardRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetTensorboard', - Tensorboard::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a TensorboardExperiment. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedName = $tensorboardServiceClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - * $response = $tensorboardServiceClient->getTensorboardExperiment($formattedName); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TensorboardExperiment resource. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TensorboardExperiment - * - * @throws ApiException if the remote call fails - */ - public function getTensorboardExperiment($name, array $optionalArgs = []) - { - $request = new GetTensorboardExperimentRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetTensorboardExperiment', - TensorboardExperiment::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a TensorboardRun. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedName = $tensorboardServiceClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - * $response = $tensorboardServiceClient->getTensorboardRun($formattedName); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TensorboardRun resource. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TensorboardRun - * - * @throws ApiException if the remote call fails - */ - public function getTensorboardRun($name, array $optionalArgs = []) - { - $request = new GetTensorboardRunRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetTensorboardRun', - TensorboardRun::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a TensorboardTimeSeries. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedName = $tensorboardServiceClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - * $response = $tensorboardServiceClient->getTensorboardTimeSeries($formattedName); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the TensorboardTimeSeries resource. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TensorboardTimeSeries - * - * @throws ApiException if the remote call fails - */ - public function getTensorboardTimeSeries($name, array $optionalArgs = []) - { - $request = new GetTensorboardTimeSeriesRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetTensorboardTimeSeries', - TensorboardTimeSeries::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists TensorboardExperiments in a Location. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - * // Iterate over pages of elements - * $pagedResponse = $tensorboardServiceClient->listTensorboardExperiments($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tensorboardServiceClient->listTensorboardExperiments($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Tensorboard to list - * TensorboardExperiments. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the TensorboardExperiments that match the filter expression. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * Field to use to sort the list. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTensorboardExperiments( - $parent, - array $optionalArgs = [] - ) { - $request = new ListTensorboardExperimentsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListTensorboardExperiments', - $optionalArgs, - ListTensorboardExperimentsResponse::class, - $request - ); - } - - /** - * Lists TensorboardRuns in a Location. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - * // Iterate over pages of elements - * $pagedResponse = $tensorboardServiceClient->listTensorboardRuns($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tensorboardServiceClient->listTensorboardRuns($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the TensorboardExperiment to list - * TensorboardRuns. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the TensorboardRuns that match the filter expression. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * Field to use to sort the list. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTensorboardRuns($parent, array $optionalArgs = []) - { - $request = new ListTensorboardRunsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListTensorboardRuns', - $optionalArgs, - ListTensorboardRunsResponse::class, - $request - ); - } - - /** - * Lists TensorboardTimeSeries in a Location. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - * // Iterate over pages of elements - * $pagedResponse = $tensorboardServiceClient->listTensorboardTimeSeries($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tensorboardServiceClient->listTensorboardTimeSeries($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the TensorboardRun to list - * TensorboardTimeSeries. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the TensorboardTimeSeries that match the filter expression. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * Field to use to sort the list. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTensorboardTimeSeries($parent, array $optionalArgs = []) - { - $request = new ListTensorboardTimeSeriesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListTensorboardTimeSeries', - $optionalArgs, - ListTensorboardTimeSeriesResponse::class, - $request - ); - } - - /** - * Lists Tensorboards in a Location. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedParent = $tensorboardServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $tensorboardServiceClient->listTensorboards($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tensorboardServiceClient->listTensorboards($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list Tensorboards. - * Format: - * `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Lists the Tensorboards that match the filter expression. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $orderBy - * Field to use to sort the list. - * @type FieldMask $readMask - * Mask specifying which fields to read. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTensorboards($parent, array $optionalArgs = []) - { - $request = new ListTensorboardsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['readMask'])) { - $request->setReadMask($optionalArgs['readMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListTensorboards', - $optionalArgs, - ListTensorboardsResponse::class, - $request - ); - } - - /** - * Gets bytes of TensorboardBlobs. - * This is to allow reading blob data stored in consumer project's Cloud - * Storage bucket without users having to obtain Cloud Storage access - * permission. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedTimeSeries = $tensorboardServiceClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - * // Read all responses until the stream is complete - * $stream = $tensorboardServiceClient->readTensorboardBlobData($formattedTimeSeries); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $timeSeries Required. The resource name of the TensorboardTimeSeries to list Blobs. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}` - * @param array $optionalArgs { - * Optional. - * - * @type string[] $blobIds - * IDs of the blobs to read. - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function readTensorboardBlobData( - $timeSeries, - array $optionalArgs = [] - ) { - $request = new ReadTensorboardBlobDataRequest(); - $requestParamHeaders = []; - $request->setTimeSeries($timeSeries); - $requestParamHeaders['time_series'] = $timeSeries; - if (isset($optionalArgs['blobIds'])) { - $request->setBlobIds($optionalArgs['blobIds']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ReadTensorboardBlobData', - ReadTensorboardBlobDataResponse::class, - $optionalArgs, - $request, - Call::SERVER_STREAMING_CALL - ); - } - - /** - * Returns the storage size for a given TensorBoard instance. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedTensorboard = $tensorboardServiceClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - * $response = $tensorboardServiceClient->readTensorboardSize($formattedTensorboard); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $tensorboard Required. The name of the Tensorboard resource. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ReadTensorboardSizeResponse - * - * @throws ApiException if the remote call fails - */ - public function readTensorboardSize($tensorboard, array $optionalArgs = []) - { - $request = new ReadTensorboardSizeRequest(); - $requestParamHeaders = []; - $request->setTensorboard($tensorboard); - $requestParamHeaders['tensorboard'] = $tensorboard; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ReadTensorboardSize', - ReadTensorboardSizeResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Reads a TensorboardTimeSeries' data. By default, if the number of data - * points stored is less than 1000, all data is returned. Otherwise, 1000 - * data points is randomly selected from this time series and returned. - * This value can be changed by changing max_data_points, which can't be - * greater than 10k. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedTensorboardTimeSeries = $tensorboardServiceClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - * $response = $tensorboardServiceClient->readTensorboardTimeSeriesData($formattedTensorboardTimeSeries); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $tensorboardTimeSeries Required. The resource name of the TensorboardTimeSeries to read data from. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}` - * @param array $optionalArgs { - * Optional. - * - * @type int $maxDataPoints - * The maximum number of TensorboardTimeSeries' data to return. - * - * This value should be a positive integer. - * This value can be set to -1 to return all data. - * @type string $filter - * Reads the TensorboardTimeSeries' data that match the filter expression. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ReadTensorboardTimeSeriesDataResponse - * - * @throws ApiException if the remote call fails - */ - public function readTensorboardTimeSeriesData( - $tensorboardTimeSeries, - array $optionalArgs = [] - ) { - $request = new ReadTensorboardTimeSeriesDataRequest(); - $requestParamHeaders = []; - $request->setTensorboardTimeSeries($tensorboardTimeSeries); - $requestParamHeaders[ - 'tensorboard_time_series' - ] = $tensorboardTimeSeries; - if (isset($optionalArgs['maxDataPoints'])) { - $request->setMaxDataPoints($optionalArgs['maxDataPoints']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ReadTensorboardTimeSeriesData', - ReadTensorboardTimeSeriesDataResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns a list of monthly active users for a given TensorBoard instance. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedTensorboard = $tensorboardServiceClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - * $response = $tensorboardServiceClient->readTensorboardUsage($formattedTensorboard); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $tensorboard Required. The name of the Tensorboard resource. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ReadTensorboardUsageResponse - * - * @throws ApiException if the remote call fails - */ - public function readTensorboardUsage($tensorboard, array $optionalArgs = []) - { - $request = new ReadTensorboardUsageRequest(); - $requestParamHeaders = []; - $request->setTensorboard($tensorboard); - $requestParamHeaders['tensorboard'] = $tensorboard; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ReadTensorboardUsage', - ReadTensorboardUsageResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates a Tensorboard. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $updateMask = new FieldMask(); - * $tensorboard = new Tensorboard(); - * $operationResponse = $tensorboardServiceClient->updateTensorboard($updateMask, $tensorboard); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tensorboardServiceClient->updateTensorboard($updateMask, $tensorboard); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tensorboardServiceClient->resumeOperation($operationName, 'updateTensorboard'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * Tensorboard resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field is overwritten if it's in the mask. If the - * user does not provide a mask then all fields are overwritten if new - * values are specified. - * @param Tensorboard $tensorboard Required. The Tensorboard's `name` field is used to identify the - * Tensorboard to be updated. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateTensorboard( - $updateMask, - $tensorboard, - array $optionalArgs = [] - ) { - $request = new UpdateTensorboardRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setTensorboard($tensorboard); - $requestParamHeaders['tensorboard.name'] = $tensorboard->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateTensorboard', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates a TensorboardExperiment. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $updateMask = new FieldMask(); - * $tensorboardExperiment = new TensorboardExperiment(); - * $response = $tensorboardServiceClient->updateTensorboardExperiment($updateMask, $tensorboardExperiment); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * TensorboardExperiment resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field is overwritten if it's in the mask. If the - * user does not provide a mask then all fields are overwritten if new - * values are specified. - * @param TensorboardExperiment $tensorboardExperiment Required. The TensorboardExperiment's `name` field is used to identify the - * TensorboardExperiment to be updated. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TensorboardExperiment - * - * @throws ApiException if the remote call fails - */ - public function updateTensorboardExperiment( - $updateMask, - $tensorboardExperiment, - array $optionalArgs = [] - ) { - $request = new UpdateTensorboardExperimentRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setTensorboardExperiment($tensorboardExperiment); - $requestParamHeaders[ - 'tensorboard_experiment.name' - ] = $tensorboardExperiment->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateTensorboardExperiment', - TensorboardExperiment::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates a TensorboardRun. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $updateMask = new FieldMask(); - * $tensorboardRun = new TensorboardRun(); - * $response = $tensorboardServiceClient->updateTensorboardRun($updateMask, $tensorboardRun); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * TensorboardRun resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field is overwritten if it's in the mask. If the - * user does not provide a mask then all fields are overwritten if new - * values are specified. - * @param TensorboardRun $tensorboardRun Required. The TensorboardRun's `name` field is used to identify the - * TensorboardRun to be updated. Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TensorboardRun - * - * @throws ApiException if the remote call fails - */ - public function updateTensorboardRun( - $updateMask, - $tensorboardRun, - array $optionalArgs = [] - ) { - $request = new UpdateTensorboardRunRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setTensorboardRun($tensorboardRun); - $requestParamHeaders[ - 'tensorboard_run.name' - ] = $tensorboardRun->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateTensorboardRun', - TensorboardRun::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates a TensorboardTimeSeries. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $updateMask = new FieldMask(); - * $tensorboardTimeSeries = new TensorboardTimeSeries(); - * $response = $tensorboardServiceClient->updateTensorboardTimeSeries($updateMask, $tensorboardTimeSeries); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * TensorboardTimeSeries resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field is overwritten if it's in the mask. If the - * user does not provide a mask then all fields are overwritten if new - * values are specified. - * @param TensorboardTimeSeries $tensorboardTimeSeries Required. The TensorboardTimeSeries' `name` field is used to identify the - * TensorboardTimeSeries to be updated. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\TensorboardTimeSeries - * - * @throws ApiException if the remote call fails - */ - public function updateTensorboardTimeSeries( - $updateMask, - $tensorboardTimeSeries, - array $optionalArgs = [] - ) { - $request = new UpdateTensorboardTimeSeriesRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setTensorboardTimeSeries($tensorboardTimeSeries); - $requestParamHeaders[ - 'tensorboard_time_series.name' - ] = $tensorboardTimeSeries->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateTensorboardTimeSeries', - TensorboardTimeSeries::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Write time series data points of multiple TensorboardTimeSeries in multiple - * TensorboardRun's. If any data fail to be ingested, an error is returned. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedTensorboardExperiment = $tensorboardServiceClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - * $writeRunDataRequests = []; - * $response = $tensorboardServiceClient->writeTensorboardExperimentData($formattedTensorboardExperiment, $writeRunDataRequests); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $tensorboardExperiment Required. The resource name of the TensorboardExperiment to write data to. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}` - * @param WriteTensorboardRunDataRequest[] $writeRunDataRequests Required. Requests containing per-run TensorboardTimeSeries data to write. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\WriteTensorboardExperimentDataResponse - * - * @throws ApiException if the remote call fails - */ - public function writeTensorboardExperimentData( - $tensorboardExperiment, - $writeRunDataRequests, - array $optionalArgs = [] - ) { - $request = new WriteTensorboardExperimentDataRequest(); - $requestParamHeaders = []; - $request->setTensorboardExperiment($tensorboardExperiment); - $request->setWriteRunDataRequests($writeRunDataRequests); - $requestParamHeaders['tensorboard_experiment'] = $tensorboardExperiment; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'WriteTensorboardExperimentData', - WriteTensorboardExperimentDataResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Write time series data points into multiple TensorboardTimeSeries under - * a TensorboardRun. If any data fail to be ingested, an error is returned. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $formattedTensorboardRun = $tensorboardServiceClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - * $timeSeriesData = []; - * $response = $tensorboardServiceClient->writeTensorboardRunData($formattedTensorboardRun, $timeSeriesData); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $tensorboardRun Required. The resource name of the TensorboardRun to write data to. - * Format: - * `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}` - * @param TimeSeriesData[] $timeSeriesData Required. The TensorboardTimeSeries data to write. - * Values with in a time series are indexed by their step value. - * Repeated writes to the same step will overwrite the existing value for that - * step. - * The upper limit of data points per write request is 5000. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataResponse - * - * @throws ApiException if the remote call fails - */ - public function writeTensorboardRunData( - $tensorboardRun, - $timeSeriesData, - array $optionalArgs = [] - ) { - $request = new WriteTensorboardRunDataRequest(); - $requestParamHeaders = []; - $request->setTensorboardRun($tensorboardRun); - $request->setTimeSeriesData($timeSeriesData); - $requestParamHeaders['tensorboard_run'] = $tensorboardRun; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'WriteTensorboardRunData', - WriteTensorboardRunDataResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $response = $tensorboardServiceClient->getLocation(); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $tensorboardServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tensorboardServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $resource = 'resource'; - * $response = $tensorboardServiceClient->getIamPolicy($resource); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $tensorboardServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $tensorboardServiceClient = new TensorboardServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $tensorboardServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $tensorboardServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/Gapic/VizierServiceGapicClient.php b/AiPlatform/src/V1/Gapic/VizierServiceGapicClient.php deleted file mode 100644 index 18ed903e34d1..000000000000 --- a/AiPlatform/src/V1/Gapic/VizierServiceGapicClient.php +++ /dev/null @@ -1,1735 +0,0 @@ -trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - * $measurement = new Measurement(); - * $response = $vizierServiceClient->addTrialMeasurement($formattedTrialName, $measurement); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\AIPlatform\V1\Client\VizierServiceClient}. - */ -class VizierServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.aiplatform.v1.VizierService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'aiplatform.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'aiplatform.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $customJobNameTemplate; - - private static $locationNameTemplate; - - private static $studyNameTemplate; - - private static $trialNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/vizier_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/vizier_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/vizier_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/vizier_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getCustomJobNameTemplate() - { - if (self::$customJobNameTemplate == null) { - self::$customJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/customJobs/{custom_job}' - ); - } - - return self::$customJobNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getStudyNameTemplate() - { - if (self::$studyNameTemplate == null) { - self::$studyNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/studies/{study}' - ); - } - - return self::$studyNameTemplate; - } - - private static function getTrialNameTemplate() - { - if (self::$trialNameTemplate == null) { - self::$trialNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/studies/{study}/trials/{trial}' - ); - } - - return self::$trialNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'customJob' => self::getCustomJobNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'study' => self::getStudyNameTemplate(), - 'trial' => self::getTrialNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a custom_job - * resource. - * - * @param string $project - * @param string $location - * @param string $customJob - * - * @return string The formatted custom_job resource. - */ - public static function customJobName($project, $location, $customJob) - { - return self::getCustomJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'custom_job' => $customJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a study - * resource. - * - * @param string $project - * @param string $location - * @param string $study - * - * @return string The formatted study resource. - */ - public static function studyName($project, $location, $study) - { - return self::getStudyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'study' => $study, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a trial - * resource. - * - * @param string $project - * @param string $location - * @param string $study - * @param string $trial - * - * @return string The formatted trial resource. - */ - public static function trialName($project, $location, $study, $trial) - { - return self::getTrialNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'study' => $study, - 'trial' => $trial, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - customJob: projects/{project}/locations/{location}/customJobs/{custom_job} - * - location: projects/{project}/locations/{location} - * - study: projects/{project}/locations/{location}/studies/{study} - * - trial: projects/{project}/locations/{location}/studies/{study}/trials/{trial} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'aiplatform.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds a measurement of the objective metrics to a Trial. This measurement - * is assumed to have been taken before the Trial is complete. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedTrialName = $vizierServiceClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - * $measurement = new Measurement(); - * $response = $vizierServiceClient->addTrialMeasurement($formattedTrialName, $measurement); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $trialName Required. The name of the trial to add measurement. - * Format: - * `projects/{project}/locations/{location}/studies/{study}/trials/{trial}` - * @param Measurement $measurement Required. The measurement to be added to a Trial. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Trial - * - * @throws ApiException if the remote call fails - */ - public function addTrialMeasurement( - $trialName, - $measurement, - array $optionalArgs = [] - ) { - $request = new AddTrialMeasurementRequest(); - $requestParamHeaders = []; - $request->setTrialName($trialName); - $request->setMeasurement($measurement); - $requestParamHeaders['trial_name'] = $trialName; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'AddTrialMeasurement', - Trial::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Checks whether a Trial should stop or not. Returns a - * long-running operation. When the operation is successful, - * it will contain a - * [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse]. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedTrialName = $vizierServiceClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - * $operationResponse = $vizierServiceClient->checkTrialEarlyStoppingState($formattedTrialName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vizierServiceClient->checkTrialEarlyStoppingState($formattedTrialName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vizierServiceClient->resumeOperation($operationName, 'checkTrialEarlyStoppingState'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $trialName Required. The Trial's name. - * Format: - * `projects/{project}/locations/{location}/studies/{study}/trials/{trial}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function checkTrialEarlyStoppingState( - $trialName, - array $optionalArgs = [] - ) { - $request = new CheckTrialEarlyStoppingStateRequest(); - $requestParamHeaders = []; - $request->setTrialName($trialName); - $requestParamHeaders['trial_name'] = $trialName; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CheckTrialEarlyStoppingState', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Marks a Trial as complete. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedName = $vizierServiceClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - * $response = $vizierServiceClient->completeTrial($formattedName); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The Trial's name. - * Format: - * `projects/{project}/locations/{location}/studies/{study}/trials/{trial}` - * @param array $optionalArgs { - * Optional. - * - * @type Measurement $finalMeasurement - * Optional. If provided, it will be used as the completed Trial's - * final_measurement; Otherwise, the service will auto-select a - * previously reported measurement as the final-measurement - * @type bool $trialInfeasible - * Optional. True if the Trial cannot be run with the given Parameter, and - * final_measurement will be ignored. - * @type string $infeasibleReason - * Optional. A human readable reason why the trial was infeasible. This should - * only be provided if `trial_infeasible` is true. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Trial - * - * @throws ApiException if the remote call fails - */ - public function completeTrial($name, array $optionalArgs = []) - { - $request = new CompleteTrialRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['finalMeasurement'])) { - $request->setFinalMeasurement($optionalArgs['finalMeasurement']); - } - - if (isset($optionalArgs['trialInfeasible'])) { - $request->setTrialInfeasible($optionalArgs['trialInfeasible']); - } - - if (isset($optionalArgs['infeasibleReason'])) { - $request->setInfeasibleReason($optionalArgs['infeasibleReason']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CompleteTrial', - Trial::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a Study. A resource name will be generated after creation of the - * Study. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedParent = $vizierServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $study = new Study(); - * $response = $vizierServiceClient->createStudy($formattedParent, $study); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to create the CustomJob in. - * Format: `projects/{project}/locations/{location}` - * @param Study $study Required. The Study configuration used to create the Study. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Study - * - * @throws ApiException if the remote call fails - */ - public function createStudy($parent, $study, array $optionalArgs = []) - { - $request = new CreateStudyRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setStudy($study); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateStudy', - Study::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Adds a user provided Trial to a Study. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedParent = $vizierServiceClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - * $trial = new Trial(); - * $response = $vizierServiceClient->createTrial($formattedParent, $trial); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Study to create the Trial in. - * Format: `projects/{project}/locations/{location}/studies/{study}` - * @param Trial $trial Required. The Trial to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Trial - * - * @throws ApiException if the remote call fails - */ - public function createTrial($parent, $trial, array $optionalArgs = []) - { - $request = new CreateTrialRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setTrial($trial); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateTrial', - Trial::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes a Study. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedName = $vizierServiceClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - * $vizierServiceClient->deleteStudy($formattedName); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Study resource to be deleted. - * Format: `projects/{project}/locations/{location}/studies/{study}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteStudy($name, array $optionalArgs = []) - { - $request = new DeleteStudyRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'DeleteStudy', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes a Trial. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedName = $vizierServiceClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - * $vizierServiceClient->deleteTrial($formattedName); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The Trial's name. - * Format: - * `projects/{project}/locations/{location}/studies/{study}/trials/{trial}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteTrial($name, array $optionalArgs = []) - { - $request = new DeleteTrialRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'DeleteTrial', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a Study by name. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedName = $vizierServiceClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - * $response = $vizierServiceClient->getStudy($formattedName); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Study resource. - * Format: `projects/{project}/locations/{location}/studies/{study}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Study - * - * @throws ApiException if the remote call fails - */ - public function getStudy($name, array $optionalArgs = []) - { - $request = new GetStudyRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetStudy', - Study::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a Trial. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedName = $vizierServiceClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - * $response = $vizierServiceClient->getTrial($formattedName); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Trial resource. - * Format: - * `projects/{project}/locations/{location}/studies/{study}/trials/{trial}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Trial - * - * @throws ApiException if the remote call fails - */ - public function getTrial($name, array $optionalArgs = []) - { - $request = new GetTrialRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetTrial', - Trial::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists the pareto-optimal Trials for multi-objective Study or the - * optimal Trials for single-objective Study. The definition of - * pareto-optimal can be checked in wiki page. - * https://en.wikipedia.org/wiki/Pareto_efficiency - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedParent = $vizierServiceClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - * $response = $vizierServiceClient->listOptimalTrials($formattedParent); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the Study that the optimal Trial belongs to. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\ListOptimalTrialsResponse - * - * @throws ApiException if the remote call fails - */ - public function listOptimalTrials($parent, array $optionalArgs = []) - { - $request = new ListOptimalTrialsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ListOptimalTrials', - ListOptimalTrialsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists all the studies in a region for an associated project. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedParent = $vizierServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $vizierServiceClient->listStudies($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vizierServiceClient->listStudies($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to list the Study from. - * Format: `projects/{project}/locations/{location}` - * @param array $optionalArgs { - * Optional. - * - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listStudies($parent, array $optionalArgs = []) - { - $request = new ListStudiesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListStudies', - $optionalArgs, - ListStudiesResponse::class, - $request - ); - } - - /** - * Lists the Trials associated with a Study. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedParent = $vizierServiceClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - * // Iterate over pages of elements - * $pagedResponse = $vizierServiceClient->listTrials($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vizierServiceClient->listTrials($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Study to list the Trial from. - * Format: `projects/{project}/locations/{location}/studies/{study}` - * @param array $optionalArgs { - * Optional. - * - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTrials($parent, array $optionalArgs = []) - { - $request = new ListTrialsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListTrials', - $optionalArgs, - ListTrialsResponse::class, - $request - ); - } - - /** - * Looks a study up using the user-defined display_name field instead of the - * fully qualified resource name. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedParent = $vizierServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $displayName = 'display_name'; - * $response = $vizierServiceClient->lookupStudy($formattedParent, $displayName); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the Location to get the Study from. - * Format: `projects/{project}/locations/{location}` - * @param string $displayName Required. The user-defined display name of the Study - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Study - * - * @throws ApiException if the remote call fails - */ - public function lookupStudy($parent, $displayName, array $optionalArgs = []) - { - $request = new LookupStudyRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDisplayName($displayName); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'LookupStudy', - Study::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Stops a Trial. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedName = $vizierServiceClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - * $response = $vizierServiceClient->stopTrial($formattedName); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The Trial's name. - * Format: - * `projects/{project}/locations/{location}/studies/{study}/trials/{trial}` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AIPlatform\V1\Trial - * - * @throws ApiException if the remote call fails - */ - public function stopTrial($name, array $optionalArgs = []) - { - $request = new StopTrialRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'StopTrial', - Trial::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Adds one or more Trials to a Study, with parameter values - * suggested by Vertex AI Vizier. Returns a long-running - * operation associated with the generation of Trial suggestions. - * When this long-running operation succeeds, it will contain - * a - * [SuggestTrialsResponse][google.cloud.aiplatform.v1.SuggestTrialsResponse]. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $formattedParent = $vizierServiceClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - * $suggestionCount = 0; - * $clientId = 'client_id'; - * $operationResponse = $vizierServiceClient->suggestTrials($formattedParent, $suggestionCount, $clientId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vizierServiceClient->suggestTrials($formattedParent, $suggestionCount, $clientId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vizierServiceClient->resumeOperation($operationName, 'suggestTrials'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location that the Study belongs to. - * Format: `projects/{project}/locations/{location}/studies/{study}` - * @param int $suggestionCount Required. The number of suggestions requested. It must be positive. - * @param string $clientId Required. The identifier of the client that is requesting the suggestion. - * - * If multiple SuggestTrialsRequests have the same `client_id`, - * the service will return the identical suggested Trial if the Trial is - * pending, and provide a new Trial if the last suggested Trial was completed. - * @param array $optionalArgs { - * Optional. - * - * @type TrialContext[] $contexts - * Optional. This allows you to specify the "context" for a Trial; a context - * is a slice (a subspace) of the search space. - * - * Typical uses for contexts: - * 1) You are using Vizier to tune a server for best performance, but there's - * a strong weekly cycle. The context specifies the day-of-week. - * This allows Tuesday to generalize from Wednesday without assuming that - * everything is identical. - * 2) Imagine you're optimizing some medical treatment for people. - * As they walk in the door, you know certain facts about them - * (e.g. sex, weight, height, blood-pressure). Put that information in the - * context, and Vizier will adapt its suggestions to the patient. - * 3) You want to do a fair A/B test efficiently. Specify the "A" and "B" - * conditions as contexts, and Vizier will generalize between "A" and "B" - * conditions. If they are similar, this will allow Vizier to converge - * to the optimum faster than if "A" and "B" were separate Studies. - * NOTE: You can also enter contexts as REQUESTED Trials, e.g. via the - * CreateTrial() RPC; that's the asynchronous option where you don't need a - * close association between contexts and suggestions. - * - * NOTE: All the Parameters you set in a context MUST be defined in the - * Study. - * NOTE: You must supply 0 or $suggestion_count contexts. - * If you don't supply any contexts, Vizier will make suggestions - * from the full search space specified in the StudySpec; if you supply - * a full set of context, each suggestion will match the corresponding - * context. - * NOTE: A Context with no features set matches anything, and allows - * suggestions from the full search space. - * NOTE: Contexts MUST lie within the search space specified in the - * StudySpec. It's an error if they don't. - * NOTE: Contexts preferentially match ACTIVE then REQUESTED trials before - * new suggestions are generated. - * NOTE: Generation of suggestions involves a match between a Context and - * (optionally) a REQUESTED trial; if that match is not fully specified, a - * suggestion will be geneated in the merged subspace. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function suggestTrials( - $parent, - $suggestionCount, - $clientId, - array $optionalArgs = [] - ) { - $request = new SuggestTrialsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSuggestionCount($suggestionCount); - $request->setClientId($clientId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['contexts'])) { - $request->setContexts($optionalArgs['contexts']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'SuggestTrials', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $response = $vizierServiceClient->getLocation(); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $vizierServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vizierServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $resource = 'resource'; - * $response = $vizierServiceClient->getIamPolicy($resource); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $vizierServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $vizierServiceClient = new VizierServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $vizierServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $vizierServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.iam.v1.IAMPolicy' - )->wait(); - } -} diff --git a/AiPlatform/src/V1/GcsDestination.php b/AiPlatform/src/V1/GcsDestination.php index 7b144ab618ad..0ea937dbe464 100644 --- a/AiPlatform/src/V1/GcsDestination.php +++ b/AiPlatform/src/V1/GcsDestination.php @@ -23,7 +23,7 @@ class GcsDestination extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $output_uri_prefix = ''; + protected $output_uri_prefix = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/GenAiTuningServiceClient.php b/AiPlatform/src/V1/GenAiTuningServiceClient.php deleted file mode 100644 index 61f6b49d12aa..000000000000 --- a/AiPlatform/src/V1/GenAiTuningServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -string model = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $model = ''; + protected $model = ''; /** * Required. The content of the current conversation with the model. * For single-turn queries, this is a single instance. For multi-turn queries, @@ -39,7 +39,7 @@ class GenerateContentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.aiplatform.v1.Content system_instruction = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $system_instruction = null; + protected $system_instruction = null; /** * Optional. A list of `Tools` the model may use to generate the next * response. @@ -56,7 +56,7 @@ class GenerateContentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ToolConfig tool_config = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $tool_config = null; + protected $tool_config = null; /** * Optional. Per request settings for blocking unsafe content. * Enforced on GenerateContentResponse.candidates. @@ -69,7 +69,7 @@ class GenerateContentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenerationConfig generation_config = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $generation_config = null; + protected $generation_config = null; /** * @param string $model Required. The name of the publisher model requested to serve the diff --git a/AiPlatform/src/V1/GenerateContentResponse.php b/AiPlatform/src/V1/GenerateContentResponse.php index 72c4dc99f688..b694b187304a 100644 --- a/AiPlatform/src/V1/GenerateContentResponse.php +++ b/AiPlatform/src/V1/GenerateContentResponse.php @@ -28,13 +28,13 @@ class GenerateContentResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $prompt_feedback = null; + protected $prompt_feedback = null; /** * Usage metadata about the response(s). * * Generated from protobuf field .google.cloud.aiplatform.v1.GenerateContentResponse.UsageMetadata usage_metadata = 4; */ - private $usage_metadata = null; + protected $usage_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/GenerateContentResponse/PromptFeedback.php b/AiPlatform/src/V1/GenerateContentResponse/PromptFeedback.php index da1aaa7a6722..e10d71a657be 100644 --- a/AiPlatform/src/V1/GenerateContentResponse/PromptFeedback.php +++ b/AiPlatform/src/V1/GenerateContentResponse/PromptFeedback.php @@ -20,7 +20,7 @@ class PromptFeedback extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenerateContentResponse.PromptFeedback.BlockedReason block_reason = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $block_reason = 0; + protected $block_reason = 0; /** * Output only. Safety ratings. * @@ -32,7 +32,7 @@ class PromptFeedback extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string block_reason_message = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $block_reason_message = ''; + protected $block_reason_message = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/GenerateContentResponse/UsageMetadata.php b/AiPlatform/src/V1/GenerateContentResponse/UsageMetadata.php index 9b9de428a9dd..e7029f72cd4e 100644 --- a/AiPlatform/src/V1/GenerateContentResponse/UsageMetadata.php +++ b/AiPlatform/src/V1/GenerateContentResponse/UsageMetadata.php @@ -20,17 +20,17 @@ class UsageMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 prompt_token_count = 1; */ - private $prompt_token_count = 0; + protected $prompt_token_count = 0; /** * Number of tokens in the response(s). * * Generated from protobuf field int32 candidates_token_count = 2; */ - private $candidates_token_count = 0; + protected $candidates_token_count = 0; /** * Generated from protobuf field int32 total_token_count = 3; */ - private $total_token_count = 0; + protected $total_token_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/GenerationConfig.php b/AiPlatform/src/V1/GenerationConfig.php index 6429f4fa4943..be034798850c 100644 --- a/AiPlatform/src/V1/GenerationConfig.php +++ b/AiPlatform/src/V1/GenerationConfig.php @@ -20,31 +20,31 @@ class GenerationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional float temperature = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $temperature = null; + protected $temperature = null; /** * Optional. If specified, nucleus sampling will be used. * * Generated from protobuf field optional float top_p = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $top_p = null; + protected $top_p = null; /** * Optional. If specified, top-k sampling will be used. * * Generated from protobuf field optional float top_k = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $top_k = null; + protected $top_k = null; /** * Optional. Number of candidates to generate. * * Generated from protobuf field optional int32 candidate_count = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $candidate_count = null; + protected $candidate_count = null; /** * Optional. The maximum number of output tokens to generate per message. * * Generated from protobuf field optional int32 max_output_tokens = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $max_output_tokens = null; + protected $max_output_tokens = null; /** * Optional. Stop sequences. * @@ -56,13 +56,13 @@ class GenerationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional float presence_penalty = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $presence_penalty = null; + protected $presence_penalty = null; /** * Optional. Frequency penalties. * * Generated from protobuf field optional float frequency_penalty = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $frequency_penalty = null; + protected $frequency_penalty = null; /** * Optional. Output response mimetype of the generated candidate text. * Supported mimetype: @@ -74,7 +74,7 @@ class GenerationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string response_mime_type = 13 [(.google.api.field_behavior) = OPTIONAL]; */ - private $response_mime_type = ''; + protected $response_mime_type = ''; /** * Optional. The `Schema` object allows the definition of input and output * data types. These types can be objects, but also primitives and arrays. @@ -86,7 +86,7 @@ class GenerationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.aiplatform.v1.Schema response_schema = 16 [(.google.api.field_behavior) = OPTIONAL]; */ - private $response_schema = null; + protected $response_schema = null; /** * Constructor. diff --git a/AiPlatform/src/V1/GenericOperationMetadata.php b/AiPlatform/src/V1/GenericOperationMetadata.php index 4ac554298120..274590cdf475 100644 --- a/AiPlatform/src/V1/GenericOperationMetadata.php +++ b/AiPlatform/src/V1/GenericOperationMetadata.php @@ -29,7 +29,7 @@ class GenericOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Time when the operation was updated for the last time. * If the operation has finished (successfully or not), this is the finish @@ -37,7 +37,7 @@ class GenericOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Constructor. diff --git a/AiPlatform/src/V1/GenieSource.php b/AiPlatform/src/V1/GenieSource.php index 5ea8ccdf2472..1bd25d3059f5 100644 --- a/AiPlatform/src/V1/GenieSource.php +++ b/AiPlatform/src/V1/GenieSource.php @@ -21,7 +21,7 @@ class GenieSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string base_model_uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $base_model_uri = ''; + protected $base_model_uri = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/GetAnnotationSpecRequest.php b/AiPlatform/src/V1/GetAnnotationSpecRequest.php index 69b4e9085666..43f3a3d1e4d6 100644 --- a/AiPlatform/src/V1/GetAnnotationSpecRequest.php +++ b/AiPlatform/src/V1/GetAnnotationSpecRequest.php @@ -23,13 +23,13 @@ class GetAnnotationSpecRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 2; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $name Required. The name of the AnnotationSpec resource. diff --git a/AiPlatform/src/V1/GetArtifactRequest.php b/AiPlatform/src/V1/GetArtifactRequest.php index 5d7621807130..ec1059ebb820 100644 --- a/AiPlatform/src/V1/GetArtifactRequest.php +++ b/AiPlatform/src/V1/GetArtifactRequest.php @@ -23,7 +23,7 @@ class GetArtifactRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the Artifact to retrieve. diff --git a/AiPlatform/src/V1/GetBatchPredictionJobRequest.php b/AiPlatform/src/V1/GetBatchPredictionJobRequest.php index b7ba382b8fda..ee1cd6355e1f 100644 --- a/AiPlatform/src/V1/GetBatchPredictionJobRequest.php +++ b/AiPlatform/src/V1/GetBatchPredictionJobRequest.php @@ -23,7 +23,7 @@ class GetBatchPredictionJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the BatchPredictionJob resource. diff --git a/AiPlatform/src/V1/GetContextRequest.php b/AiPlatform/src/V1/GetContextRequest.php index 4aab12214863..b58000a8325d 100644 --- a/AiPlatform/src/V1/GetContextRequest.php +++ b/AiPlatform/src/V1/GetContextRequest.php @@ -23,7 +23,7 @@ class GetContextRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the Context to retrieve. diff --git a/AiPlatform/src/V1/GetCustomJobRequest.php b/AiPlatform/src/V1/GetCustomJobRequest.php index 34274696b1e5..200ddf55023c 100644 --- a/AiPlatform/src/V1/GetCustomJobRequest.php +++ b/AiPlatform/src/V1/GetCustomJobRequest.php @@ -23,7 +23,7 @@ class GetCustomJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the CustomJob resource. diff --git a/AiPlatform/src/V1/GetDataLabelingJobRequest.php b/AiPlatform/src/V1/GetDataLabelingJobRequest.php index edbcd579a826..b6c5203977a1 100644 --- a/AiPlatform/src/V1/GetDataLabelingJobRequest.php +++ b/AiPlatform/src/V1/GetDataLabelingJobRequest.php @@ -23,7 +23,7 @@ class GetDataLabelingJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the DataLabelingJob. diff --git a/AiPlatform/src/V1/GetDatasetRequest.php b/AiPlatform/src/V1/GetDatasetRequest.php index 59dc265da306..c566c1947c2d 100644 --- a/AiPlatform/src/V1/GetDatasetRequest.php +++ b/AiPlatform/src/V1/GetDatasetRequest.php @@ -21,13 +21,13 @@ class GetDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 2; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $name Required. The name of the Dataset resource. Please see diff --git a/AiPlatform/src/V1/GetDatasetVersionRequest.php b/AiPlatform/src/V1/GetDatasetVersionRequest.php index 1a0682831fb8..98c340f55dc6 100644 --- a/AiPlatform/src/V1/GetDatasetVersionRequest.php +++ b/AiPlatform/src/V1/GetDatasetVersionRequest.php @@ -23,13 +23,13 @@ class GetDatasetVersionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 2; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $name Required. The resource name of the Dataset version to delete. diff --git a/AiPlatform/src/V1/GetDeploymentResourcePoolRequest.php b/AiPlatform/src/V1/GetDeploymentResourcePoolRequest.php index fadeb18058c2..e4f7285ca00b 100644 --- a/AiPlatform/src/V1/GetDeploymentResourcePoolRequest.php +++ b/AiPlatform/src/V1/GetDeploymentResourcePoolRequest.php @@ -22,7 +22,7 @@ class GetDeploymentResourcePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the DeploymentResourcePool to retrieve. diff --git a/AiPlatform/src/V1/GetEndpointRequest.php b/AiPlatform/src/V1/GetEndpointRequest.php index 4188b9e5c30b..f71b8c0f6c30 100644 --- a/AiPlatform/src/V1/GetEndpointRequest.php +++ b/AiPlatform/src/V1/GetEndpointRequest.php @@ -23,7 +23,7 @@ class GetEndpointRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Endpoint resource. diff --git a/AiPlatform/src/V1/GetEntityTypeRequest.php b/AiPlatform/src/V1/GetEntityTypeRequest.php index 4ccb2434bf42..d398ddd247d3 100644 --- a/AiPlatform/src/V1/GetEntityTypeRequest.php +++ b/AiPlatform/src/V1/GetEntityTypeRequest.php @@ -23,7 +23,7 @@ class GetEntityTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the EntityType resource. diff --git a/AiPlatform/src/V1/GetExecutionRequest.php b/AiPlatform/src/V1/GetExecutionRequest.php index 364ef899a4c1..3dfe973d79f7 100644 --- a/AiPlatform/src/V1/GetExecutionRequest.php +++ b/AiPlatform/src/V1/GetExecutionRequest.php @@ -23,7 +23,7 @@ class GetExecutionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the Execution to retrieve. diff --git a/AiPlatform/src/V1/GetFeatureGroupRequest.php b/AiPlatform/src/V1/GetFeatureGroupRequest.php index ab9a0576384e..5cb13f154e77 100644 --- a/AiPlatform/src/V1/GetFeatureGroupRequest.php +++ b/AiPlatform/src/V1/GetFeatureGroupRequest.php @@ -21,7 +21,7 @@ class GetFeatureGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the FeatureGroup resource. Please see diff --git a/AiPlatform/src/V1/GetFeatureOnlineStoreRequest.php b/AiPlatform/src/V1/GetFeatureOnlineStoreRequest.php index 187636b3c4c2..721787c95c91 100644 --- a/AiPlatform/src/V1/GetFeatureOnlineStoreRequest.php +++ b/AiPlatform/src/V1/GetFeatureOnlineStoreRequest.php @@ -21,7 +21,7 @@ class GetFeatureOnlineStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the FeatureOnlineStore resource. Please see diff --git a/AiPlatform/src/V1/GetFeatureRequest.php b/AiPlatform/src/V1/GetFeatureRequest.php index 7eaf6aaad49f..402b8ea33576 100644 --- a/AiPlatform/src/V1/GetFeatureRequest.php +++ b/AiPlatform/src/V1/GetFeatureRequest.php @@ -27,7 +27,7 @@ class GetFeatureRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Feature resource. diff --git a/AiPlatform/src/V1/GetFeatureViewRequest.php b/AiPlatform/src/V1/GetFeatureViewRequest.php index 4b15a7aea8b7..0c977674e079 100644 --- a/AiPlatform/src/V1/GetFeatureViewRequest.php +++ b/AiPlatform/src/V1/GetFeatureViewRequest.php @@ -23,7 +23,7 @@ class GetFeatureViewRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the FeatureView resource. diff --git a/AiPlatform/src/V1/GetFeatureViewSyncRequest.php b/AiPlatform/src/V1/GetFeatureViewSyncRequest.php index 72b7dd1940e1..57cea7ce033c 100644 --- a/AiPlatform/src/V1/GetFeatureViewSyncRequest.php +++ b/AiPlatform/src/V1/GetFeatureViewSyncRequest.php @@ -23,7 +23,7 @@ class GetFeatureViewSyncRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the FeatureViewSync resource. diff --git a/AiPlatform/src/V1/GetFeaturestoreRequest.php b/AiPlatform/src/V1/GetFeaturestoreRequest.php index 0903f9643ebe..7e170fba6f55 100644 --- a/AiPlatform/src/V1/GetFeaturestoreRequest.php +++ b/AiPlatform/src/V1/GetFeaturestoreRequest.php @@ -21,7 +21,7 @@ class GetFeaturestoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Featurestore resource. Please see diff --git a/AiPlatform/src/V1/GetHyperparameterTuningJobRequest.php b/AiPlatform/src/V1/GetHyperparameterTuningJobRequest.php index 261464035432..1628b8cd9fa0 100644 --- a/AiPlatform/src/V1/GetHyperparameterTuningJobRequest.php +++ b/AiPlatform/src/V1/GetHyperparameterTuningJobRequest.php @@ -23,7 +23,7 @@ class GetHyperparameterTuningJobRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the HyperparameterTuningJob resource. diff --git a/AiPlatform/src/V1/GetIndexEndpointRequest.php b/AiPlatform/src/V1/GetIndexEndpointRequest.php index aba866069867..75de3b6fa86a 100644 --- a/AiPlatform/src/V1/GetIndexEndpointRequest.php +++ b/AiPlatform/src/V1/GetIndexEndpointRequest.php @@ -23,7 +23,7 @@ class GetIndexEndpointRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the IndexEndpoint resource. diff --git a/AiPlatform/src/V1/GetIndexRequest.php b/AiPlatform/src/V1/GetIndexRequest.php index 6f8738aee3bd..d5907d58b5a6 100644 --- a/AiPlatform/src/V1/GetIndexRequest.php +++ b/AiPlatform/src/V1/GetIndexRequest.php @@ -23,7 +23,7 @@ class GetIndexRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Index resource. diff --git a/AiPlatform/src/V1/GetMetadataSchemaRequest.php b/AiPlatform/src/V1/GetMetadataSchemaRequest.php index 1c9e09a9f0e8..1a0bb95c0b44 100644 --- a/AiPlatform/src/V1/GetMetadataSchemaRequest.php +++ b/AiPlatform/src/V1/GetMetadataSchemaRequest.php @@ -23,7 +23,7 @@ class GetMetadataSchemaRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the MetadataSchema to retrieve. diff --git a/AiPlatform/src/V1/GetMetadataStoreRequest.php b/AiPlatform/src/V1/GetMetadataStoreRequest.php index 1c3fd15b3239..5e671ba44f5a 100644 --- a/AiPlatform/src/V1/GetMetadataStoreRequest.php +++ b/AiPlatform/src/V1/GetMetadataStoreRequest.php @@ -23,7 +23,7 @@ class GetMetadataStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the MetadataStore to retrieve. diff --git a/AiPlatform/src/V1/GetModelDeploymentMonitoringJobRequest.php b/AiPlatform/src/V1/GetModelDeploymentMonitoringJobRequest.php index 2708127013c4..ba7626620ad8 100644 --- a/AiPlatform/src/V1/GetModelDeploymentMonitoringJobRequest.php +++ b/AiPlatform/src/V1/GetModelDeploymentMonitoringJobRequest.php @@ -23,7 +23,7 @@ class GetModelDeploymentMonitoringJobRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the ModelDeploymentMonitoringJob. diff --git a/AiPlatform/src/V1/GetModelEvaluationRequest.php b/AiPlatform/src/V1/GetModelEvaluationRequest.php index 6d79d00a9d23..2f965443ec4e 100644 --- a/AiPlatform/src/V1/GetModelEvaluationRequest.php +++ b/AiPlatform/src/V1/GetModelEvaluationRequest.php @@ -23,7 +23,7 @@ class GetModelEvaluationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the ModelEvaluation resource. diff --git a/AiPlatform/src/V1/GetModelEvaluationSliceRequest.php b/AiPlatform/src/V1/GetModelEvaluationSliceRequest.php index fc31486ae7e6..d18eb9dbd8fc 100644 --- a/AiPlatform/src/V1/GetModelEvaluationSliceRequest.php +++ b/AiPlatform/src/V1/GetModelEvaluationSliceRequest.php @@ -23,7 +23,7 @@ class GetModelEvaluationSliceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the ModelEvaluationSlice resource. diff --git a/AiPlatform/src/V1/GetModelRequest.php b/AiPlatform/src/V1/GetModelRequest.php index 0d34849fc16d..c5e1e32b8c6b 100644 --- a/AiPlatform/src/V1/GetModelRequest.php +++ b/AiPlatform/src/V1/GetModelRequest.php @@ -31,7 +31,7 @@ class GetModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Model resource. diff --git a/AiPlatform/src/V1/GetNasJobRequest.php b/AiPlatform/src/V1/GetNasJobRequest.php index 431ba608f32e..9d1d2e617620 100644 --- a/AiPlatform/src/V1/GetNasJobRequest.php +++ b/AiPlatform/src/V1/GetNasJobRequest.php @@ -23,7 +23,7 @@ class GetNasJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NasJob resource. diff --git a/AiPlatform/src/V1/GetNasTrialDetailRequest.php b/AiPlatform/src/V1/GetNasTrialDetailRequest.php index ee569886e3a0..773a9f4aac1c 100644 --- a/AiPlatform/src/V1/GetNasTrialDetailRequest.php +++ b/AiPlatform/src/V1/GetNasTrialDetailRequest.php @@ -23,7 +23,7 @@ class GetNasTrialDetailRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NasTrialDetail resource. diff --git a/AiPlatform/src/V1/GetNotebookRuntimeRequest.php b/AiPlatform/src/V1/GetNotebookRuntimeRequest.php index aa59a5be5820..7325674a1053 100644 --- a/AiPlatform/src/V1/GetNotebookRuntimeRequest.php +++ b/AiPlatform/src/V1/GetNotebookRuntimeRequest.php @@ -24,7 +24,7 @@ class GetNotebookRuntimeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NotebookRuntime resource. diff --git a/AiPlatform/src/V1/GetNotebookRuntimeTemplateRequest.php b/AiPlatform/src/V1/GetNotebookRuntimeTemplateRequest.php index 995c8af8339e..bfa39aba7da9 100644 --- a/AiPlatform/src/V1/GetNotebookRuntimeTemplateRequest.php +++ b/AiPlatform/src/V1/GetNotebookRuntimeTemplateRequest.php @@ -23,7 +23,7 @@ class GetNotebookRuntimeTemplateRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NotebookRuntimeTemplate resource. diff --git a/AiPlatform/src/V1/GetPersistentResourceRequest.php b/AiPlatform/src/V1/GetPersistentResourceRequest.php index b4a22c3a4b96..d9d335443ff4 100644 --- a/AiPlatform/src/V1/GetPersistentResourceRequest.php +++ b/AiPlatform/src/V1/GetPersistentResourceRequest.php @@ -23,7 +23,7 @@ class GetPersistentResourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the PersistentResource resource. diff --git a/AiPlatform/src/V1/GetPipelineJobRequest.php b/AiPlatform/src/V1/GetPipelineJobRequest.php index 89cbc0189a52..7c328bd57067 100644 --- a/AiPlatform/src/V1/GetPipelineJobRequest.php +++ b/AiPlatform/src/V1/GetPipelineJobRequest.php @@ -23,7 +23,7 @@ class GetPipelineJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the PipelineJob resource. diff --git a/AiPlatform/src/V1/GetPublisherModelRequest.php b/AiPlatform/src/V1/GetPublisherModelRequest.php index 06373ef71464..8ad78476d64d 100644 --- a/AiPlatform/src/V1/GetPublisherModelRequest.php +++ b/AiPlatform/src/V1/GetPublisherModelRequest.php @@ -23,20 +23,20 @@ class GetPublisherModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. The IETF BCP-47 language code representing the language in which * the publisher model's text information should be written in (see go/bcp47). * * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $language_code = ''; + protected $language_code = ''; /** * Optional. PublisherModel view specifying which fields to read. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModelView view = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $view = 0; + protected $view = 0; /** * @param string $name Required. The name of the PublisherModel resource. diff --git a/AiPlatform/src/V1/GetScheduleRequest.php b/AiPlatform/src/V1/GetScheduleRequest.php index bf42e38b7695..e8f6202849fc 100644 --- a/AiPlatform/src/V1/GetScheduleRequest.php +++ b/AiPlatform/src/V1/GetScheduleRequest.php @@ -23,7 +23,7 @@ class GetScheduleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Schedule resource. diff --git a/AiPlatform/src/V1/GetSpecialistPoolRequest.php b/AiPlatform/src/V1/GetSpecialistPoolRequest.php index d79c89758872..4533f8d4d5dd 100644 --- a/AiPlatform/src/V1/GetSpecialistPoolRequest.php +++ b/AiPlatform/src/V1/GetSpecialistPoolRequest.php @@ -23,7 +23,7 @@ class GetSpecialistPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the SpecialistPool resource. diff --git a/AiPlatform/src/V1/GetStudyRequest.php b/AiPlatform/src/V1/GetStudyRequest.php index 7586794609ef..607cd9a4be35 100644 --- a/AiPlatform/src/V1/GetStudyRequest.php +++ b/AiPlatform/src/V1/GetStudyRequest.php @@ -22,7 +22,7 @@ class GetStudyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Study resource. diff --git a/AiPlatform/src/V1/GetTensorboardExperimentRequest.php b/AiPlatform/src/V1/GetTensorboardExperimentRequest.php index 7cfce1061381..00114cdbde74 100644 --- a/AiPlatform/src/V1/GetTensorboardExperimentRequest.php +++ b/AiPlatform/src/V1/GetTensorboardExperimentRequest.php @@ -23,7 +23,7 @@ class GetTensorboardExperimentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TensorboardExperiment resource. diff --git a/AiPlatform/src/V1/GetTensorboardRequest.php b/AiPlatform/src/V1/GetTensorboardRequest.php index 9cb71aa197f4..5d5bede56773 100644 --- a/AiPlatform/src/V1/GetTensorboardRequest.php +++ b/AiPlatform/src/V1/GetTensorboardRequest.php @@ -23,7 +23,7 @@ class GetTensorboardRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Tensorboard resource. diff --git a/AiPlatform/src/V1/GetTensorboardRunRequest.php b/AiPlatform/src/V1/GetTensorboardRunRequest.php index cb319b62b6b2..7ee1d379ed5f 100644 --- a/AiPlatform/src/V1/GetTensorboardRunRequest.php +++ b/AiPlatform/src/V1/GetTensorboardRunRequest.php @@ -23,7 +23,7 @@ class GetTensorboardRunRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TensorboardRun resource. diff --git a/AiPlatform/src/V1/GetTensorboardTimeSeriesRequest.php b/AiPlatform/src/V1/GetTensorboardTimeSeriesRequest.php index 3ecc12a1aea6..0a11b588be2f 100644 --- a/AiPlatform/src/V1/GetTensorboardTimeSeriesRequest.php +++ b/AiPlatform/src/V1/GetTensorboardTimeSeriesRequest.php @@ -23,7 +23,7 @@ class GetTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TensorboardTimeSeries resource. diff --git a/AiPlatform/src/V1/GetTrainingPipelineRequest.php b/AiPlatform/src/V1/GetTrainingPipelineRequest.php index fb70ce6fb001..f1acd31b04fa 100644 --- a/AiPlatform/src/V1/GetTrainingPipelineRequest.php +++ b/AiPlatform/src/V1/GetTrainingPipelineRequest.php @@ -23,7 +23,7 @@ class GetTrainingPipelineRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TrainingPipeline resource. diff --git a/AiPlatform/src/V1/GetTrialRequest.php b/AiPlatform/src/V1/GetTrialRequest.php index 50b143761c06..be443baeba8c 100644 --- a/AiPlatform/src/V1/GetTrialRequest.php +++ b/AiPlatform/src/V1/GetTrialRequest.php @@ -23,7 +23,7 @@ class GetTrialRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Trial resource. diff --git a/AiPlatform/src/V1/GetTuningJobRequest.php b/AiPlatform/src/V1/GetTuningJobRequest.php index ea148ff60949..4a0333cdf321 100644 --- a/AiPlatform/src/V1/GetTuningJobRequest.php +++ b/AiPlatform/src/V1/GetTuningJobRequest.php @@ -22,7 +22,7 @@ class GetTuningJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the TuningJob resource. Format: diff --git a/AiPlatform/src/V1/GroundingAttribution.php b/AiPlatform/src/V1/GroundingAttribution.php deleted file mode 100644 index 22eca5428966..000000000000 --- a/AiPlatform/src/V1/GroundingAttribution.php +++ /dev/null @@ -1,167 +0,0 @@ -google.cloud.aiplatform.v1.GroundingAttribution - */ -class GroundingAttribution extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. Segment of the content this attribution belongs to. - * - * Generated from protobuf field .google.cloud.aiplatform.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $segment = null; - /** - * Optional. Output only. Confidence score of the attribution. Ranges from 0 - * to 1. 1 is the most confident. - * - * Generated from protobuf field optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $confidence_score = null; - protected $reference; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\AIPlatform\V1\GroundingAttribution\Web $web - * Optional. Attribution from the web. - * @type \Google\Cloud\AIPlatform\V1\Segment $segment - * Output only. Segment of the content this attribution belongs to. - * @type float $confidence_score - * Optional. Output only. Confidence score of the attribution. Ranges from 0 - * to 1. 1 is the most confident. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Aiplatform\V1\Content::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Attribution from the web. - * - * Generated from protobuf field .google.cloud.aiplatform.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\AIPlatform\V1\GroundingAttribution\Web|null - */ - public function getWeb() - { - return $this->readOneof(3); - } - - public function hasWeb() - { - return $this->hasOneof(3); - } - - /** - * Optional. Attribution from the web. - * - * Generated from protobuf field .google.cloud.aiplatform.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\AIPlatform\V1\GroundingAttribution\Web $var - * @return $this - */ - public function setWeb($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\GroundingAttribution\Web::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Output only. Segment of the content this attribution belongs to. - * - * Generated from protobuf field .google.cloud.aiplatform.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Cloud\AIPlatform\V1\Segment|null - */ - public function getSegment() - { - return $this->segment; - } - - public function hasSegment() - { - return isset($this->segment); - } - - public function clearSegment() - { - unset($this->segment); - } - - /** - * Output only. Segment of the content this attribution belongs to. - * - * Generated from protobuf field .google.cloud.aiplatform.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Cloud\AIPlatform\V1\Segment $var - * @return $this - */ - public function setSegment($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\Segment::class); - $this->segment = $var; - - return $this; - } - - /** - * Optional. Output only. Confidence score of the attribution. Ranges from 0 - * to 1. 1 is the most confident. - * - * Generated from protobuf field optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; - * @return float - */ - public function getConfidenceScore() - { - return isset($this->confidence_score) ? $this->confidence_score : 0.0; - } - - public function hasConfidenceScore() - { - return isset($this->confidence_score); - } - - public function clearConfidenceScore() - { - unset($this->confidence_score); - } - - /** - * Optional. Output only. Confidence score of the attribution. Ranges from 0 - * to 1. 1 is the most confident. - * - * Generated from protobuf field optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; - * @param float $var - * @return $this - */ - public function setConfidenceScore($var) - { - GPBUtil::checkFloat($var); - $this->confidence_score = $var; - - return $this; - } - - /** - * @return string - */ - public function getReference() - { - return $this->whichOneof("reference"); - } - -} - diff --git a/AiPlatform/src/V1/GroundingAttribution/Web.php b/AiPlatform/src/V1/GroundingAttribution/Web.php deleted file mode 100644 index a8a28e2d73c3..000000000000 --- a/AiPlatform/src/V1/GroundingAttribution/Web.php +++ /dev/null @@ -1,102 +0,0 @@ -google.cloud.aiplatform.v1.GroundingAttribution.Web - */ -class Web extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. URI reference of the attribution. - * - * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $uri = ''; - /** - * Output only. Title of the attribution. - * - * Generated from protobuf field string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $title = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $uri - * Output only. URI reference of the attribution. - * @type string $title - * Output only. Title of the attribution. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Aiplatform\V1\Content::initOnce(); - parent::__construct($data); - } - - /** - * Output only. URI reference of the attribution. - * - * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getUri() - { - return $this->uri; - } - - /** - * Output only. URI reference of the attribution. - * - * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setUri($var) - { - GPBUtil::checkString($var, True); - $this->uri = $var; - - return $this; - } - - /** - * Output only. Title of the attribution. - * - * Generated from protobuf field string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Output only. Title of the attribution. - * - * Generated from protobuf field string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setTitle($var) - { - GPBUtil::checkString($var, True); - $this->title = $var; - - return $this; - } - -} - - diff --git a/AiPlatform/src/V1/GroundingMetadata.php b/AiPlatform/src/V1/GroundingMetadata.php index a051447341ed..55381cf6539d 100644 --- a/AiPlatform/src/V1/GroundingMetadata.php +++ b/AiPlatform/src/V1/GroundingMetadata.php @@ -26,7 +26,7 @@ class GroundingMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.aiplatform.v1.SearchEntryPoint search_entry_point = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $search_entry_point = null; + protected $search_entry_point = null; /** * Constructor. diff --git a/AiPlatform/src/V1/HyperparameterTuningJob.php b/AiPlatform/src/V1/HyperparameterTuningJob.php index 6bc8172cbafd..2b4338d63c70 100644 --- a/AiPlatform/src/V1/HyperparameterTuningJob.php +++ b/AiPlatform/src/V1/HyperparameterTuningJob.php @@ -22,7 +22,7 @@ class HyperparameterTuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The display name of the HyperparameterTuningJob. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -30,25 +30,25 @@ class HyperparameterTuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Required. Study configuration of the HyperparameterTuningJob. * * Generated from protobuf field .google.cloud.aiplatform.v1.StudySpec study_spec = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $study_spec = null; + protected $study_spec = null; /** * Required. The desired total number of Trials. * * Generated from protobuf field int32 max_trial_count = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_trial_count = 0; + protected $max_trial_count = 0; /** * Required. The desired number of Trials to run in parallel. * * Generated from protobuf field int32 parallel_trial_count = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $parallel_trial_count = 0; + protected $parallel_trial_count = 0; /** * The number of failed Trials that need to be seen before failing * the HyperparameterTuningJob. @@ -57,14 +57,14 @@ class HyperparameterTuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 max_failed_trial_count = 7; */ - private $max_failed_trial_count = 0; + protected $max_failed_trial_count = 0; /** * Required. The spec of a trial job. The same spec applies to the CustomJobs * created in all the trials. * * Generated from protobuf field .google.cloud.aiplatform.v1.CustomJobSpec trial_job_spec = 8 [(.google.api.field_behavior) = REQUIRED]; */ - private $trial_job_spec = null; + protected $trial_job_spec = null; /** * Output only. Trials of the HyperparameterTuningJob. * @@ -76,20 +76,20 @@ class HyperparameterTuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.JobState state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Time when the HyperparameterTuningJob was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Time when the HyperparameterTuningJob for the first time * entered the `JOB_STATE_RUNNING` state. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Time when the HyperparameterTuningJob entered any of the * following states: `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, @@ -97,21 +97,21 @@ class HyperparameterTuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp end_time = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Time when the HyperparameterTuningJob was most recently * updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. Only populated when job's state is JOB_STATE_FAILED or * JOB_STATE_CANCELLED. * * Generated from protobuf field .google.rpc.Status error = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * The labels with user-defined metadata to organize HyperparameterTuningJobs. * Label keys and values can be no longer than 64 characters @@ -129,7 +129,7 @@ class HyperparameterTuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 17; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ImportDataConfig.php b/AiPlatform/src/V1/ImportDataConfig.php index bc78d198166f..df1309b1d648 100644 --- a/AiPlatform/src/V1/ImportDataConfig.php +++ b/AiPlatform/src/V1/ImportDataConfig.php @@ -57,7 +57,7 @@ class ImportDataConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string import_schema_uri = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $import_schema_uri = ''; + protected $import_schema_uri = ''; protected $source; /** diff --git a/AiPlatform/src/V1/ImportDataOperationMetadata.php b/AiPlatform/src/V1/ImportDataOperationMetadata.php index 892b1e89430d..1a48b997790c 100644 --- a/AiPlatform/src/V1/ImportDataOperationMetadata.php +++ b/AiPlatform/src/V1/ImportDataOperationMetadata.php @@ -21,7 +21,7 @@ class ImportDataOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ImportDataRequest.php b/AiPlatform/src/V1/ImportDataRequest.php index 19b4757f8487..ace093762889 100644 --- a/AiPlatform/src/V1/ImportDataRequest.php +++ b/AiPlatform/src/V1/ImportDataRequest.php @@ -23,7 +23,7 @@ class ImportDataRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Required. The desired input locations. The contents of all input locations * will be imported in one batch. diff --git a/AiPlatform/src/V1/ImportFeatureValuesOperationMetadata.php b/AiPlatform/src/V1/ImportFeatureValuesOperationMetadata.php index 2e693832817a..76962935d539 100644 --- a/AiPlatform/src/V1/ImportFeatureValuesOperationMetadata.php +++ b/AiPlatform/src/V1/ImportFeatureValuesOperationMetadata.php @@ -20,19 +20,19 @@ class ImportFeatureValuesOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Number of entities that have been imported by the operation. * * Generated from protobuf field int64 imported_entity_count = 2; */ - private $imported_entity_count = 0; + protected $imported_entity_count = 0; /** * Number of Feature values that have been imported by the operation. * * Generated from protobuf field int64 imported_feature_value_count = 3; */ - private $imported_feature_value_count = 0; + protected $imported_feature_value_count = 0; /** * The source URI from where Feature values are imported. * @@ -48,14 +48,14 @@ class ImportFeatureValuesOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field int64 invalid_row_count = 6; */ - private $invalid_row_count = 0; + protected $invalid_row_count = 0; /** * The number rows that weren't ingested due to having timestamps outside the * retention boundary. * * Generated from protobuf field int64 timestamp_outside_retention_rows_count = 7; */ - private $timestamp_outside_retention_rows_count = 0; + protected $timestamp_outside_retention_rows_count = 0; /** * List of ImportFeatureValues operations running under a single EntityType * that are blocking this operation. diff --git a/AiPlatform/src/V1/ImportFeatureValuesRequest.php b/AiPlatform/src/V1/ImportFeatureValuesRequest.php index fd2ad8429e96..fc918281d7f3 100644 --- a/AiPlatform/src/V1/ImportFeatureValuesRequest.php +++ b/AiPlatform/src/V1/ImportFeatureValuesRequest.php @@ -23,14 +23,14 @@ class ImportFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_type = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $entity_type = ''; + protected $entity_type = ''; /** * Source column that holds entity IDs. If not provided, entity IDs are * extracted from the column named entity_id. * * Generated from protobuf field string entity_id_field = 5; */ - private $entity_id_field = ''; + protected $entity_id_field = ''; /** * Required. Specifications defining which Feature values to import from the * entity. The request fails if no feature_specs are provided, and having @@ -46,7 +46,7 @@ class ImportFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disable_online_serving = 9; */ - private $disable_online_serving = false; + protected $disable_online_serving = false; /** * Specifies the number of workers that are used to write data to the * Featurestore. Consider the online serving capacity that you require to @@ -57,13 +57,13 @@ class ImportFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 worker_count = 11; */ - private $worker_count = 0; + protected $worker_count = 0; /** * If true, API doesn't start ingestion analysis pipeline. * * Generated from protobuf field bool disable_ingestion_analysis = 12; */ - private $disable_ingestion_analysis = false; + protected $disable_ingestion_analysis = false; protected $source; protected $feature_time_source; diff --git a/AiPlatform/src/V1/ImportFeatureValuesRequest/FeatureSpec.php b/AiPlatform/src/V1/ImportFeatureValuesRequest/FeatureSpec.php index b414b4227d96..4febb13bcf4a 100644 --- a/AiPlatform/src/V1/ImportFeatureValuesRequest/FeatureSpec.php +++ b/AiPlatform/src/V1/ImportFeatureValuesRequest/FeatureSpec.php @@ -21,14 +21,14 @@ class FeatureSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $id = ''; + protected $id = ''; /** * Source column to get the Feature values from. If not set, uses the column * with the same name as the Feature ID. * * Generated from protobuf field string source_field = 2; */ - private $source_field = ''; + protected $source_field = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ImportFeatureValuesResponse.php b/AiPlatform/src/V1/ImportFeatureValuesResponse.php index 3c9295aca217..58c16ef19321 100644 --- a/AiPlatform/src/V1/ImportFeatureValuesResponse.php +++ b/AiPlatform/src/V1/ImportFeatureValuesResponse.php @@ -21,13 +21,13 @@ class ImportFeatureValuesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 imported_entity_count = 1; */ - private $imported_entity_count = 0; + protected $imported_entity_count = 0; /** * Number of Feature values that have been imported by the operation. * * Generated from protobuf field int64 imported_feature_value_count = 2; */ - private $imported_feature_value_count = 0; + protected $imported_feature_value_count = 0; /** * The number of rows in input source that weren't imported due to either * * Not having any featureValues. @@ -37,14 +37,14 @@ class ImportFeatureValuesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 invalid_row_count = 6; */ - private $invalid_row_count = 0; + protected $invalid_row_count = 0; /** * The number rows that weren't ingested due to having feature timestamps * outside the retention boundary. * * Generated from protobuf field int64 timestamp_outside_retention_rows_count = 4; */ - private $timestamp_outside_retention_rows_count = 0; + protected $timestamp_outside_retention_rows_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/ImportModelEvaluationRequest.php b/AiPlatform/src/V1/ImportModelEvaluationRequest.php index ebe9a73b6f93..ff11a54b2eed 100644 --- a/AiPlatform/src/V1/ImportModelEvaluationRequest.php +++ b/AiPlatform/src/V1/ImportModelEvaluationRequest.php @@ -22,13 +22,13 @@ class ImportModelEvaluationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. Model evaluation resource to be imported. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelEvaluation model_evaluation = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $model_evaluation = null; + protected $model_evaluation = null; /** * @param string $parent Required. The name of the parent model resource. diff --git a/AiPlatform/src/V1/Index.php b/AiPlatform/src/V1/Index.php index 4f9309683d70..0a0de2535d09 100644 --- a/AiPlatform/src/V1/Index.php +++ b/AiPlatform/src/V1/Index.php @@ -21,7 +21,7 @@ class Index extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The display name of the Index. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -29,13 +29,13 @@ class Index extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * The description of the Index. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Immutable. Points to a YAML file stored on Google Cloud Storage describing * additional information about the Index, that is specific to it. Unset if @@ -48,7 +48,7 @@ class Index extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metadata_schema_uri = 4 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $metadata_schema_uri = ''; + protected $metadata_schema_uri = ''; /** * An additional information about the Index; the schema of the metadata can * be found in @@ -56,7 +56,7 @@ class Index extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value metadata = 6; */ - private $metadata = null; + protected $metadata = null; /** * Output only. The pointers to DeployedIndexes created from this Index. * An Index can be only deleted if all its DeployedIndexes had been undeployed @@ -71,7 +71,7 @@ class Index extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 8; */ - private $etag = ''; + protected $etag = ''; /** * The labels with user-defined metadata to organize your Indexes. * Label keys and values can be no longer than 64 characters @@ -87,7 +87,7 @@ class Index extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Index was most recently updated. * This also includes any update to the contents of the Index. @@ -100,27 +100,27 @@ class Index extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp update_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. Stats of the index resource. * * Generated from protobuf field .google.cloud.aiplatform.v1.IndexStats index_stats = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $index_stats = null; + protected $index_stats = null; /** * Immutable. The update method to use with this Index. If not set, * BATCH_UPDATE will be used by default. * * Generated from protobuf field .google.cloud.aiplatform.v1.Index.IndexUpdateMethod index_update_method = 16 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $index_update_method = 0; + protected $index_update_method = 0; /** * Immutable. Customer-managed encryption key spec for an Index. If set, this * Index and all sub-resources of this Index will be secured by this key. * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 17 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/IndexDatapoint.php b/AiPlatform/src/V1/IndexDatapoint.php index b9a7ff2413f7..c9f76dc559b3 100644 --- a/AiPlatform/src/V1/IndexDatapoint.php +++ b/AiPlatform/src/V1/IndexDatapoint.php @@ -20,7 +20,7 @@ class IndexDatapoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string datapoint_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $datapoint_id = ''; + protected $datapoint_id = ''; /** * Required. Feature embedding vector for dense index. An array of numbers * with the length of [NearestNeighborSearchConfig.dimensions]. @@ -33,7 +33,7 @@ class IndexDatapoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.IndexDatapoint.SparseEmbedding sparse_embedding = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $sparse_embedding = null; + protected $sparse_embedding = null; /** * Optional. List of Restrict of the datapoint, used to perform "restricted * searches" where boolean rule are used to filter the subset of the database @@ -57,7 +57,7 @@ class IndexDatapoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.IndexDatapoint.CrowdingTag crowding_tag = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $crowding_tag = null; + protected $crowding_tag = null; /** * Constructor. diff --git a/AiPlatform/src/V1/IndexDatapoint/CrowdingTag.php b/AiPlatform/src/V1/IndexDatapoint/CrowdingTag.php index 5642d0a823fd..ea128677b462 100644 --- a/AiPlatform/src/V1/IndexDatapoint/CrowdingTag.php +++ b/AiPlatform/src/V1/IndexDatapoint/CrowdingTag.php @@ -26,7 +26,7 @@ class CrowdingTag extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string crowding_attribute = 1; */ - private $crowding_attribute = ''; + protected $crowding_attribute = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/IndexDatapoint/NumericRestriction.php b/AiPlatform/src/V1/IndexDatapoint/NumericRestriction.php index d2977f87663c..45ef5f001212 100644 --- a/AiPlatform/src/V1/IndexDatapoint/NumericRestriction.php +++ b/AiPlatform/src/V1/IndexDatapoint/NumericRestriction.php @@ -21,14 +21,14 @@ class NumericRestriction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string namespace = 1; */ - private $namespace = ''; + protected $namespace = ''; /** * This MUST be specified for queries and must NOT be specified for * datapoints. * * Generated from protobuf field .google.cloud.aiplatform.v1.IndexDatapoint.NumericRestriction.Operator op = 5; */ - private $op = 0; + protected $op = 0; protected $Value; /** diff --git a/AiPlatform/src/V1/IndexDatapoint/Restriction.php b/AiPlatform/src/V1/IndexDatapoint/Restriction.php index 72effa875d21..e7b03799b38b 100644 --- a/AiPlatform/src/V1/IndexDatapoint/Restriction.php +++ b/AiPlatform/src/V1/IndexDatapoint/Restriction.php @@ -21,7 +21,7 @@ class Restriction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string namespace = 1; */ - private $namespace = ''; + protected $namespace = ''; /** * The attributes to allow in this namespace. e.g.: 'red' * diff --git a/AiPlatform/src/V1/IndexEndpoint.php b/AiPlatform/src/V1/IndexEndpoint.php index b904c9d31ba3..4bdef3fded1e 100644 --- a/AiPlatform/src/V1/IndexEndpoint.php +++ b/AiPlatform/src/V1/IndexEndpoint.php @@ -21,7 +21,7 @@ class IndexEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The display name of the IndexEndpoint. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -29,13 +29,13 @@ class IndexEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * The description of the IndexEndpoint. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Output only. The indexes deployed in this endpoint. * @@ -48,7 +48,7 @@ class IndexEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 5; */ - private $etag = ''; + protected $etag = ''; /** * The labels with user-defined metadata to organize your IndexEndpoints. * Label keys and values can be no longer than 64 characters @@ -64,7 +64,7 @@ class IndexEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this IndexEndpoint was last updated. * This timestamp is not updated when the endpoint's DeployedIndexes are @@ -73,7 +73,7 @@ class IndexEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. The full name of the Google Compute Engine * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) @@ -90,7 +90,7 @@ class IndexEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $network = ''; + protected $network = ''; /** * Optional. Deprecated: If true, expose the IndexEndpoint via private service * connect. @@ -111,14 +111,14 @@ class IndexEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PrivateServiceConnectConfig private_service_connect_config = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $private_service_connect_config = null; + protected $private_service_connect_config = null; /** * Optional. If true, the deployed index will be accessible through public * endpoint. * * Generated from protobuf field bool public_endpoint_enabled = 13 [(.google.api.field_behavior) = OPTIONAL]; */ - private $public_endpoint_enabled = false; + protected $public_endpoint_enabled = false; /** * Output only. If * [public_endpoint_enabled][google.cloud.aiplatform.v1.IndexEndpoint.public_endpoint_enabled] @@ -127,7 +127,7 @@ class IndexEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string public_endpoint_domain_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $public_endpoint_domain_name = ''; + protected $public_endpoint_domain_name = ''; /** * Immutable. Customer-managed encryption key spec for an IndexEndpoint. If * set, this IndexEndpoint and all sub-resources of this IndexEndpoint will be @@ -135,7 +135,7 @@ class IndexEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 15 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/IndexEndpointServiceClient.php b/AiPlatform/src/V1/IndexEndpointServiceClient.php deleted file mode 100644 index 175b0f0ce889..000000000000 --- a/AiPlatform/src/V1/IndexEndpointServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.IndexEndpointService/CreateIndexEndpoint', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets an IndexEndpoint. - * @param \Google\Cloud\AIPlatform\V1\GetIndexEndpointRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetIndexEndpoint(\Google\Cloud\AIPlatform\V1\GetIndexEndpointRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexEndpointService/GetIndexEndpoint', - $argument, - ['\Google\Cloud\AIPlatform\V1\IndexEndpoint', 'decode'], - $metadata, $options); - } - - /** - * Lists IndexEndpoints in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListIndexEndpointsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListIndexEndpoints(\Google\Cloud\AIPlatform\V1\ListIndexEndpointsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexEndpointService/ListIndexEndpoints', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListIndexEndpointsResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates an IndexEndpoint. - * @param \Google\Cloud\AIPlatform\V1\UpdateIndexEndpointRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateIndexEndpoint(\Google\Cloud\AIPlatform\V1\UpdateIndexEndpointRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexEndpointService/UpdateIndexEndpoint', - $argument, - ['\Google\Cloud\AIPlatform\V1\IndexEndpoint', 'decode'], - $metadata, $options); - } - - /** - * Deletes an IndexEndpoint. - * @param \Google\Cloud\AIPlatform\V1\DeleteIndexEndpointRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteIndexEndpoint(\Google\Cloud\AIPlatform\V1\DeleteIndexEndpointRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexEndpointService/DeleteIndexEndpoint', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deploys an Index into this IndexEndpoint, creating a DeployedIndex within - * it. - * Only non-empty Indexes can be deployed. - * @param \Google\Cloud\AIPlatform\V1\DeployIndexRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeployIndex(\Google\Cloud\AIPlatform\V1\DeployIndexRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexEndpointService/DeployIndex', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it, - * and freeing all resources it's using. - * @param \Google\Cloud\AIPlatform\V1\UndeployIndexRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UndeployIndex(\Google\Cloud\AIPlatform\V1\UndeployIndexRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexEndpointService/UndeployIndex', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Update an existing DeployedIndex under an IndexEndpoint. - * @param \Google\Cloud\AIPlatform\V1\MutateDeployedIndexRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function MutateDeployedIndex(\Google\Cloud\AIPlatform\V1\MutateDeployedIndexRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexEndpointService/MutateDeployedIndex', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/IndexPrivateEndpoints.php b/AiPlatform/src/V1/IndexPrivateEndpoints.php index 2dac805f5bc9..131e84feb92f 100644 --- a/AiPlatform/src/V1/IndexPrivateEndpoints.php +++ b/AiPlatform/src/V1/IndexPrivateEndpoints.php @@ -24,14 +24,14 @@ class IndexPrivateEndpoints extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string match_grpc_address = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $match_grpc_address = ''; + protected $match_grpc_address = ''; /** * Output only. The name of the service attachment resource. Populated if * private service connect is enabled. * * Generated from protobuf field string service_attachment = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $service_attachment = ''; + protected $service_attachment = ''; /** * Output only. PscAutomatedEndpoints is populated if private service connect * is enabled if PscAutomatedConfig is set. diff --git a/AiPlatform/src/V1/IndexServiceClient.php b/AiPlatform/src/V1/IndexServiceClient.php deleted file mode 100644 index 92cab9947cd0..000000000000 --- a/AiPlatform/src/V1/IndexServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.IndexService/CreateIndex', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets an Index. - * @param \Google\Cloud\AIPlatform\V1\GetIndexRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetIndex(\Google\Cloud\AIPlatform\V1\GetIndexRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexService/GetIndex', - $argument, - ['\Google\Cloud\AIPlatform\V1\Index', 'decode'], - $metadata, $options); - } - - /** - * Lists Indexes in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListIndexesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListIndexes(\Google\Cloud\AIPlatform\V1\ListIndexesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexService/ListIndexes', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListIndexesResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates an Index. - * @param \Google\Cloud\AIPlatform\V1\UpdateIndexRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateIndex(\Google\Cloud\AIPlatform\V1\UpdateIndexRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexService/UpdateIndex', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes an Index. - * An Index can only be deleted when all its - * [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had - * been undeployed. - * @param \Google\Cloud\AIPlatform\V1\DeleteIndexRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteIndex(\Google\Cloud\AIPlatform\V1\DeleteIndexRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexService/DeleteIndex', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Add/update Datapoints into an Index. - * @param \Google\Cloud\AIPlatform\V1\UpsertDatapointsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpsertDatapoints(\Google\Cloud\AIPlatform\V1\UpsertDatapointsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexService/UpsertDatapoints', - $argument, - ['\Google\Cloud\AIPlatform\V1\UpsertDatapointsResponse', 'decode'], - $metadata, $options); - } - - /** - * Remove Datapoints from an Index. - * @param \Google\Cloud\AIPlatform\V1\RemoveDatapointsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function RemoveDatapoints(\Google\Cloud\AIPlatform\V1\RemoveDatapointsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.IndexService/RemoveDatapoints', - $argument, - ['\Google\Cloud\AIPlatform\V1\RemoveDatapointsResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/IndexStats.php b/AiPlatform/src/V1/IndexStats.php index b7f8ffbcf5b4..c2a31be9f80a 100644 --- a/AiPlatform/src/V1/IndexStats.php +++ b/AiPlatform/src/V1/IndexStats.php @@ -20,19 +20,19 @@ class IndexStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 vectors_count = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $vectors_count = 0; + protected $vectors_count = 0; /** * Output only. The number of sparse vectors in the Index. * * Generated from protobuf field int64 sparse_vectors_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $sparse_vectors_count = 0; + protected $sparse_vectors_count = 0; /** * Output only. The number of shards in the Index. * * Generated from protobuf field int32 shards_count = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $shards_count = 0; + protected $shards_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/InputDataConfig.php b/AiPlatform/src/V1/InputDataConfig.php index 810c5fec96ea..d29879a01bb4 100644 --- a/AiPlatform/src/V1/InputDataConfig.php +++ b/AiPlatform/src/V1/InputDataConfig.php @@ -27,7 +27,7 @@ class InputDataConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $dataset_id = ''; + protected $dataset_id = ''; /** * Applicable only to Datasets that have DataItems and Annotations. * A filter on Annotations of the Dataset. Only Annotations that both @@ -41,7 +41,7 @@ class InputDataConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotations_filter = 6; */ - private $annotations_filter = ''; + protected $annotations_filter = ''; /** * Applicable only to custom training with Datasets that have DataItems and * Annotations. @@ -66,7 +66,7 @@ class InputDataConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_schema_uri = 9; */ - private $annotation_schema_uri = ''; + protected $annotation_schema_uri = ''; /** * Only applicable to Datasets that have SavedQueries. * The ID of a SavedQuery (annotation set) under the Dataset specified by @@ -87,13 +87,13 @@ class InputDataConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string saved_query_id = 7; */ - private $saved_query_id = ''; + protected $saved_query_id = ''; /** * Whether to persist the ML use assignment to data item system labels. * * Generated from protobuf field bool persist_ml_use_assignment = 11; */ - private $persist_ml_use_assignment = false; + protected $persist_ml_use_assignment = false; protected $split; protected $destination; diff --git a/AiPlatform/src/V1/IntegratedGradientsAttribution.php b/AiPlatform/src/V1/IntegratedGradientsAttribution.php index 3dc9d064bfe4..c8c0c0d44ea1 100644 --- a/AiPlatform/src/V1/IntegratedGradientsAttribution.php +++ b/AiPlatform/src/V1/IntegratedGradientsAttribution.php @@ -25,7 +25,7 @@ class IntegratedGradientsAttribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 step_count = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $step_count = 0; + protected $step_count = 0; /** * Config for SmoothGrad approximation of gradients. * When enabled, the gradients are approximated by averaging the gradients @@ -35,7 +35,7 @@ class IntegratedGradientsAttribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.SmoothGradConfig smooth_grad_config = 2; */ - private $smooth_grad_config = null; + protected $smooth_grad_config = null; /** * Config for IG with blur baseline. * When enabled, a linear path from the maximally blurred image to the input @@ -45,7 +45,7 @@ class IntegratedGradientsAttribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.BlurBaselineConfig blur_baseline_config = 3; */ - private $blur_baseline_config = null; + protected $blur_baseline_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/JobServiceClient.php b/AiPlatform/src/V1/JobServiceClient.php deleted file mode 100644 index 08ff2eea05a6..000000000000 --- a/AiPlatform/src/V1/JobServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.JobService/CreateCustomJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\CustomJob', 'decode'], - $metadata, $options); - } - - /** - * Gets a CustomJob. - * @param \Google\Cloud\AIPlatform\V1\GetCustomJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetCustomJob(\Google\Cloud\AIPlatform\V1\GetCustomJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/GetCustomJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\CustomJob', 'decode'], - $metadata, $options); - } - - /** - * Lists CustomJobs in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListCustomJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListCustomJobs(\Google\Cloud\AIPlatform\V1\ListCustomJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/ListCustomJobs', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListCustomJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a CustomJob. - * @param \Google\Cloud\AIPlatform\V1\DeleteCustomJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteCustomJob(\Google\Cloud\AIPlatform\V1\DeleteCustomJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/DeleteCustomJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Cancels a CustomJob. - * Starts asynchronous cancellation on the CustomJob. The server - * makes a best effort to cancel the job, but success is not - * guaranteed. Clients can use - * [JobService.GetCustomJob][google.cloud.aiplatform.v1.JobService.GetCustomJob] - * or other methods to check whether the cancellation succeeded or whether the - * job completed despite cancellation. On successful cancellation, - * the CustomJob is not deleted; instead it becomes a job with - * a [CustomJob.error][google.cloud.aiplatform.v1.CustomJob.error] value with - * a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - * `Code.CANCELLED`, and - * [CustomJob.state][google.cloud.aiplatform.v1.CustomJob.state] is set to - * `CANCELLED`. - * @param \Google\Cloud\AIPlatform\V1\CancelCustomJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CancelCustomJob(\Google\Cloud\AIPlatform\V1\CancelCustomJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CancelCustomJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Creates a DataLabelingJob. - * @param \Google\Cloud\AIPlatform\V1\CreateDataLabelingJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateDataLabelingJob(\Google\Cloud\AIPlatform\V1\CreateDataLabelingJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CreateDataLabelingJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\DataLabelingJob', 'decode'], - $metadata, $options); - } - - /** - * Gets a DataLabelingJob. - * @param \Google\Cloud\AIPlatform\V1\GetDataLabelingJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetDataLabelingJob(\Google\Cloud\AIPlatform\V1\GetDataLabelingJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/GetDataLabelingJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\DataLabelingJob', 'decode'], - $metadata, $options); - } - - /** - * Lists DataLabelingJobs in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListDataLabelingJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListDataLabelingJobs(\Google\Cloud\AIPlatform\V1\ListDataLabelingJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/ListDataLabelingJobs', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListDataLabelingJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a DataLabelingJob. - * @param \Google\Cloud\AIPlatform\V1\DeleteDataLabelingJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteDataLabelingJob(\Google\Cloud\AIPlatform\V1\DeleteDataLabelingJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/DeleteDataLabelingJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Cancels a DataLabelingJob. Success of cancellation is not guaranteed. - * @param \Google\Cloud\AIPlatform\V1\CancelDataLabelingJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CancelDataLabelingJob(\Google\Cloud\AIPlatform\V1\CancelDataLabelingJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CancelDataLabelingJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Creates a HyperparameterTuningJob - * @param \Google\Cloud\AIPlatform\V1\CreateHyperparameterTuningJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateHyperparameterTuningJob(\Google\Cloud\AIPlatform\V1\CreateHyperparameterTuningJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CreateHyperparameterTuningJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\HyperparameterTuningJob', 'decode'], - $metadata, $options); - } - - /** - * Gets a HyperparameterTuningJob - * @param \Google\Cloud\AIPlatform\V1\GetHyperparameterTuningJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetHyperparameterTuningJob(\Google\Cloud\AIPlatform\V1\GetHyperparameterTuningJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/GetHyperparameterTuningJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\HyperparameterTuningJob', 'decode'], - $metadata, $options); - } - - /** - * Lists HyperparameterTuningJobs in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListHyperparameterTuningJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListHyperparameterTuningJobs(\Google\Cloud\AIPlatform\V1\ListHyperparameterTuningJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/ListHyperparameterTuningJobs', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListHyperparameterTuningJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a HyperparameterTuningJob. - * @param \Google\Cloud\AIPlatform\V1\DeleteHyperparameterTuningJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteHyperparameterTuningJob(\Google\Cloud\AIPlatform\V1\DeleteHyperparameterTuningJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/DeleteHyperparameterTuningJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Cancels a HyperparameterTuningJob. - * Starts asynchronous cancellation on the HyperparameterTuningJob. The server - * makes a best effort to cancel the job, but success is not - * guaranteed. Clients can use - * [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob] - * or other methods to check whether the cancellation succeeded or whether the - * job completed despite cancellation. On successful cancellation, - * the HyperparameterTuningJob is not deleted; instead it becomes a job with - * a - * [HyperparameterTuningJob.error][google.cloud.aiplatform.v1.HyperparameterTuningJob.error] - * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`, and - * [HyperparameterTuningJob.state][google.cloud.aiplatform.v1.HyperparameterTuningJob.state] - * is set to `CANCELLED`. - * @param \Google\Cloud\AIPlatform\V1\CancelHyperparameterTuningJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CancelHyperparameterTuningJob(\Google\Cloud\AIPlatform\V1\CancelHyperparameterTuningJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CancelHyperparameterTuningJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Creates a NasJob - * @param \Google\Cloud\AIPlatform\V1\CreateNasJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateNasJob(\Google\Cloud\AIPlatform\V1\CreateNasJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CreateNasJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\NasJob', 'decode'], - $metadata, $options); - } - - /** - * Gets a NasJob - * @param \Google\Cloud\AIPlatform\V1\GetNasJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetNasJob(\Google\Cloud\AIPlatform\V1\GetNasJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/GetNasJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\NasJob', 'decode'], - $metadata, $options); - } - - /** - * Lists NasJobs in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListNasJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListNasJobs(\Google\Cloud\AIPlatform\V1\ListNasJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/ListNasJobs', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListNasJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a NasJob. - * @param \Google\Cloud\AIPlatform\V1\DeleteNasJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteNasJob(\Google\Cloud\AIPlatform\V1\DeleteNasJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/DeleteNasJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Cancels a NasJob. - * Starts asynchronous cancellation on the NasJob. The server - * makes a best effort to cancel the job, but success is not - * guaranteed. Clients can use - * [JobService.GetNasJob][google.cloud.aiplatform.v1.JobService.GetNasJob] or - * other methods to check whether the cancellation succeeded or whether the - * job completed despite cancellation. On successful cancellation, - * the NasJob is not deleted; instead it becomes a job with - * a [NasJob.error][google.cloud.aiplatform.v1.NasJob.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - * `Code.CANCELLED`, and - * [NasJob.state][google.cloud.aiplatform.v1.NasJob.state] is set to - * `CANCELLED`. - * @param \Google\Cloud\AIPlatform\V1\CancelNasJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CancelNasJob(\Google\Cloud\AIPlatform\V1\CancelNasJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CancelNasJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Gets a NasTrialDetail. - * @param \Google\Cloud\AIPlatform\V1\GetNasTrialDetailRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetNasTrialDetail(\Google\Cloud\AIPlatform\V1\GetNasTrialDetailRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/GetNasTrialDetail', - $argument, - ['\Google\Cloud\AIPlatform\V1\NasTrialDetail', 'decode'], - $metadata, $options); - } - - /** - * List top NasTrialDetails of a NasJob. - * @param \Google\Cloud\AIPlatform\V1\ListNasTrialDetailsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListNasTrialDetails(\Google\Cloud\AIPlatform\V1\ListNasTrialDetailsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/ListNasTrialDetails', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListNasTrialDetailsResponse', 'decode'], - $metadata, $options); - } - - /** - * Creates a BatchPredictionJob. A BatchPredictionJob once created will - * right away be attempted to start. - * @param \Google\Cloud\AIPlatform\V1\CreateBatchPredictionJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateBatchPredictionJob(\Google\Cloud\AIPlatform\V1\CreateBatchPredictionJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CreateBatchPredictionJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\BatchPredictionJob', 'decode'], - $metadata, $options); - } - - /** - * Gets a BatchPredictionJob - * @param \Google\Cloud\AIPlatform\V1\GetBatchPredictionJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetBatchPredictionJob(\Google\Cloud\AIPlatform\V1\GetBatchPredictionJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/GetBatchPredictionJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\BatchPredictionJob', 'decode'], - $metadata, $options); - } - - /** - * Lists BatchPredictionJobs in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListBatchPredictionJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListBatchPredictionJobs(\Google\Cloud\AIPlatform\V1\ListBatchPredictionJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/ListBatchPredictionJobs', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListBatchPredictionJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a BatchPredictionJob. Can only be called on jobs that already - * finished. - * @param \Google\Cloud\AIPlatform\V1\DeleteBatchPredictionJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteBatchPredictionJob(\Google\Cloud\AIPlatform\V1\DeleteBatchPredictionJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/DeleteBatchPredictionJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Cancels a BatchPredictionJob. - * - * Starts asynchronous cancellation on the BatchPredictionJob. The server - * makes the best effort to cancel the job, but success is not - * guaranteed. Clients can use - * [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob] - * or other methods to check whether the cancellation succeeded or whether the - * job completed despite cancellation. On a successful cancellation, - * the BatchPredictionJob is not deleted;instead its - * [BatchPredictionJob.state][google.cloud.aiplatform.v1.BatchPredictionJob.state] - * is set to `CANCELLED`. Any files already outputted by the job are not - * deleted. - * @param \Google\Cloud\AIPlatform\V1\CancelBatchPredictionJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CancelBatchPredictionJob(\Google\Cloud\AIPlatform\V1\CancelBatchPredictionJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CancelBatchPredictionJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Creates a ModelDeploymentMonitoringJob. It will run periodically on a - * configured interval. - * @param \Google\Cloud\AIPlatform\V1\CreateModelDeploymentMonitoringJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateModelDeploymentMonitoringJob(\Google\Cloud\AIPlatform\V1\CreateModelDeploymentMonitoringJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/CreateModelDeploymentMonitoringJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob', 'decode'], - $metadata, $options); - } - - /** - * Searches Model Monitoring Statistics generated within a given time window. - * @param \Google\Cloud\AIPlatform\V1\SearchModelDeploymentMonitoringStatsAnomaliesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SearchModelDeploymentMonitoringStatsAnomalies(\Google\Cloud\AIPlatform\V1\SearchModelDeploymentMonitoringStatsAnomaliesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/SearchModelDeploymentMonitoringStatsAnomalies', - $argument, - ['\Google\Cloud\AIPlatform\V1\SearchModelDeploymentMonitoringStatsAnomaliesResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets a ModelDeploymentMonitoringJob. - * @param \Google\Cloud\AIPlatform\V1\GetModelDeploymentMonitoringJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetModelDeploymentMonitoringJob(\Google\Cloud\AIPlatform\V1\GetModelDeploymentMonitoringJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/GetModelDeploymentMonitoringJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob', 'decode'], - $metadata, $options); - } - - /** - * Lists ModelDeploymentMonitoringJobs in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListModelDeploymentMonitoringJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListModelDeploymentMonitoringJobs(\Google\Cloud\AIPlatform\V1\ListModelDeploymentMonitoringJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/ListModelDeploymentMonitoringJobs', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListModelDeploymentMonitoringJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates a ModelDeploymentMonitoringJob. - * @param \Google\Cloud\AIPlatform\V1\UpdateModelDeploymentMonitoringJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateModelDeploymentMonitoringJob(\Google\Cloud\AIPlatform\V1\UpdateModelDeploymentMonitoringJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/UpdateModelDeploymentMonitoringJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a ModelDeploymentMonitoringJob. - * @param \Google\Cloud\AIPlatform\V1\DeleteModelDeploymentMonitoringJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteModelDeploymentMonitoringJob(\Google\Cloud\AIPlatform\V1\DeleteModelDeploymentMonitoringJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/DeleteModelDeploymentMonitoringJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Pauses a ModelDeploymentMonitoringJob. If the job is running, the server - * makes a best effort to cancel the job. Will mark - * [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state] - * to 'PAUSED'. - * @param \Google\Cloud\AIPlatform\V1\PauseModelDeploymentMonitoringJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function PauseModelDeploymentMonitoringJob(\Google\Cloud\AIPlatform\V1\PauseModelDeploymentMonitoringJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/PauseModelDeploymentMonitoringJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Resumes a paused ModelDeploymentMonitoringJob. It will start to run from - * next scheduled time. A deleted ModelDeploymentMonitoringJob can't be - * resumed. - * @param \Google\Cloud\AIPlatform\V1\ResumeModelDeploymentMonitoringJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ResumeModelDeploymentMonitoringJob(\Google\Cloud\AIPlatform\V1\ResumeModelDeploymentMonitoringJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.JobService/ResumeModelDeploymentMonitoringJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/LargeModelReference.php b/AiPlatform/src/V1/LargeModelReference.php index c7ed2e13e5b2..bb7c3e5cdfc2 100644 --- a/AiPlatform/src/V1/LargeModelReference.php +++ b/AiPlatform/src/V1/LargeModelReference.php @@ -22,7 +22,7 @@ class LargeModelReference extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListAnnotationsRequest.php b/AiPlatform/src/V1/ListAnnotationsRequest.php index f3054b0d2f61..c3ff7ea1d4da 100644 --- a/AiPlatform/src/V1/ListAnnotationsRequest.php +++ b/AiPlatform/src/V1/ListAnnotationsRequest.php @@ -23,38 +23,38 @@ class ListAnnotationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the DataItem to list Annotations from. diff --git a/AiPlatform/src/V1/ListAnnotationsResponse.php b/AiPlatform/src/V1/ListAnnotationsResponse.php index f511ab3d1a96..9abd1cb010bc 100644 --- a/AiPlatform/src/V1/ListAnnotationsResponse.php +++ b/AiPlatform/src/V1/ListAnnotationsResponse.php @@ -27,7 +27,7 @@ class ListAnnotationsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListArtifactsRequest.php b/AiPlatform/src/V1/ListArtifactsRequest.php index 621d851b4c88..b1c90a5a6e5e 100644 --- a/AiPlatform/src/V1/ListArtifactsRequest.php +++ b/AiPlatform/src/V1/ListArtifactsRequest.php @@ -23,14 +23,14 @@ class ListArtifactsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of Artifacts to return. The service may return fewer. * Must be in range 1-1000, inclusive. Defaults to 100. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [MetadataService.ListArtifacts][google.cloud.aiplatform.v1.MetadataService.ListArtifacts] @@ -41,7 +41,7 @@ class ListArtifactsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * Filter specifying the boolean condition for the Artifacts to satisfy in * order to be part of the result set. @@ -74,7 +74,7 @@ class ListArtifactsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * How the list of messages is ordered. Specify the values to order by and an * ordering operation. The default sorting order is ascending. To specify @@ -85,7 +85,7 @@ class ListArtifactsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The MetadataStore whose Artifacts should be listed. diff --git a/AiPlatform/src/V1/ListArtifactsResponse.php b/AiPlatform/src/V1/ListArtifactsResponse.php index d12b8604cfde..0b4d5e33d9fe 100644 --- a/AiPlatform/src/V1/ListArtifactsResponse.php +++ b/AiPlatform/src/V1/ListArtifactsResponse.php @@ -30,7 +30,7 @@ class ListArtifactsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListBatchPredictionJobsRequest.php b/AiPlatform/src/V1/ListBatchPredictionJobsRequest.php index 9e9d70ac6fd8..6710f7b15a96 100644 --- a/AiPlatform/src/V1/ListBatchPredictionJobsRequest.php +++ b/AiPlatform/src/V1/ListBatchPredictionJobsRequest.php @@ -22,7 +22,7 @@ class ListBatchPredictionJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * Supported fields: @@ -44,13 +44,13 @@ class ListBatchPredictionJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -61,13 +61,13 @@ class ListBatchPredictionJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location to list the BatchPredictionJobs diff --git a/AiPlatform/src/V1/ListBatchPredictionJobsResponse.php b/AiPlatform/src/V1/ListBatchPredictionJobsResponse.php index 174625b3f376..1e489f66d63c 100644 --- a/AiPlatform/src/V1/ListBatchPredictionJobsResponse.php +++ b/AiPlatform/src/V1/ListBatchPredictionJobsResponse.php @@ -30,7 +30,7 @@ class ListBatchPredictionJobsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListContextsRequest.php b/AiPlatform/src/V1/ListContextsRequest.php index ba3be8907d03..25bb6027069d 100644 --- a/AiPlatform/src/V1/ListContextsRequest.php +++ b/AiPlatform/src/V1/ListContextsRequest.php @@ -23,14 +23,14 @@ class ListContextsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of Contexts to return. The service may return fewer. * Must be in range 1-1000, inclusive. Defaults to 100. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [MetadataService.ListContexts][google.cloud.aiplatform.v1.MetadataService.ListContexts] @@ -41,7 +41,7 @@ class ListContextsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * Filter specifying the boolean condition for the Contexts to satisfy in * order to be part of the result set. @@ -77,7 +77,7 @@ class ListContextsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * How the list of messages is ordered. Specify the values to order by and an * ordering operation. The default sorting order is ascending. To specify @@ -88,7 +88,7 @@ class ListContextsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The MetadataStore whose Contexts should be listed. diff --git a/AiPlatform/src/V1/ListContextsResponse.php b/AiPlatform/src/V1/ListContextsResponse.php index 30093458143c..eccc6f3c9a82 100644 --- a/AiPlatform/src/V1/ListContextsResponse.php +++ b/AiPlatform/src/V1/ListContextsResponse.php @@ -30,7 +30,7 @@ class ListContextsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListCustomJobsRequest.php b/AiPlatform/src/V1/ListCustomJobsRequest.php index 1269f5f4bd60..696cc01e4734 100644 --- a/AiPlatform/src/V1/ListCustomJobsRequest.php +++ b/AiPlatform/src/V1/ListCustomJobsRequest.php @@ -22,7 +22,7 @@ class ListCustomJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * Supported fields: @@ -43,13 +43,13 @@ class ListCustomJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -60,13 +60,13 @@ class ListCustomJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location to list the CustomJobs from. diff --git a/AiPlatform/src/V1/ListCustomJobsResponse.php b/AiPlatform/src/V1/ListCustomJobsResponse.php index 5b72a74c3575..c3ad64faafd1 100644 --- a/AiPlatform/src/V1/ListCustomJobsResponse.php +++ b/AiPlatform/src/V1/ListCustomJobsResponse.php @@ -30,7 +30,7 @@ class ListCustomJobsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListDataItemsRequest.php b/AiPlatform/src/V1/ListDataItemsRequest.php index 31e3536db8c6..ede1f6fd4e1b 100644 --- a/AiPlatform/src/V1/ListDataItemsRequest.php +++ b/AiPlatform/src/V1/ListDataItemsRequest.php @@ -23,38 +23,38 @@ class ListDataItemsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Dataset to list DataItems from. diff --git a/AiPlatform/src/V1/ListDataItemsResponse.php b/AiPlatform/src/V1/ListDataItemsResponse.php index 13960f8d33ff..95763e24473b 100644 --- a/AiPlatform/src/V1/ListDataItemsResponse.php +++ b/AiPlatform/src/V1/ListDataItemsResponse.php @@ -27,7 +27,7 @@ class ListDataItemsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListDataLabelingJobsRequest.php b/AiPlatform/src/V1/ListDataLabelingJobsRequest.php index 93b59f536c2d..9d4cdf335e1d 100644 --- a/AiPlatform/src/V1/ListDataLabelingJobsRequest.php +++ b/AiPlatform/src/V1/ListDataLabelingJobsRequest.php @@ -22,7 +22,7 @@ class ListDataLabelingJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * Supported fields: @@ -43,19 +43,19 @@ class ListDataLabelingJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. FieldMask represents a set of * symbolic field paths. For example, the mask can be `paths: "name"`. The @@ -64,7 +64,7 @@ class ListDataLabelingJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * A comma-separated list of fields to order by, sorted in ascending order by * default. @@ -72,7 +72,7 @@ class ListDataLabelingJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent of the DataLabelingJob. diff --git a/AiPlatform/src/V1/ListDataLabelingJobsResponse.php b/AiPlatform/src/V1/ListDataLabelingJobsResponse.php index f1dbef7abbe9..59c261630081 100644 --- a/AiPlatform/src/V1/ListDataLabelingJobsResponse.php +++ b/AiPlatform/src/V1/ListDataLabelingJobsResponse.php @@ -28,7 +28,7 @@ class ListDataLabelingJobsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListDatasetVersionsRequest.php b/AiPlatform/src/V1/ListDatasetVersionsRequest.php index 57a7f519d8cd..3247913749f1 100644 --- a/AiPlatform/src/V1/ListDatasetVersionsRequest.php +++ b/AiPlatform/src/V1/ListDatasetVersionsRequest.php @@ -23,38 +23,38 @@ class ListDatasetVersionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The standard list filter. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. The standard list page size. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. The standard list page token. * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $read_mask = null; + protected $read_mask = null; /** * Optional. A comma-separated list of fields to order by, sorted in ascending * order. Use "desc" after a field name for descending. * * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Dataset to list DatasetVersions from. diff --git a/AiPlatform/src/V1/ListDatasetVersionsResponse.php b/AiPlatform/src/V1/ListDatasetVersionsResponse.php index 86eadf42f22c..c4d05c89e077 100644 --- a/AiPlatform/src/V1/ListDatasetVersionsResponse.php +++ b/AiPlatform/src/V1/ListDatasetVersionsResponse.php @@ -27,7 +27,7 @@ class ListDatasetVersionsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListDatasetsRequest.php b/AiPlatform/src/V1/ListDatasetsRequest.php index ba642e9e8ed9..3b608ae945da 100644 --- a/AiPlatform/src/V1/ListDatasetsRequest.php +++ b/AiPlatform/src/V1/ListDatasetsRequest.php @@ -22,7 +22,7 @@ class ListDatasetsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * An expression for filtering the results of the request. For field names * both snake_case and camelCase are supported. @@ -38,25 +38,25 @@ class ListDatasetsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -67,7 +67,7 @@ class ListDatasetsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The name of the Dataset's parent resource. diff --git a/AiPlatform/src/V1/ListDatasetsResponse.php b/AiPlatform/src/V1/ListDatasetsResponse.php index eff204a65a2b..828c20173ecb 100644 --- a/AiPlatform/src/V1/ListDatasetsResponse.php +++ b/AiPlatform/src/V1/ListDatasetsResponse.php @@ -27,7 +27,7 @@ class ListDatasetsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListDeploymentResourcePoolsRequest.php b/AiPlatform/src/V1/ListDeploymentResourcePoolsRequest.php index ea69a84e533c..fe7f797512d2 100644 --- a/AiPlatform/src/V1/ListDeploymentResourcePoolsRequest.php +++ b/AiPlatform/src/V1/ListDeploymentResourcePoolsRequest.php @@ -21,14 +21,14 @@ class ListDeploymentResourcePoolsRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of DeploymentResourcePools to return. The service may * return fewer than this value. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous `ListDeploymentResourcePools` call. * Provide this to retrieve the subsequent page. @@ -38,7 +38,7 @@ class ListDeploymentResourcePoolsRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The parent Location which owns this collection of diff --git a/AiPlatform/src/V1/ListDeploymentResourcePoolsResponse.php b/AiPlatform/src/V1/ListDeploymentResourcePoolsResponse.php index fc7800f5bf0b..539a9052302c 100644 --- a/AiPlatform/src/V1/ListDeploymentResourcePoolsResponse.php +++ b/AiPlatform/src/V1/ListDeploymentResourcePoolsResponse.php @@ -27,7 +27,7 @@ class ListDeploymentResourcePoolsResponse extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListEndpointsRequest.php b/AiPlatform/src/V1/ListEndpointsRequest.php index 4fb300c50544..271a49eec2b7 100644 --- a/AiPlatform/src/V1/ListEndpointsRequest.php +++ b/AiPlatform/src/V1/ListEndpointsRequest.php @@ -22,7 +22,7 @@ class ListEndpointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. An expression for filtering the results of the request. For field * names both snake_case and camelCase are supported. @@ -43,13 +43,13 @@ class ListEndpointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. The standard list page size. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. The standard list page token. * Typically obtained via @@ -60,13 +60,13 @@ class ListEndpointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $read_mask = null; + protected $read_mask = null; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -78,7 +78,7 @@ class ListEndpointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Location from which to list the diff --git a/AiPlatform/src/V1/ListEndpointsResponse.php b/AiPlatform/src/V1/ListEndpointsResponse.php index 87d9beaa378e..a3e8abecd75a 100644 --- a/AiPlatform/src/V1/ListEndpointsResponse.php +++ b/AiPlatform/src/V1/ListEndpointsResponse.php @@ -30,7 +30,7 @@ class ListEndpointsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListEntityTypesRequest.php b/AiPlatform/src/V1/ListEntityTypesRequest.php index c66ae1a06e9d..baaa3458556d 100644 --- a/AiPlatform/src/V1/ListEntityTypesRequest.php +++ b/AiPlatform/src/V1/ListEntityTypesRequest.php @@ -23,7 +23,7 @@ class ListEntityTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the EntityTypes that match the filter expression. The following * filters are supported: @@ -43,7 +43,7 @@ class ListEntityTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of EntityTypes to return. The service may return fewer * than this value. If unspecified, at most 1000 EntityTypes will be returned. @@ -52,7 +52,7 @@ class ListEntityTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [FeaturestoreService.ListEntityTypes][google.cloud.aiplatform.v1.FeaturestoreService.ListEntityTypes] @@ -63,7 +63,7 @@ class ListEntityTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -74,13 +74,13 @@ class ListEntityTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 6; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Featurestore to list EntityTypes. diff --git a/AiPlatform/src/V1/ListEntityTypesResponse.php b/AiPlatform/src/V1/ListEntityTypesResponse.php index ac79064faa3c..220fc1f64254 100644 --- a/AiPlatform/src/V1/ListEntityTypesResponse.php +++ b/AiPlatform/src/V1/ListEntityTypesResponse.php @@ -30,7 +30,7 @@ class ListEntityTypesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListExecutionsRequest.php b/AiPlatform/src/V1/ListExecutionsRequest.php index 87f74efb6c5b..6f9f810f8c2c 100644 --- a/AiPlatform/src/V1/ListExecutionsRequest.php +++ b/AiPlatform/src/V1/ListExecutionsRequest.php @@ -23,14 +23,14 @@ class ListExecutionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of Executions to return. The service may return fewer. * Must be in range 1-1000, inclusive. Defaults to 100. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [MetadataService.ListExecutions][google.cloud.aiplatform.v1.MetadataService.ListExecutions] @@ -41,7 +41,7 @@ class ListExecutionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * Filter specifying the boolean condition for the Executions to satisfy in * order to be part of the result set. @@ -74,7 +74,7 @@ class ListExecutionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * How the list of messages is ordered. Specify the values to order by and an * ordering operation. The default sorting order is ascending. To specify @@ -85,7 +85,7 @@ class ListExecutionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The MetadataStore whose Executions should be listed. diff --git a/AiPlatform/src/V1/ListExecutionsResponse.php b/AiPlatform/src/V1/ListExecutionsResponse.php index 59a0f328c0cd..fb295ee5f854 100644 --- a/AiPlatform/src/V1/ListExecutionsResponse.php +++ b/AiPlatform/src/V1/ListExecutionsResponse.php @@ -30,7 +30,7 @@ class ListExecutionsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListFeatureGroupsRequest.php b/AiPlatform/src/V1/ListFeatureGroupsRequest.php index a0e8d3ca4475..6c8f374c84b4 100644 --- a/AiPlatform/src/V1/ListFeatureGroupsRequest.php +++ b/AiPlatform/src/V1/ListFeatureGroupsRequest.php @@ -23,7 +23,7 @@ class ListFeatureGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the FeatureGroups that match the filter expression. The * following fields are supported: @@ -42,7 +42,7 @@ class ListFeatureGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of FeatureGroups to return. The service may return * fewer than this value. If unspecified, at most 100 FeatureGroups will @@ -51,7 +51,7 @@ class ListFeatureGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [FeatureGroupAdminService.ListFeatureGroups][] call. @@ -62,7 +62,7 @@ class ListFeatureGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -72,7 +72,7 @@ class ListFeatureGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Location to list FeatureGroups. diff --git a/AiPlatform/src/V1/ListFeatureGroupsResponse.php b/AiPlatform/src/V1/ListFeatureGroupsResponse.php index 70cd21500da7..140860207117 100644 --- a/AiPlatform/src/V1/ListFeatureGroupsResponse.php +++ b/AiPlatform/src/V1/ListFeatureGroupsResponse.php @@ -30,7 +30,7 @@ class ListFeatureGroupsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListFeatureOnlineStoresRequest.php b/AiPlatform/src/V1/ListFeatureOnlineStoresRequest.php index 95119cc96d73..2559bd91a4a9 100644 --- a/AiPlatform/src/V1/ListFeatureOnlineStoresRequest.php +++ b/AiPlatform/src/V1/ListFeatureOnlineStoresRequest.php @@ -23,7 +23,7 @@ class ListFeatureOnlineStoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the FeatureOnlineStores that match the filter expression. The * following fields are supported: @@ -42,7 +42,7 @@ class ListFeatureOnlineStoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of FeatureOnlineStores to return. The service may return * fewer than this value. If unspecified, at most 100 FeatureOnlineStores will @@ -51,7 +51,7 @@ class ListFeatureOnlineStoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [FeatureOnlineStoreAdminService.ListFeatureOnlineStores][google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService.ListFeatureOnlineStores] @@ -62,7 +62,7 @@ class ListFeatureOnlineStoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -72,7 +72,7 @@ class ListFeatureOnlineStoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Location to list FeatureOnlineStores. diff --git a/AiPlatform/src/V1/ListFeatureOnlineStoresResponse.php b/AiPlatform/src/V1/ListFeatureOnlineStoresResponse.php index 16ff0903194d..95ce4983ad15 100644 --- a/AiPlatform/src/V1/ListFeatureOnlineStoresResponse.php +++ b/AiPlatform/src/V1/ListFeatureOnlineStoresResponse.php @@ -30,7 +30,7 @@ class ListFeatureOnlineStoresResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListFeatureViewSyncsRequest.php b/AiPlatform/src/V1/ListFeatureViewSyncsRequest.php index ba0f765d69b6..7e4345321d72 100644 --- a/AiPlatform/src/V1/ListFeatureViewSyncsRequest.php +++ b/AiPlatform/src/V1/ListFeatureViewSyncsRequest.php @@ -23,7 +23,7 @@ class ListFeatureViewSyncsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the FeatureViewSyncs that match the filter expression. The following * filters are supported: @@ -35,7 +35,7 @@ class ListFeatureViewSyncsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of FeatureViewSyncs to return. The service may return * fewer than this value. If unspecified, at most 1000 FeatureViewSyncs will @@ -44,7 +44,7 @@ class ListFeatureViewSyncsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [FeatureOnlineStoreAdminService.ListFeatureViewSyncs][google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService.ListFeatureViewSyncs] @@ -55,7 +55,7 @@ class ListFeatureViewSyncsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -64,7 +64,7 @@ class ListFeatureViewSyncsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the FeatureView to list FeatureViewSyncs. diff --git a/AiPlatform/src/V1/ListFeatureViewSyncsResponse.php b/AiPlatform/src/V1/ListFeatureViewSyncsResponse.php index 23ac5c02a9dc..7ba5b6764b79 100644 --- a/AiPlatform/src/V1/ListFeatureViewSyncsResponse.php +++ b/AiPlatform/src/V1/ListFeatureViewSyncsResponse.php @@ -30,7 +30,7 @@ class ListFeatureViewSyncsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListFeatureViewsRequest.php b/AiPlatform/src/V1/ListFeatureViewsRequest.php index 43c458596b8a..33afbac89980 100644 --- a/AiPlatform/src/V1/ListFeatureViewsRequest.php +++ b/AiPlatform/src/V1/ListFeatureViewsRequest.php @@ -23,7 +23,7 @@ class ListFeatureViewsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the FeatureViews that match the filter expression. The following * filters are supported: @@ -43,7 +43,7 @@ class ListFeatureViewsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of FeatureViews to return. The service may return fewer * than this value. If unspecified, at most 1000 FeatureViews will be @@ -52,7 +52,7 @@ class ListFeatureViewsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [FeatureOnlineStoreAdminService.ListFeatureViews][google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService.ListFeatureViews] @@ -63,7 +63,7 @@ class ListFeatureViewsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -74,7 +74,7 @@ class ListFeatureViewsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the FeatureOnlineStore to list FeatureViews. diff --git a/AiPlatform/src/V1/ListFeatureViewsResponse.php b/AiPlatform/src/V1/ListFeatureViewsResponse.php index de303847ecf2..f5ebd5abf6d2 100644 --- a/AiPlatform/src/V1/ListFeatureViewsResponse.php +++ b/AiPlatform/src/V1/ListFeatureViewsResponse.php @@ -30,7 +30,7 @@ class ListFeatureViewsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListFeaturesRequest.php b/AiPlatform/src/V1/ListFeaturesRequest.php index 4d8bc2018b1b..490a50d7b340 100644 --- a/AiPlatform/src/V1/ListFeaturesRequest.php +++ b/AiPlatform/src/V1/ListFeaturesRequest.php @@ -27,7 +27,7 @@ class ListFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the Features that match the filter expression. The following * filters are supported: @@ -49,7 +49,7 @@ class ListFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of Features to return. The service may return fewer * than this value. If unspecified, at most 1000 Features will be returned. @@ -58,7 +58,7 @@ class ListFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [FeaturestoreService.ListFeatures][google.cloud.aiplatform.v1.FeaturestoreService.ListFeatures] @@ -73,7 +73,7 @@ class ListFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -85,13 +85,13 @@ class ListFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 6; */ - private $read_mask = null; + protected $read_mask = null; /** * Only applicable for Vertex AI Feature Store (Legacy). * If set, return the most recent @@ -103,7 +103,7 @@ class ListFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 latest_stats_count = 7; */ - private $latest_stats_count = 0; + protected $latest_stats_count = 0; /** * @param string $parent Required. The resource name of the Location to list Features. diff --git a/AiPlatform/src/V1/ListFeaturesResponse.php b/AiPlatform/src/V1/ListFeaturesResponse.php index ec4bb57e561e..9d96f5a79cb2 100644 --- a/AiPlatform/src/V1/ListFeaturesResponse.php +++ b/AiPlatform/src/V1/ListFeaturesResponse.php @@ -32,7 +32,7 @@ class ListFeaturesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListFeaturestoresRequest.php b/AiPlatform/src/V1/ListFeaturestoresRequest.php index a06a49fb2d66..0ebc6cb3fca8 100644 --- a/AiPlatform/src/V1/ListFeaturestoresRequest.php +++ b/AiPlatform/src/V1/ListFeaturestoresRequest.php @@ -23,7 +23,7 @@ class ListFeaturestoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the featurestores that match the filter expression. The following * fields are supported: @@ -44,7 +44,7 @@ class ListFeaturestoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of Featurestores to return. The service may return fewer * than this value. If unspecified, at most 100 Featurestores will be @@ -53,7 +53,7 @@ class ListFeaturestoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [FeaturestoreService.ListFeaturestores][google.cloud.aiplatform.v1.FeaturestoreService.ListFeaturestores] @@ -64,7 +64,7 @@ class ListFeaturestoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -75,13 +75,13 @@ class ListFeaturestoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 6; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location to list Featurestores. diff --git a/AiPlatform/src/V1/ListFeaturestoresResponse.php b/AiPlatform/src/V1/ListFeaturestoresResponse.php index 9a5a44e2ba10..6155e85bf8e6 100644 --- a/AiPlatform/src/V1/ListFeaturestoresResponse.php +++ b/AiPlatform/src/V1/ListFeaturestoresResponse.php @@ -30,7 +30,7 @@ class ListFeaturestoresResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListHyperparameterTuningJobsRequest.php b/AiPlatform/src/V1/ListHyperparameterTuningJobsRequest.php index 8c26d71968aa..ca20c21b3f03 100644 --- a/AiPlatform/src/V1/ListHyperparameterTuningJobsRequest.php +++ b/AiPlatform/src/V1/ListHyperparameterTuningJobsRequest.php @@ -23,7 +23,7 @@ class ListHyperparameterTuningJobsRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * Supported fields: @@ -44,13 +44,13 @@ class ListHyperparameterTuningJobsRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -61,13 +61,13 @@ class ListHyperparameterTuningJobsRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location to list the diff --git a/AiPlatform/src/V1/ListHyperparameterTuningJobsResponse.php b/AiPlatform/src/V1/ListHyperparameterTuningJobsResponse.php index cfb6557de66a..6b92b4ba1304 100644 --- a/AiPlatform/src/V1/ListHyperparameterTuningJobsResponse.php +++ b/AiPlatform/src/V1/ListHyperparameterTuningJobsResponse.php @@ -32,7 +32,7 @@ class ListHyperparameterTuningJobsResponse extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListIndexEndpointsRequest.php b/AiPlatform/src/V1/ListIndexEndpointsRequest.php index cf1eba455f5d..996c71ecd40b 100644 --- a/AiPlatform/src/V1/ListIndexEndpointsRequest.php +++ b/AiPlatform/src/V1/ListIndexEndpointsRequest.php @@ -22,7 +22,7 @@ class ListIndexEndpointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. An expression for filtering the results of the request. For field * names both snake_case and camelCase are supported. @@ -43,13 +43,13 @@ class ListIndexEndpointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. The standard list page size. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. The standard list page token. * Typically obtained via @@ -60,13 +60,13 @@ class ListIndexEndpointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location from which to list the diff --git a/AiPlatform/src/V1/ListIndexEndpointsResponse.php b/AiPlatform/src/V1/ListIndexEndpointsResponse.php index 53f952a9278b..e768008ab1eb 100644 --- a/AiPlatform/src/V1/ListIndexEndpointsResponse.php +++ b/AiPlatform/src/V1/ListIndexEndpointsResponse.php @@ -30,7 +30,7 @@ class ListIndexEndpointsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListIndexesRequest.php b/AiPlatform/src/V1/ListIndexesRequest.php index 502ab973281e..cacf96ea07dc 100644 --- a/AiPlatform/src/V1/ListIndexesRequest.php +++ b/AiPlatform/src/V1/ListIndexesRequest.php @@ -22,19 +22,19 @@ class ListIndexesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -45,13 +45,13 @@ class ListIndexesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location from which to list the Indexes. diff --git a/AiPlatform/src/V1/ListIndexesResponse.php b/AiPlatform/src/V1/ListIndexesResponse.php index a50d32d58503..1df79240c8bd 100644 --- a/AiPlatform/src/V1/ListIndexesResponse.php +++ b/AiPlatform/src/V1/ListIndexesResponse.php @@ -30,7 +30,7 @@ class ListIndexesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListMetadataSchemasRequest.php b/AiPlatform/src/V1/ListMetadataSchemasRequest.php index b52a142d097d..f17a07957711 100644 --- a/AiPlatform/src/V1/ListMetadataSchemasRequest.php +++ b/AiPlatform/src/V1/ListMetadataSchemasRequest.php @@ -23,7 +23,7 @@ class ListMetadataSchemasRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of MetadataSchemas to return. The service may return * fewer. @@ -31,7 +31,7 @@ class ListMetadataSchemasRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [MetadataService.ListMetadataSchemas][google.cloud.aiplatform.v1.MetadataService.ListMetadataSchemas] @@ -42,13 +42,13 @@ class ListMetadataSchemasRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A query to filter available MetadataSchemas for matching results. * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * @param string $parent Required. The MetadataStore whose MetadataSchemas should be listed. diff --git a/AiPlatform/src/V1/ListMetadataSchemasResponse.php b/AiPlatform/src/V1/ListMetadataSchemasResponse.php index 3b5f9fd4898d..73ab44293ac0 100644 --- a/AiPlatform/src/V1/ListMetadataSchemasResponse.php +++ b/AiPlatform/src/V1/ListMetadataSchemasResponse.php @@ -30,7 +30,7 @@ class ListMetadataSchemasResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListMetadataStoresRequest.php b/AiPlatform/src/V1/ListMetadataStoresRequest.php index 6a234e584cfa..68fe668ba489 100644 --- a/AiPlatform/src/V1/ListMetadataStoresRequest.php +++ b/AiPlatform/src/V1/ListMetadataStoresRequest.php @@ -23,7 +23,7 @@ class ListMetadataStoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of Metadata Stores to return. The service may return * fewer. @@ -31,7 +31,7 @@ class ListMetadataStoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [MetadataService.ListMetadataStores][google.cloud.aiplatform.v1.MetadataService.ListMetadataStores] @@ -42,7 +42,7 @@ class ListMetadataStoresRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The Location whose MetadataStores should be listed. diff --git a/AiPlatform/src/V1/ListMetadataStoresResponse.php b/AiPlatform/src/V1/ListMetadataStoresResponse.php index 4c5970bb11b6..b09999c6dfef 100644 --- a/AiPlatform/src/V1/ListMetadataStoresResponse.php +++ b/AiPlatform/src/V1/ListMetadataStoresResponse.php @@ -30,7 +30,7 @@ class ListMetadataStoresResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListModelDeploymentMonitoringJobsRequest.php b/AiPlatform/src/V1/ListModelDeploymentMonitoringJobsRequest.php index 45a984d9f7cc..dde5106d5eb3 100644 --- a/AiPlatform/src/V1/ListModelDeploymentMonitoringJobsRequest.php +++ b/AiPlatform/src/V1/ListModelDeploymentMonitoringJobsRequest.php @@ -22,7 +22,7 @@ class ListModelDeploymentMonitoringJobsRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * Supported fields: @@ -43,25 +43,25 @@ class ListModelDeploymentMonitoringJobsRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The parent of the ModelDeploymentMonitoringJob. diff --git a/AiPlatform/src/V1/ListModelDeploymentMonitoringJobsResponse.php b/AiPlatform/src/V1/ListModelDeploymentMonitoringJobsResponse.php index a6d29db4ae39..ebafb6d833cb 100644 --- a/AiPlatform/src/V1/ListModelDeploymentMonitoringJobsResponse.php +++ b/AiPlatform/src/V1/ListModelDeploymentMonitoringJobsResponse.php @@ -28,7 +28,7 @@ class ListModelDeploymentMonitoringJobsResponse extends \Google\Protobuf\Interna * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListModelEvaluationSlicesRequest.php b/AiPlatform/src/V1/ListModelEvaluationSlicesRequest.php index 9132e16f26b7..9d4076a63722 100644 --- a/AiPlatform/src/V1/ListModelEvaluationSlicesRequest.php +++ b/AiPlatform/src/V1/ListModelEvaluationSlicesRequest.php @@ -23,20 +23,20 @@ class ListModelEvaluationSlicesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * * `slice.dimension` - for =. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -47,13 +47,13 @@ class ListModelEvaluationSlicesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the ModelEvaluation to list the diff --git a/AiPlatform/src/V1/ListModelEvaluationSlicesResponse.php b/AiPlatform/src/V1/ListModelEvaluationSlicesResponse.php index 648d860ed1d0..8c6b0e67d4ce 100644 --- a/AiPlatform/src/V1/ListModelEvaluationSlicesResponse.php +++ b/AiPlatform/src/V1/ListModelEvaluationSlicesResponse.php @@ -30,7 +30,7 @@ class ListModelEvaluationSlicesResponse extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListModelEvaluationsRequest.php b/AiPlatform/src/V1/ListModelEvaluationsRequest.php index 487e56396ecc..03c93bbc4880 100644 --- a/AiPlatform/src/V1/ListModelEvaluationsRequest.php +++ b/AiPlatform/src/V1/ListModelEvaluationsRequest.php @@ -22,19 +22,19 @@ class ListModelEvaluationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -45,13 +45,13 @@ class ListModelEvaluationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Model to list the ModelEvaluations from. diff --git a/AiPlatform/src/V1/ListModelEvaluationsResponse.php b/AiPlatform/src/V1/ListModelEvaluationsResponse.php index f6ebe4ed5abf..f56b070f94aa 100644 --- a/AiPlatform/src/V1/ListModelEvaluationsResponse.php +++ b/AiPlatform/src/V1/ListModelEvaluationsResponse.php @@ -30,7 +30,7 @@ class ListModelEvaluationsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListModelVersionsRequest.php b/AiPlatform/src/V1/ListModelVersionsRequest.php index 995dfdfd8f6f..f771c48fb9b8 100644 --- a/AiPlatform/src/V1/ListModelVersionsRequest.php +++ b/AiPlatform/src/V1/ListModelVersionsRequest.php @@ -21,13 +21,13 @@ class ListModelVersionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -38,7 +38,7 @@ class ListModelVersionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * An expression for filtering the results of the request. For field names * both snake_case and camelCase are supported. @@ -51,13 +51,13 @@ class ListModelVersionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -68,7 +68,7 @@ class ListModelVersionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $name Required. The name of the model to list versions for. Please see diff --git a/AiPlatform/src/V1/ListModelVersionsResponse.php b/AiPlatform/src/V1/ListModelVersionsResponse.php index ac0f260796eb..d6b44c564956 100644 --- a/AiPlatform/src/V1/ListModelVersionsResponse.php +++ b/AiPlatform/src/V1/ListModelVersionsResponse.php @@ -32,7 +32,7 @@ class ListModelVersionsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListModelsRequest.php b/AiPlatform/src/V1/ListModelsRequest.php index eda98cea6f37..7e344117f587 100644 --- a/AiPlatform/src/V1/ListModelsRequest.php +++ b/AiPlatform/src/V1/ListModelsRequest.php @@ -22,7 +22,7 @@ class ListModelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * An expression for filtering the results of the request. For field names * both snake_case and camelCase are supported. @@ -43,13 +43,13 @@ class ListModelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -60,13 +60,13 @@ class ListModelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -78,7 +78,7 @@ class ListModelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Location to list the Models from. diff --git a/AiPlatform/src/V1/ListModelsResponse.php b/AiPlatform/src/V1/ListModelsResponse.php index b9d9eb21a4d3..720b6b2f9626 100644 --- a/AiPlatform/src/V1/ListModelsResponse.php +++ b/AiPlatform/src/V1/ListModelsResponse.php @@ -30,7 +30,7 @@ class ListModelsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListNasJobsRequest.php b/AiPlatform/src/V1/ListNasJobsRequest.php index 0d57730bd7c3..fdd689688f57 100644 --- a/AiPlatform/src/V1/ListNasJobsRequest.php +++ b/AiPlatform/src/V1/ListNasJobsRequest.php @@ -22,7 +22,7 @@ class ListNasJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * Supported fields: @@ -43,13 +43,13 @@ class ListNasJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -60,13 +60,13 @@ class ListNasJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location to list the NasJobs diff --git a/AiPlatform/src/V1/ListNasJobsResponse.php b/AiPlatform/src/V1/ListNasJobsResponse.php index c6316c1a0e1e..ab265d630589 100644 --- a/AiPlatform/src/V1/ListNasJobsResponse.php +++ b/AiPlatform/src/V1/ListNasJobsResponse.php @@ -32,7 +32,7 @@ class ListNasJobsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListNasTrialDetailsRequest.php b/AiPlatform/src/V1/ListNasTrialDetailsRequest.php index e9842485c457..9c359b2da77a 100644 --- a/AiPlatform/src/V1/ListNasTrialDetailsRequest.php +++ b/AiPlatform/src/V1/ListNasTrialDetailsRequest.php @@ -23,13 +23,13 @@ class ListNasTrialDetailsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -40,7 +40,7 @@ class ListNasTrialDetailsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The name of the NasJob resource. diff --git a/AiPlatform/src/V1/ListNasTrialDetailsResponse.php b/AiPlatform/src/V1/ListNasTrialDetailsResponse.php index 2d68f0675cf4..294a226ce5b4 100644 --- a/AiPlatform/src/V1/ListNasTrialDetailsResponse.php +++ b/AiPlatform/src/V1/ListNasTrialDetailsResponse.php @@ -30,7 +30,7 @@ class ListNasTrialDetailsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListNotebookRuntimeTemplatesRequest.php b/AiPlatform/src/V1/ListNotebookRuntimeTemplatesRequest.php index 7dda8027159c..f5275941d411 100644 --- a/AiPlatform/src/V1/ListNotebookRuntimeTemplatesRequest.php +++ b/AiPlatform/src/V1/ListNotebookRuntimeTemplatesRequest.php @@ -23,7 +23,7 @@ class ListNotebookRuntimeTemplatesRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. An expression for filtering the results of the request. For field * names both snake_case and camelCase are supported. @@ -46,13 +46,13 @@ class ListNotebookRuntimeTemplatesRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. The standard list page size. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. The standard list page token. * Typically obtained via @@ -63,13 +63,13 @@ class ListNotebookRuntimeTemplatesRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $read_mask = null; + protected $read_mask = null; /** * Optional. A comma-separated list of fields to order by, sorted in ascending * order. Use "desc" after a field name for descending. Supported fields: @@ -80,7 +80,7 @@ class ListNotebookRuntimeTemplatesRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Location from which to list the diff --git a/AiPlatform/src/V1/ListNotebookRuntimeTemplatesResponse.php b/AiPlatform/src/V1/ListNotebookRuntimeTemplatesResponse.php index f690b85986d4..f30439af2e68 100644 --- a/AiPlatform/src/V1/ListNotebookRuntimeTemplatesResponse.php +++ b/AiPlatform/src/V1/ListNotebookRuntimeTemplatesResponse.php @@ -30,7 +30,7 @@ class ListNotebookRuntimeTemplatesResponse extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListNotebookRuntimesRequest.php b/AiPlatform/src/V1/ListNotebookRuntimesRequest.php index 29adfbe0d756..cec4e1b4e2f4 100644 --- a/AiPlatform/src/V1/ListNotebookRuntimesRequest.php +++ b/AiPlatform/src/V1/ListNotebookRuntimesRequest.php @@ -23,7 +23,7 @@ class ListNotebookRuntimesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. An expression for filtering the results of the request. For field * names both snake_case and camelCase are supported. @@ -60,13 +60,13 @@ class ListNotebookRuntimesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. The standard list page size. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. The standard list page token. * Typically obtained via @@ -77,13 +77,13 @@ class ListNotebookRuntimesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $read_mask = null; + protected $read_mask = null; /** * Optional. A comma-separated list of fields to order by, sorted in ascending * order. Use "desc" after a field name for descending. Supported fields: @@ -94,7 +94,7 @@ class ListNotebookRuntimesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Location from which to list the diff --git a/AiPlatform/src/V1/ListNotebookRuntimesResponse.php b/AiPlatform/src/V1/ListNotebookRuntimesResponse.php index d7440957ada5..13758707a766 100644 --- a/AiPlatform/src/V1/ListNotebookRuntimesResponse.php +++ b/AiPlatform/src/V1/ListNotebookRuntimesResponse.php @@ -30,7 +30,7 @@ class ListNotebookRuntimesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListOptimalTrialsRequest.php b/AiPlatform/src/V1/ListOptimalTrialsRequest.php index 8b1d1e002357..683501228c3c 100644 --- a/AiPlatform/src/V1/ListOptimalTrialsRequest.php +++ b/AiPlatform/src/V1/ListOptimalTrialsRequest.php @@ -21,7 +21,7 @@ class ListOptimalTrialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * @param string $parent Required. The name of the Study that the optimal Trial belongs to. Please see diff --git a/AiPlatform/src/V1/ListPersistentResourcesRequest.php b/AiPlatform/src/V1/ListPersistentResourcesRequest.php index 90207195fb28..81721df1e016 100644 --- a/AiPlatform/src/V1/ListPersistentResourcesRequest.php +++ b/AiPlatform/src/V1/ListPersistentResourcesRequest.php @@ -21,13 +21,13 @@ class ListPersistentResourcesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The standard list page size. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. The standard list page token. * Typically obtained via @@ -36,7 +36,7 @@ class ListPersistentResourcesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The resource name of the Location to list the PersistentResources diff --git a/AiPlatform/src/V1/ListPersistentResourcesResponse.php b/AiPlatform/src/V1/ListPersistentResourcesResponse.php index 35b1dab685ff..c508d30e47ea 100644 --- a/AiPlatform/src/V1/ListPersistentResourcesResponse.php +++ b/AiPlatform/src/V1/ListPersistentResourcesResponse.php @@ -28,7 +28,7 @@ class ListPersistentResourcesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListPipelineJobsRequest.php b/AiPlatform/src/V1/ListPipelineJobsRequest.php index 39b8dd70bc2c..3e89144669e2 100644 --- a/AiPlatform/src/V1/ListPipelineJobsRequest.php +++ b/AiPlatform/src/V1/ListPipelineJobsRequest.php @@ -22,7 +22,7 @@ class ListPipelineJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the PipelineJobs that match the filter expression. The following * fields are supported: @@ -56,13 +56,13 @@ class ListPipelineJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -73,7 +73,7 @@ class ListPipelineJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * A comma-separated list of fields to order by. The default sort order is in * ascending order. Use "desc" after a field name for descending. You can have @@ -90,13 +90,13 @@ class ListPipelineJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 7; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location to list the PipelineJobs from. diff --git a/AiPlatform/src/V1/ListPipelineJobsResponse.php b/AiPlatform/src/V1/ListPipelineJobsResponse.php index 5e70b733b505..dd913a53fe77 100644 --- a/AiPlatform/src/V1/ListPipelineJobsResponse.php +++ b/AiPlatform/src/V1/ListPipelineJobsResponse.php @@ -30,7 +30,7 @@ class ListPipelineJobsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListSavedQueriesRequest.php b/AiPlatform/src/V1/ListSavedQueriesRequest.php index 93e387355e56..2466bccc9070 100644 --- a/AiPlatform/src/V1/ListSavedQueriesRequest.php +++ b/AiPlatform/src/V1/ListSavedQueriesRequest.php @@ -23,38 +23,38 @@ class ListSavedQueriesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Dataset to list SavedQueries from. diff --git a/AiPlatform/src/V1/ListSavedQueriesResponse.php b/AiPlatform/src/V1/ListSavedQueriesResponse.php index a36af19de02a..9b393cf9a39f 100644 --- a/AiPlatform/src/V1/ListSavedQueriesResponse.php +++ b/AiPlatform/src/V1/ListSavedQueriesResponse.php @@ -27,7 +27,7 @@ class ListSavedQueriesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListSchedulesRequest.php b/AiPlatform/src/V1/ListSchedulesRequest.php index 66fd32e24491..513918f86a85 100644 --- a/AiPlatform/src/V1/ListSchedulesRequest.php +++ b/AiPlatform/src/V1/ListSchedulesRequest.php @@ -22,7 +22,7 @@ class ListSchedulesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the Schedules that match the filter expression. The following * fields are supported: @@ -52,14 +52,14 @@ class ListSchedulesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * Default to 100 if not specified. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -70,7 +70,7 @@ class ListSchedulesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * A comma-separated list of fields to order by. The default sort order is in * ascending order. Use "desc" after a field name for descending. You can have @@ -88,7 +88,7 @@ class ListSchedulesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the Location to list the Schedules from. diff --git a/AiPlatform/src/V1/ListSchedulesResponse.php b/AiPlatform/src/V1/ListSchedulesResponse.php index d47a02d34a17..92f4aa408413 100644 --- a/AiPlatform/src/V1/ListSchedulesResponse.php +++ b/AiPlatform/src/V1/ListSchedulesResponse.php @@ -30,7 +30,7 @@ class ListSchedulesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListSpecialistPoolsRequest.php b/AiPlatform/src/V1/ListSpecialistPoolsRequest.php index 788216ed3fda..b9a7dbc4dd59 100644 --- a/AiPlatform/src/V1/ListSpecialistPoolsRequest.php +++ b/AiPlatform/src/V1/ListSpecialistPoolsRequest.php @@ -22,13 +22,13 @@ class ListSpecialistPoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained by @@ -39,13 +39,13 @@ class ListSpecialistPoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. FieldMask represents a set of * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 4; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The name of the SpecialistPool's parent resource. diff --git a/AiPlatform/src/V1/ListSpecialistPoolsResponse.php b/AiPlatform/src/V1/ListSpecialistPoolsResponse.php index 683aa7a69cbc..760707850d16 100644 --- a/AiPlatform/src/V1/ListSpecialistPoolsResponse.php +++ b/AiPlatform/src/V1/ListSpecialistPoolsResponse.php @@ -27,7 +27,7 @@ class ListSpecialistPoolsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListStudiesRequest.php b/AiPlatform/src/V1/ListStudiesRequest.php index e43ca560c6b7..9fb3f5c87f7b 100644 --- a/AiPlatform/src/V1/ListStudiesRequest.php +++ b/AiPlatform/src/V1/ListStudiesRequest.php @@ -22,21 +22,21 @@ class ListStudiesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. A page token to request the next page of results. * If unspecified, there are no subsequent pages. * * Generated from protobuf field string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The maximum number of studies to return per "page" of results. * If unspecified, service will pick an appropriate default. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * @param string $parent Required. The resource name of the Location to list the Study from. diff --git a/AiPlatform/src/V1/ListStudiesResponse.php b/AiPlatform/src/V1/ListStudiesResponse.php index c9762fbdf211..69ab58d22e25 100644 --- a/AiPlatform/src/V1/ListStudiesResponse.php +++ b/AiPlatform/src/V1/ListStudiesResponse.php @@ -29,7 +29,7 @@ class ListStudiesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListTensorboardExperimentsRequest.php b/AiPlatform/src/V1/ListTensorboardExperimentsRequest.php index e92ef63d0e6c..362b3155ce78 100644 --- a/AiPlatform/src/V1/ListTensorboardExperimentsRequest.php +++ b/AiPlatform/src/V1/ListTensorboardExperimentsRequest.php @@ -23,13 +23,13 @@ class ListTensorboardExperimentsRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the TensorboardExperiments that match the filter expression. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of TensorboardExperiments to return. The service may * return fewer than this value. If unspecified, at most 50 @@ -38,7 +38,7 @@ class ListTensorboardExperimentsRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [TensorboardService.ListTensorboardExperiments][google.cloud.aiplatform.v1.TensorboardService.ListTensorboardExperiments] @@ -49,19 +49,19 @@ class ListTensorboardExperimentsRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Field to use to sort the list. * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 6; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Tensorboard to list diff --git a/AiPlatform/src/V1/ListTensorboardExperimentsResponse.php b/AiPlatform/src/V1/ListTensorboardExperimentsResponse.php index 6033b60bf2cb..8b8efb44e061 100644 --- a/AiPlatform/src/V1/ListTensorboardExperimentsResponse.php +++ b/AiPlatform/src/V1/ListTensorboardExperimentsResponse.php @@ -30,7 +30,7 @@ class ListTensorboardExperimentsResponse extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListTensorboardRunsRequest.php b/AiPlatform/src/V1/ListTensorboardRunsRequest.php index 181d89d0d589..1b7286246405 100644 --- a/AiPlatform/src/V1/ListTensorboardRunsRequest.php +++ b/AiPlatform/src/V1/ListTensorboardRunsRequest.php @@ -23,13 +23,13 @@ class ListTensorboardRunsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the TensorboardRuns that match the filter expression. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of TensorboardRuns to return. The service may return * fewer than this value. If unspecified, at most 50 TensorboardRuns are @@ -38,7 +38,7 @@ class ListTensorboardRunsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [TensorboardService.ListTensorboardRuns][google.cloud.aiplatform.v1.TensorboardService.ListTensorboardRuns] @@ -49,19 +49,19 @@ class ListTensorboardRunsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Field to use to sort the list. * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 6; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the TensorboardExperiment to list diff --git a/AiPlatform/src/V1/ListTensorboardRunsResponse.php b/AiPlatform/src/V1/ListTensorboardRunsResponse.php index 7ab5a36d3cff..4632baab236f 100644 --- a/AiPlatform/src/V1/ListTensorboardRunsResponse.php +++ b/AiPlatform/src/V1/ListTensorboardRunsResponse.php @@ -30,7 +30,7 @@ class ListTensorboardRunsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListTensorboardTimeSeriesRequest.php b/AiPlatform/src/V1/ListTensorboardTimeSeriesRequest.php index 79e9273686f1..583acad13957 100644 --- a/AiPlatform/src/V1/ListTensorboardTimeSeriesRequest.php +++ b/AiPlatform/src/V1/ListTensorboardTimeSeriesRequest.php @@ -23,13 +23,13 @@ class ListTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the TensorboardTimeSeries that match the filter expression. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of TensorboardTimeSeries to return. The service may * return fewer than this value. If unspecified, at most 50 @@ -38,7 +38,7 @@ class ListTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [TensorboardService.ListTensorboardTimeSeries][google.cloud.aiplatform.v1.TensorboardService.ListTensorboardTimeSeries] @@ -49,19 +49,19 @@ class ListTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Field to use to sort the list. * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 6; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the TensorboardRun to list diff --git a/AiPlatform/src/V1/ListTensorboardTimeSeriesResponse.php b/AiPlatform/src/V1/ListTensorboardTimeSeriesResponse.php index b21be2e9d927..bdd00e2e1f1f 100644 --- a/AiPlatform/src/V1/ListTensorboardTimeSeriesResponse.php +++ b/AiPlatform/src/V1/ListTensorboardTimeSeriesResponse.php @@ -30,7 +30,7 @@ class ListTensorboardTimeSeriesResponse extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListTensorboardsRequest.php b/AiPlatform/src/V1/ListTensorboardsRequest.php index 8c06eaffe85f..4fc3b36ddff0 100644 --- a/AiPlatform/src/V1/ListTensorboardsRequest.php +++ b/AiPlatform/src/V1/ListTensorboardsRequest.php @@ -23,13 +23,13 @@ class ListTensorboardsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Lists the Tensorboards that match the filter expression. * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The maximum number of Tensorboards to return. The service may return * fewer than this value. If unspecified, at most 100 Tensorboards are @@ -38,7 +38,7 @@ class ListTensorboardsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [TensorboardService.ListTensorboards][google.cloud.aiplatform.v1.TensorboardService.ListTensorboards] @@ -49,19 +49,19 @@ class ListTensorboardsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Field to use to sort the list. * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 6; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location to list Tensorboards. diff --git a/AiPlatform/src/V1/ListTensorboardsResponse.php b/AiPlatform/src/V1/ListTensorboardsResponse.php index 0ccdc9b2517f..f60548d491aa 100644 --- a/AiPlatform/src/V1/ListTensorboardsResponse.php +++ b/AiPlatform/src/V1/ListTensorboardsResponse.php @@ -30,7 +30,7 @@ class ListTensorboardsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListTrainingPipelinesRequest.php b/AiPlatform/src/V1/ListTrainingPipelinesRequest.php index 6210554f9b8a..3ab5fd706618 100644 --- a/AiPlatform/src/V1/ListTrainingPipelinesRequest.php +++ b/AiPlatform/src/V1/ListTrainingPipelinesRequest.php @@ -22,7 +22,7 @@ class ListTrainingPipelinesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard list filter. * Supported fields: @@ -43,13 +43,13 @@ class ListTrainingPipelinesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2; */ - private $filter = ''; + protected $filter = ''; /** * The standard list page size. * * Generated from protobuf field int32 page_size = 3; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard list page token. * Typically obtained via @@ -60,13 +60,13 @@ class ListTrainingPipelinesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4; */ - private $page_token = ''; + protected $page_token = ''; /** * Mask specifying which fields to read. * * Generated from protobuf field .google.protobuf.FieldMask read_mask = 5; */ - private $read_mask = null; + protected $read_mask = null; /** * @param string $parent Required. The resource name of the Location to list the TrainingPipelines diff --git a/AiPlatform/src/V1/ListTrainingPipelinesResponse.php b/AiPlatform/src/V1/ListTrainingPipelinesResponse.php index 78942cd92d36..8839755a808e 100644 --- a/AiPlatform/src/V1/ListTrainingPipelinesResponse.php +++ b/AiPlatform/src/V1/ListTrainingPipelinesResponse.php @@ -30,7 +30,7 @@ class ListTrainingPipelinesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListTrialsRequest.php b/AiPlatform/src/V1/ListTrialsRequest.php index a9e6580bea97..991d2b46e8b7 100644 --- a/AiPlatform/src/V1/ListTrialsRequest.php +++ b/AiPlatform/src/V1/ListTrialsRequest.php @@ -22,21 +22,21 @@ class ListTrialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. A page token to request the next page of results. * If unspecified, there are no subsequent pages. * * Generated from protobuf field string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The number of Trials to retrieve per "page" of results. * If unspecified, the service will pick an appropriate default. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * @param string $parent Required. The resource name of the Study to list the Trial from. diff --git a/AiPlatform/src/V1/ListTrialsResponse.php b/AiPlatform/src/V1/ListTrialsResponse.php index 0670f300aeb8..b76287203d6e 100644 --- a/AiPlatform/src/V1/ListTrialsResponse.php +++ b/AiPlatform/src/V1/ListTrialsResponse.php @@ -29,7 +29,7 @@ class ListTrialsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ListTuningJobsRequest.php b/AiPlatform/src/V1/ListTuningJobsRequest.php index b1ae009ec515..b7be67692e82 100644 --- a/AiPlatform/src/V1/ListTuningJobsRequest.php +++ b/AiPlatform/src/V1/ListTuningJobsRequest.php @@ -22,19 +22,19 @@ class ListTuningJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The standard list filter. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. The standard list page size. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. The standard list page token. * Typically obtained via [ListTuningJob.next_page_token][] of the @@ -42,7 +42,7 @@ class ListTuningJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The resource name of the Location to list the TuningJobs from. diff --git a/AiPlatform/src/V1/ListTuningJobsResponse.php b/AiPlatform/src/V1/ListTuningJobsResponse.php index 2b72e8152c82..16c563e41ff9 100644 --- a/AiPlatform/src/V1/ListTuningJobsResponse.php +++ b/AiPlatform/src/V1/ListTuningJobsResponse.php @@ -30,7 +30,7 @@ class ListTuningJobsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/LlmUtilityServiceClient.php b/AiPlatform/src/V1/LlmUtilityServiceClient.php deleted file mode 100644 index 74e1a76a7384..000000000000 --- a/AiPlatform/src/V1/LlmUtilityServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The user-defined display name of the Study * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * @param string $parent Required. The resource name of the Location to get the Study from. diff --git a/AiPlatform/src/V1/MachineSpec.php b/AiPlatform/src/V1/MachineSpec.php index 33dfcf5267e6..f6b9d1df94ae 100644 --- a/AiPlatform/src/V1/MachineSpec.php +++ b/AiPlatform/src/V1/MachineSpec.php @@ -29,7 +29,7 @@ class MachineSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string machine_type = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $machine_type = ''; + protected $machine_type = ''; /** * Immutable. The type of accelerator(s) that may be attached to the machine * as per @@ -37,20 +37,20 @@ class MachineSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.AcceleratorType accelerator_type = 2 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $accelerator_type = 0; + protected $accelerator_type = 0; /** * The number of accelerators to attach to the machine. * * Generated from protobuf field int32 accelerator_count = 3; */ - private $accelerator_count = 0; + protected $accelerator_count = 0; /** * Immutable. The topology of the TPUs. Corresponds to the TPU topologies * available from GKE. (Example: tpu_topology: "2x2x1"). * * Generated from protobuf field string tpu_topology = 4 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $tpu_topology = ''; + protected $tpu_topology = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ManualBatchTuningParameters.php b/AiPlatform/src/V1/ManualBatchTuningParameters.php index 6e2a93062025..ff19c6170d1e 100644 --- a/AiPlatform/src/V1/ManualBatchTuningParameters.php +++ b/AiPlatform/src/V1/ManualBatchTuningParameters.php @@ -26,7 +26,7 @@ class ManualBatchTuningParameters extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 batch_size = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $batch_size = 0; + protected $batch_size = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/MatchServiceClient.php b/AiPlatform/src/V1/MatchServiceClient.php deleted file mode 100644 index 4992569bddf6..000000000000 --- a/AiPlatform/src/V1/MatchServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.MatchService/FindNeighbors', - $argument, - ['\Google\Cloud\AIPlatform\V1\FindNeighborsResponse', 'decode'], - $metadata, $options); - } - - /** - * Reads the datapoints/vectors of the given IDs. - * A maximum of 1000 datapoints can be retrieved in a batch. - * @param \Google\Cloud\AIPlatform\V1\ReadIndexDatapointsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ReadIndexDatapoints(\Google\Cloud\AIPlatform\V1\ReadIndexDatapointsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MatchService/ReadIndexDatapoints', - $argument, - ['\Google\Cloud\AIPlatform\V1\ReadIndexDatapointsResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/Measurement.php b/AiPlatform/src/V1/Measurement.php index 9f4ba27eeb49..93c78064b37e 100644 --- a/AiPlatform/src/V1/Measurement.php +++ b/AiPlatform/src/V1/Measurement.php @@ -23,14 +23,14 @@ class Measurement extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration elapsed_duration = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $elapsed_duration = null; + protected $elapsed_duration = null; /** * Output only. The number of steps the machine learning model has been * trained for. Must be non-negative. * * Generated from protobuf field int64 step_count = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $step_count = 0; + protected $step_count = 0; /** * Output only. A list of metrics got by evaluating the objective functions * using suggested Parameter values. diff --git a/AiPlatform/src/V1/Measurement/Metric.php b/AiPlatform/src/V1/Measurement/Metric.php index 0f2ed00b08f0..1c84661e385d 100644 --- a/AiPlatform/src/V1/Measurement/Metric.php +++ b/AiPlatform/src/V1/Measurement/Metric.php @@ -21,13 +21,13 @@ class Metric extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metric_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $metric_id = ''; + protected $metric_id = ''; /** * Output only. The value for this metric. * * Generated from protobuf field double value = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $value = 0.0; + protected $value = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/MergeVersionAliasesRequest.php b/AiPlatform/src/V1/MergeVersionAliasesRequest.php index 2648cd15baaf..958d603a1200 100644 --- a/AiPlatform/src/V1/MergeVersionAliasesRequest.php +++ b/AiPlatform/src/V1/MergeVersionAliasesRequest.php @@ -23,7 +23,7 @@ class MergeVersionAliasesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Required. The set of version aliases to merge. * The alias should be at most 128 characters, and match diff --git a/AiPlatform/src/V1/MetadataSchema.php b/AiPlatform/src/V1/MetadataSchema.php index 1b7f49004273..41c39f06ce23 100644 --- a/AiPlatform/src/V1/MetadataSchema.php +++ b/AiPlatform/src/V1/MetadataSchema.php @@ -20,7 +20,7 @@ class MetadataSchema extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * The version of the MetadataSchema. The version's format must match * the following regular expression: `^[0-9]+[.][0-9]+[.][0-9]+$`, which would @@ -28,7 +28,7 @@ class MetadataSchema extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string schema_version = 2; */ - private $schema_version = ''; + protected $schema_version = ''; /** * Required. The raw YAML string representation of the MetadataSchema. The * combination of [MetadataSchema.version] and the schema name given by @@ -39,26 +39,26 @@ class MetadataSchema extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string schema = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $schema = ''; + protected $schema = ''; /** * The type of the MetadataSchema. This is a property that identifies which * metadata types will use the MetadataSchema. * * Generated from protobuf field .google.cloud.aiplatform.v1.MetadataSchema.MetadataSchemaType schema_type = 4; */ - private $schema_type = 0; + protected $schema_type = 0; /** * Output only. Timestamp when this MetadataSchema was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Description of the Metadata Schema * * Generated from protobuf field string description = 6; */ - private $description = ''; + protected $description = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MetadataServiceClient.php b/AiPlatform/src/V1/MetadataServiceClient.php deleted file mode 100644 index 8d324f0f5ca3..000000000000 --- a/AiPlatform/src/V1/MetadataServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/CreateMetadataStore', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Retrieves a specific MetadataStore. - * @param \Google\Cloud\AIPlatform\V1\GetMetadataStoreRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetMetadataStore(\Google\Cloud\AIPlatform\V1\GetMetadataStoreRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/GetMetadataStore', - $argument, - ['\Google\Cloud\AIPlatform\V1\MetadataStore', 'decode'], - $metadata, $options); - } - - /** - * Lists MetadataStores for a Location. - * @param \Google\Cloud\AIPlatform\V1\ListMetadataStoresRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListMetadataStores(\Google\Cloud\AIPlatform\V1\ListMetadataStoresRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/ListMetadataStores', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListMetadataStoresResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single MetadataStore and all its child resources (Artifacts, - * Executions, and Contexts). - * @param \Google\Cloud\AIPlatform\V1\DeleteMetadataStoreRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteMetadataStore(\Google\Cloud\AIPlatform\V1\DeleteMetadataStoreRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/DeleteMetadataStore', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates an Artifact associated with a MetadataStore. - * @param \Google\Cloud\AIPlatform\V1\CreateArtifactRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateArtifact(\Google\Cloud\AIPlatform\V1\CreateArtifactRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/CreateArtifact', - $argument, - ['\Google\Cloud\AIPlatform\V1\Artifact', 'decode'], - $metadata, $options); - } - - /** - * Retrieves a specific Artifact. - * @param \Google\Cloud\AIPlatform\V1\GetArtifactRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetArtifact(\Google\Cloud\AIPlatform\V1\GetArtifactRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/GetArtifact', - $argument, - ['\Google\Cloud\AIPlatform\V1\Artifact', 'decode'], - $metadata, $options); - } - - /** - * Lists Artifacts in the MetadataStore. - * @param \Google\Cloud\AIPlatform\V1\ListArtifactsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListArtifacts(\Google\Cloud\AIPlatform\V1\ListArtifactsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/ListArtifacts', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListArtifactsResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates a stored Artifact. - * @param \Google\Cloud\AIPlatform\V1\UpdateArtifactRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateArtifact(\Google\Cloud\AIPlatform\V1\UpdateArtifactRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/UpdateArtifact', - $argument, - ['\Google\Cloud\AIPlatform\V1\Artifact', 'decode'], - $metadata, $options); - } - - /** - * Deletes an Artifact. - * @param \Google\Cloud\AIPlatform\V1\DeleteArtifactRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteArtifact(\Google\Cloud\AIPlatform\V1\DeleteArtifactRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/DeleteArtifact', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Purges Artifacts. - * @param \Google\Cloud\AIPlatform\V1\PurgeArtifactsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function PurgeArtifacts(\Google\Cloud\AIPlatform\V1\PurgeArtifactsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/PurgeArtifacts', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a Context associated with a MetadataStore. - * @param \Google\Cloud\AIPlatform\V1\CreateContextRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateContext(\Google\Cloud\AIPlatform\V1\CreateContextRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/CreateContext', - $argument, - ['\Google\Cloud\AIPlatform\V1\Context', 'decode'], - $metadata, $options); - } - - /** - * Retrieves a specific Context. - * @param \Google\Cloud\AIPlatform\V1\GetContextRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetContext(\Google\Cloud\AIPlatform\V1\GetContextRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/GetContext', - $argument, - ['\Google\Cloud\AIPlatform\V1\Context', 'decode'], - $metadata, $options); - } - - /** - * Lists Contexts on the MetadataStore. - * @param \Google\Cloud\AIPlatform\V1\ListContextsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListContexts(\Google\Cloud\AIPlatform\V1\ListContextsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/ListContexts', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListContextsResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates a stored Context. - * @param \Google\Cloud\AIPlatform\V1\UpdateContextRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateContext(\Google\Cloud\AIPlatform\V1\UpdateContextRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/UpdateContext', - $argument, - ['\Google\Cloud\AIPlatform\V1\Context', 'decode'], - $metadata, $options); - } - - /** - * Deletes a stored Context. - * @param \Google\Cloud\AIPlatform\V1\DeleteContextRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteContext(\Google\Cloud\AIPlatform\V1\DeleteContextRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/DeleteContext', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Purges Contexts. - * @param \Google\Cloud\AIPlatform\V1\PurgeContextsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function PurgeContexts(\Google\Cloud\AIPlatform\V1\PurgeContextsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/PurgeContexts', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Adds a set of Artifacts and Executions to a Context. If any of the - * Artifacts or Executions have already been added to a Context, they are - * simply skipped. - * @param \Google\Cloud\AIPlatform\V1\AddContextArtifactsAndExecutionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function AddContextArtifactsAndExecutions(\Google\Cloud\AIPlatform\V1\AddContextArtifactsAndExecutionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/AddContextArtifactsAndExecutions', - $argument, - ['\Google\Cloud\AIPlatform\V1\AddContextArtifactsAndExecutionsResponse', 'decode'], - $metadata, $options); - } - - /** - * Adds a set of Contexts as children to a parent Context. If any of the - * child Contexts have already been added to the parent Context, they are - * simply skipped. If this call would create a cycle or cause any Context to - * have more than 10 parents, the request will fail with an INVALID_ARGUMENT - * error. - * @param \Google\Cloud\AIPlatform\V1\AddContextChildrenRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function AddContextChildren(\Google\Cloud\AIPlatform\V1\AddContextChildrenRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/AddContextChildren', - $argument, - ['\Google\Cloud\AIPlatform\V1\AddContextChildrenResponse', 'decode'], - $metadata, $options); - } - - /** - * Remove a set of children contexts from a parent Context. If any of the - * child Contexts were NOT added to the parent Context, they are - * simply skipped. - * @param \Google\Cloud\AIPlatform\V1\RemoveContextChildrenRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function RemoveContextChildren(\Google\Cloud\AIPlatform\V1\RemoveContextChildrenRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/RemoveContextChildren', - $argument, - ['\Google\Cloud\AIPlatform\V1\RemoveContextChildrenResponse', 'decode'], - $metadata, $options); - } - - /** - * Retrieves Artifacts and Executions within the specified Context, connected - * by Event edges and returned as a LineageSubgraph. - * @param \Google\Cloud\AIPlatform\V1\QueryContextLineageSubgraphRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function QueryContextLineageSubgraph(\Google\Cloud\AIPlatform\V1\QueryContextLineageSubgraphRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/QueryContextLineageSubgraph', - $argument, - ['\Google\Cloud\AIPlatform\V1\LineageSubgraph', 'decode'], - $metadata, $options); - } - - /** - * Creates an Execution associated with a MetadataStore. - * @param \Google\Cloud\AIPlatform\V1\CreateExecutionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateExecution(\Google\Cloud\AIPlatform\V1\CreateExecutionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/CreateExecution', - $argument, - ['\Google\Cloud\AIPlatform\V1\Execution', 'decode'], - $metadata, $options); - } - - /** - * Retrieves a specific Execution. - * @param \Google\Cloud\AIPlatform\V1\GetExecutionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetExecution(\Google\Cloud\AIPlatform\V1\GetExecutionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/GetExecution', - $argument, - ['\Google\Cloud\AIPlatform\V1\Execution', 'decode'], - $metadata, $options); - } - - /** - * Lists Executions in the MetadataStore. - * @param \Google\Cloud\AIPlatform\V1\ListExecutionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListExecutions(\Google\Cloud\AIPlatform\V1\ListExecutionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/ListExecutions', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListExecutionsResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates a stored Execution. - * @param \Google\Cloud\AIPlatform\V1\UpdateExecutionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateExecution(\Google\Cloud\AIPlatform\V1\UpdateExecutionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/UpdateExecution', - $argument, - ['\Google\Cloud\AIPlatform\V1\Execution', 'decode'], - $metadata, $options); - } - - /** - * Deletes an Execution. - * @param \Google\Cloud\AIPlatform\V1\DeleteExecutionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteExecution(\Google\Cloud\AIPlatform\V1\DeleteExecutionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/DeleteExecution', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Purges Executions. - * @param \Google\Cloud\AIPlatform\V1\PurgeExecutionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function PurgeExecutions(\Google\Cloud\AIPlatform\V1\PurgeExecutionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/PurgeExecutions', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Adds Events to the specified Execution. An Event indicates whether an - * Artifact was used as an input or output for an Execution. If an Event - * already exists between the Execution and the Artifact, the Event is - * skipped. - * @param \Google\Cloud\AIPlatform\V1\AddExecutionEventsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function AddExecutionEvents(\Google\Cloud\AIPlatform\V1\AddExecutionEventsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/AddExecutionEvents', - $argument, - ['\Google\Cloud\AIPlatform\V1\AddExecutionEventsResponse', 'decode'], - $metadata, $options); - } - - /** - * Obtains the set of input and output Artifacts for this Execution, in the - * form of LineageSubgraph that also contains the Execution and connecting - * Events. - * @param \Google\Cloud\AIPlatform\V1\QueryExecutionInputsAndOutputsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function QueryExecutionInputsAndOutputs(\Google\Cloud\AIPlatform\V1\QueryExecutionInputsAndOutputsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/QueryExecutionInputsAndOutputs', - $argument, - ['\Google\Cloud\AIPlatform\V1\LineageSubgraph', 'decode'], - $metadata, $options); - } - - /** - * Creates a MetadataSchema. - * @param \Google\Cloud\AIPlatform\V1\CreateMetadataSchemaRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateMetadataSchema(\Google\Cloud\AIPlatform\V1\CreateMetadataSchemaRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/CreateMetadataSchema', - $argument, - ['\Google\Cloud\AIPlatform\V1\MetadataSchema', 'decode'], - $metadata, $options); - } - - /** - * Retrieves a specific MetadataSchema. - * @param \Google\Cloud\AIPlatform\V1\GetMetadataSchemaRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetMetadataSchema(\Google\Cloud\AIPlatform\V1\GetMetadataSchemaRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/GetMetadataSchema', - $argument, - ['\Google\Cloud\AIPlatform\V1\MetadataSchema', 'decode'], - $metadata, $options); - } - - /** - * Lists MetadataSchemas. - * @param \Google\Cloud\AIPlatform\V1\ListMetadataSchemasRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListMetadataSchemas(\Google\Cloud\AIPlatform\V1\ListMetadataSchemasRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/ListMetadataSchemas', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListMetadataSchemasResponse', 'decode'], - $metadata, $options); - } - - /** - * Retrieves lineage of an Artifact represented through Artifacts and - * Executions connected by Event edges and returned as a LineageSubgraph. - * @param \Google\Cloud\AIPlatform\V1\QueryArtifactLineageSubgraphRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function QueryArtifactLineageSubgraph(\Google\Cloud\AIPlatform\V1\QueryArtifactLineageSubgraphRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MetadataService/QueryArtifactLineageSubgraph', - $argument, - ['\Google\Cloud\AIPlatform\V1\LineageSubgraph', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/MetadataStore.php b/AiPlatform/src/V1/MetadataStore.php index acc0eb03c827..ce8202984911 100644 --- a/AiPlatform/src/V1/MetadataStore.php +++ b/AiPlatform/src/V1/MetadataStore.php @@ -21,19 +21,19 @@ class MetadataStore extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Timestamp when this MetadataStore was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this MetadataStore was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Customer-managed encryption key spec for a Metadata Store. If set, this * Metadata Store and all sub-resources of this Metadata Store are secured @@ -41,25 +41,25 @@ class MetadataStore extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 5; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Description of the MetadataStore. * * Generated from protobuf field string description = 6; */ - private $description = ''; + protected $description = ''; /** * Output only. State information of the MetadataStore. * * Generated from protobuf field .google.cloud.aiplatform.v1.MetadataStore.MetadataStoreState state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = null; + protected $state = null; /** * Optional. Dataplex integration settings. * * Generated from protobuf field .google.cloud.aiplatform.v1.MetadataStore.DataplexConfig dataplex_config = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $dataplex_config = null; + protected $dataplex_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/MetadataStore/DataplexConfig.php b/AiPlatform/src/V1/MetadataStore/DataplexConfig.php index 257f1ffc55d9..06f0186041b3 100644 --- a/AiPlatform/src/V1/MetadataStore/DataplexConfig.php +++ b/AiPlatform/src/V1/MetadataStore/DataplexConfig.php @@ -21,7 +21,7 @@ class DataplexConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enabled_pipelines_lineage = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $enabled_pipelines_lineage = false; + protected $enabled_pipelines_lineage = false; /** * Constructor. diff --git a/AiPlatform/src/V1/MetadataStore/MetadataStoreState.php b/AiPlatform/src/V1/MetadataStore/MetadataStoreState.php index 1ababdc75686..a2072f38541f 100644 --- a/AiPlatform/src/V1/MetadataStore/MetadataStoreState.php +++ b/AiPlatform/src/V1/MetadataStore/MetadataStoreState.php @@ -20,7 +20,7 @@ class MetadataStoreState extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 disk_utilization_bytes = 1; */ - private $disk_utilization_bytes = 0; + protected $disk_utilization_bytes = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/MigratableResource.php b/AiPlatform/src/V1/MigratableResource.php index bd52fdeadd97..7b8508066ca1 100644 --- a/AiPlatform/src/V1/MigratableResource.php +++ b/AiPlatform/src/V1/MigratableResource.php @@ -23,13 +23,13 @@ class MigratableResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp last_migrate_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $last_migrate_time = null; + protected $last_migrate_time = null; /** * Output only. Timestamp when this MigratableResource was last updated. * * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $last_update_time = null; + protected $last_update_time = null; protected $resource; /** diff --git a/AiPlatform/src/V1/MigratableResource/AutomlDataset.php b/AiPlatform/src/V1/MigratableResource/AutomlDataset.php index 25201375cfb2..36475a0fd84d 100644 --- a/AiPlatform/src/V1/MigratableResource/AutomlDataset.php +++ b/AiPlatform/src/V1/MigratableResource/AutomlDataset.php @@ -22,13 +22,13 @@ class AutomlDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1 [(.google.api.resource_reference) = { */ - private $dataset = ''; + protected $dataset = ''; /** * The Dataset's display name in automl.googleapis.com. * * Generated from protobuf field string dataset_display_name = 4; */ - private $dataset_display_name = ''; + protected $dataset_display_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MigratableResource/AutomlModel.php b/AiPlatform/src/V1/MigratableResource/AutomlModel.php index bcd3825adb4e..d3b9b2a5fb01 100644 --- a/AiPlatform/src/V1/MigratableResource/AutomlModel.php +++ b/AiPlatform/src/V1/MigratableResource/AutomlModel.php @@ -22,13 +22,13 @@ class AutomlModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 1 [(.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * The Model's display name in automl.googleapis.com. * * Generated from protobuf field string model_display_name = 3; */ - private $model_display_name = ''; + protected $model_display_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MigratableResource/DataLabelingDataset.php b/AiPlatform/src/V1/MigratableResource/DataLabelingDataset.php index ad441ebcfb45..ae3850d2ea9c 100644 --- a/AiPlatform/src/V1/MigratableResource/DataLabelingDataset.php +++ b/AiPlatform/src/V1/MigratableResource/DataLabelingDataset.php @@ -22,13 +22,13 @@ class DataLabelingDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1 [(.google.api.resource_reference) = { */ - private $dataset = ''; + protected $dataset = ''; /** * The Dataset's display name in datalabeling.googleapis.com. * * Generated from protobuf field string dataset_display_name = 4; */ - private $dataset_display_name = ''; + protected $dataset_display_name = ''; /** * The migratable AnnotatedDataset in datalabeling.googleapis.com belongs to * the data labeling Dataset. diff --git a/AiPlatform/src/V1/MigratableResource/DataLabelingDataset/DataLabelingAnnotatedDataset.php b/AiPlatform/src/V1/MigratableResource/DataLabelingDataset/DataLabelingAnnotatedDataset.php index c90cd5e798c8..d02e01052dc4 100644 --- a/AiPlatform/src/V1/MigratableResource/DataLabelingDataset/DataLabelingAnnotatedDataset.php +++ b/AiPlatform/src/V1/MigratableResource/DataLabelingDataset/DataLabelingAnnotatedDataset.php @@ -22,13 +22,13 @@ class DataLabelingAnnotatedDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotated_dataset = 1 [(.google.api.resource_reference) = { */ - private $annotated_dataset = ''; + protected $annotated_dataset = ''; /** * The AnnotatedDataset's display name in datalabeling.googleapis.com. * * Generated from protobuf field string annotated_dataset_display_name = 3; */ - private $annotated_dataset_display_name = ''; + protected $annotated_dataset_display_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MigratableResource/MlEngineModelVersion.php b/AiPlatform/src/V1/MigratableResource/MlEngineModelVersion.php index 31ba9c1c5d03..297e60465ee8 100644 --- a/AiPlatform/src/V1/MigratableResource/MlEngineModelVersion.php +++ b/AiPlatform/src/V1/MigratableResource/MlEngineModelVersion.php @@ -26,14 +26,14 @@ class MlEngineModelVersion extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1; */ - private $endpoint = ''; + protected $endpoint = ''; /** * Full resource name of ml engine model Version. * Format: `projects/{project}/models/{model}/versions/{version}`. * * Generated from protobuf field string version = 2 [(.google.api.resource_reference) = { */ - private $version = ''; + protected $version = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MigrateResourceRequest/MigrateAutomlDatasetConfig.php b/AiPlatform/src/V1/MigrateResourceRequest/MigrateAutomlDatasetConfig.php index a51df0ea6846..0ce35057fdb5 100644 --- a/AiPlatform/src/V1/MigrateResourceRequest/MigrateAutomlDatasetConfig.php +++ b/AiPlatform/src/V1/MigrateResourceRequest/MigrateAutomlDatasetConfig.php @@ -23,14 +23,14 @@ class MigrateAutomlDatasetConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $dataset = ''; + protected $dataset = ''; /** * Required. Display name of the Dataset in Vertex AI. * System will pick a display name if unspecified. * * Generated from protobuf field string dataset_display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $dataset_display_name = ''; + protected $dataset_display_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MigrateResourceRequest/MigrateAutomlModelConfig.php b/AiPlatform/src/V1/MigrateResourceRequest/MigrateAutomlModelConfig.php index 8be897a0ac23..3c8f77706805 100644 --- a/AiPlatform/src/V1/MigrateResourceRequest/MigrateAutomlModelConfig.php +++ b/AiPlatform/src/V1/MigrateResourceRequest/MigrateAutomlModelConfig.php @@ -22,14 +22,14 @@ class MigrateAutomlModelConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * Optional. Display name of the model in Vertex AI. * System will pick a display name if unspecified. * * Generated from protobuf field string model_display_name = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $model_display_name = ''; + protected $model_display_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MigrateResourceRequest/MigrateDataLabelingDatasetConfig.php b/AiPlatform/src/V1/MigrateResourceRequest/MigrateDataLabelingDatasetConfig.php index bdf4efd87d80..bb8dded07960 100644 --- a/AiPlatform/src/V1/MigrateResourceRequest/MigrateDataLabelingDatasetConfig.php +++ b/AiPlatform/src/V1/MigrateResourceRequest/MigrateDataLabelingDatasetConfig.php @@ -23,14 +23,14 @@ class MigrateDataLabelingDatasetConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $dataset = ''; + protected $dataset = ''; /** * Optional. Display name of the Dataset in Vertex AI. * System will pick a display name if unspecified. * * Generated from protobuf field string dataset_display_name = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $dataset_display_name = ''; + protected $dataset_display_name = ''; /** * Optional. Configs for migrating AnnotatedDataset in * datalabeling.googleapis.com to Vertex AI's SavedQuery. The specified diff --git a/AiPlatform/src/V1/MigrateResourceRequest/MigrateDataLabelingDatasetConfig/MigrateDataLabelingAnnotatedDatasetConfig.php b/AiPlatform/src/V1/MigrateResourceRequest/MigrateDataLabelingDatasetConfig/MigrateDataLabelingAnnotatedDatasetConfig.php index a8d9e922183c..65c0ab94ba3f 100644 --- a/AiPlatform/src/V1/MigrateResourceRequest/MigrateDataLabelingDatasetConfig/MigrateDataLabelingAnnotatedDatasetConfig.php +++ b/AiPlatform/src/V1/MigrateResourceRequest/MigrateDataLabelingDatasetConfig/MigrateDataLabelingAnnotatedDatasetConfig.php @@ -23,7 +23,7 @@ class MigrateDataLabelingAnnotatedDatasetConfig extends \Google\Protobuf\Interna * * Generated from protobuf field string annotated_dataset = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $annotated_dataset = ''; + protected $annotated_dataset = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MigrateResourceRequest/MigrateMlEngineModelVersionConfig.php b/AiPlatform/src/V1/MigrateResourceRequest/MigrateMlEngineModelVersionConfig.php index e2bc6bf34a33..6fa2c88ffce9 100644 --- a/AiPlatform/src/V1/MigrateResourceRequest/MigrateMlEngineModelVersionConfig.php +++ b/AiPlatform/src/V1/MigrateResourceRequest/MigrateMlEngineModelVersionConfig.php @@ -25,21 +25,21 @@ class MigrateMlEngineModelVersionConfig extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $endpoint = ''; + protected $endpoint = ''; /** * Required. Full resource name of ml engine model version. * Format: `projects/{project}/models/{model}/versions/{version}`. * * Generated from protobuf field string model_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $model_version = ''; + protected $model_version = ''; /** * Required. Display name of the model in Vertex AI. * System will pick a display name if unspecified. * * Generated from protobuf field string model_display_name = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $model_display_name = ''; + protected $model_display_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MigrateResourceResponse.php b/AiPlatform/src/V1/MigrateResourceResponse.php index 7687a7f3f575..97f7d57c49f5 100644 --- a/AiPlatform/src/V1/MigrateResourceResponse.php +++ b/AiPlatform/src/V1/MigrateResourceResponse.php @@ -21,7 +21,7 @@ class MigrateResourceResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.MigratableResource migratable_resource = 3; */ - private $migratable_resource = null; + protected $migratable_resource = null; protected $migrated_resource; /** diff --git a/AiPlatform/src/V1/MigrationServiceClient.php b/AiPlatform/src/V1/MigrationServiceClient.php deleted file mode 100644 index 7751ec698e0b..000000000000 --- a/AiPlatform/src/V1/MigrationServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.MigrationService/SearchMigratableResources', - $argument, - ['\Google\Cloud\AIPlatform\V1\SearchMigratableResourcesResponse', 'decode'], - $metadata, $options); - } - - /** - * Batch migrates resources from ml.googleapis.com, automl.googleapis.com, - * and datalabeling.googleapis.com to Vertex AI. - * @param \Google\Cloud\AIPlatform\V1\BatchMigrateResourcesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchMigrateResources(\Google\Cloud\AIPlatform\V1\BatchMigrateResourcesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.MigrationService/BatchMigrateResources', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/Model.php b/AiPlatform/src/V1/Model.php index cfce86f98294..84ea1501b636 100644 --- a/AiPlatform/src/V1/Model.php +++ b/AiPlatform/src/V1/Model.php @@ -20,7 +20,7 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. Immutable. The version ID of the model. * A new version is committed when a new model version is uploaded or @@ -29,7 +29,7 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version_id = 28 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $version_id = ''; + protected $version_id = ''; /** * User provided version aliases so that a model version can be referenced via * alias (i.e. @@ -49,13 +49,13 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp version_create_time = 31 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $version_create_time = null; + protected $version_create_time = null; /** * Output only. Timestamp when this version was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp version_update_time = 32 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $version_update_time = null; + protected $version_update_time = null; /** * Required. The display name of the Model. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -63,19 +63,19 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * The description of the Model. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * The description of this version. * * Generated from protobuf field string version_description = 30; */ - private $version_description = ''; + protected $version_description = ''; /** * The schemata that describe formats of the Model's predictions and * explanations as given and returned via @@ -85,7 +85,7 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PredictSchemata predict_schemata = 4; */ - private $predict_schemata = null; + protected $predict_schemata = null; /** * Immutable. Points to a YAML file stored on Google Cloud Storage describing * additional information about the Model, that is specific to it. Unset if @@ -100,7 +100,7 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metadata_schema_uri = 5 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $metadata_schema_uri = ''; + protected $metadata_schema_uri = ''; /** * Immutable. An additional information about the Model; the schema of the * metadata can be found in @@ -109,7 +109,7 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $metadata = null; + protected $metadata = null; /** * Output only. The formats in which this Model may be exported. If empty, * this Model is not available for export. @@ -123,14 +123,14 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string training_pipeline = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $training_pipeline = ''; + protected $training_pipeline = ''; /** * Optional. This field is populated if the model is produced by a pipeline * job. * * Generated from protobuf field string pipeline_job = 47 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $pipeline_job = ''; + protected $pipeline_job = ''; /** * Input only. The specification of the container that is to be used when * deploying this Model. The specification is ingested upon @@ -140,14 +140,14 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelContainerSpec container_spec = 9 [(.google.api.field_behavior) = INPUT_ONLY]; */ - private $container_spec = null; + protected $container_spec = null; /** * Immutable. The path to the directory containing the Model artifact and any * of its supporting files. Not required for AutoML Models. * * Generated from protobuf field string artifact_uri = 26 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $artifact_uri = ''; + protected $artifact_uri = ''; /** * Output only. When this Model is deployed, its prediction resources are * described by the `prediction_resources` field of the @@ -254,13 +254,13 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Model was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. The pointers to DeployedModels created from this Model. Note * that Model could have been deployed to Endpoints in different Locations. @@ -300,14 +300,14 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationSpec explanation_spec = 23; */ - private $explanation_spec = null; + protected $explanation_spec = null; /** * Used to perform consistent read-modify-write updates. If not set, a blind * "overwrite" update happens. * * Generated from protobuf field string etag = 16; */ - private $etag = ''; + protected $etag = ''; /** * The labels with user-defined metadata to organize your Models. * Label keys and values can be no longer than 64 characters @@ -325,14 +325,14 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Model.DataStats data_stats = 21; */ - private $data_stats = null; + protected $data_stats = null; /** * Customer-managed encryption key spec for a Model. If set, this * Model and all sub-resources of this Model will be secured by this key. * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 24; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Output only. Source of a model. It can either be automl training pipeline, * custom training pipeline, BigQuery ML, or saved and tuned from Genie or @@ -340,14 +340,14 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelSourceInfo model_source_info = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $model_source_info = null; + protected $model_source_info = null; /** * Output only. If this Model is a copy of another Model, this contains info * about the original. * * Generated from protobuf field .google.cloud.aiplatform.v1.Model.OriginalModelInfo original_model_info = 34 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $original_model_info = null; + protected $original_model_info = null; /** * Output only. The resource name of the Artifact that was created in * MetadataStore when creating the Model. The Artifact resource name pattern @@ -356,14 +356,14 @@ class Model extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metadata_artifact = 44 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $metadata_artifact = ''; + protected $metadata_artifact = ''; /** * Optional. User input field to specify the base model source. Currently it * only supports specifing the Model Garden models and Genie models. * * Generated from protobuf field .google.cloud.aiplatform.v1.Model.BaseModelSource base_model_source = 50 [(.google.api.field_behavior) = OPTIONAL]; */ - private $base_model_source = null; + protected $base_model_source = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Model/DataStats.php b/AiPlatform/src/V1/Model/DataStats.php index 64f3d41dd832..bd58d337083e 100644 --- a/AiPlatform/src/V1/Model/DataStats.php +++ b/AiPlatform/src/V1/Model/DataStats.php @@ -20,14 +20,14 @@ class DataStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 training_data_items_count = 1; */ - private $training_data_items_count = 0; + protected $training_data_items_count = 0; /** * Number of DataItems that were used for validating this Model during * training. * * Generated from protobuf field int64 validation_data_items_count = 2; */ - private $validation_data_items_count = 0; + protected $validation_data_items_count = 0; /** * Number of DataItems that were used for evaluating this Model. If the * Model is evaluated multiple times, this will be the number of test @@ -36,20 +36,20 @@ class DataStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 test_data_items_count = 3; */ - private $test_data_items_count = 0; + protected $test_data_items_count = 0; /** * Number of Annotations that are used for training this Model. * * Generated from protobuf field int64 training_annotations_count = 4; */ - private $training_annotations_count = 0; + protected $training_annotations_count = 0; /** * Number of Annotations that are used for validating this Model during * training. * * Generated from protobuf field int64 validation_annotations_count = 5; */ - private $validation_annotations_count = 0; + protected $validation_annotations_count = 0; /** * Number of Annotations that are used for evaluating this Model. If the * Model is evaluated multiple times, this will be the number of test @@ -58,7 +58,7 @@ class DataStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 test_annotations_count = 6; */ - private $test_annotations_count = 0; + protected $test_annotations_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/Model/ExportFormat.php b/AiPlatform/src/V1/Model/ExportFormat.php index ae1fec72a34f..cf148bf7fb6d 100644 --- a/AiPlatform/src/V1/Model/ExportFormat.php +++ b/AiPlatform/src/V1/Model/ExportFormat.php @@ -35,7 +35,7 @@ class ExportFormat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $id = ''; + protected $id = ''; /** * Output only. The content of this Model that may be exported. * diff --git a/AiPlatform/src/V1/Model/OriginalModelInfo.php b/AiPlatform/src/V1/Model/OriginalModelInfo.php index 33acdc896e1d..c8b7f4049818 100644 --- a/AiPlatform/src/V1/Model/OriginalModelInfo.php +++ b/AiPlatform/src/V1/Model/OriginalModelInfo.php @@ -22,7 +22,7 @@ class OriginalModelInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelContainerSpec.php b/AiPlatform/src/V1/ModelContainerSpec.php index 1ed2155a6eff..a588d2607da4 100644 --- a/AiPlatform/src/V1/ModelContainerSpec.php +++ b/AiPlatform/src/V1/ModelContainerSpec.php @@ -36,7 +36,7 @@ class ModelContainerSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string image_uri = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; */ - private $image_uri = ''; + protected $image_uri = ''; /** * Immutable. Specifies the command that runs when the container starts. This * overrides the container's @@ -194,7 +194,7 @@ class ModelContainerSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string predict_route = 6 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $predict_route = ''; + protected $predict_route = ''; /** * Immutable. HTTP path on the container to send health checks to. Vertex AI * intermittently sends GET requests to this path on the container's IP @@ -224,7 +224,7 @@ class ModelContainerSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string health_route = 7 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $health_route = ''; + protected $health_route = ''; /** * Immutable. List of ports to expose from the container. Vertex AI sends gRPC * prediction requests that it receives to the first port on this list. Vertex @@ -243,26 +243,26 @@ class ModelContainerSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration deployment_timeout = 10 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $deployment_timeout = null; + protected $deployment_timeout = null; /** * Immutable. The amount of the VM memory to reserve as the shared memory for * the model in megabytes. * * Generated from protobuf field int64 shared_memory_size_mb = 11 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $shared_memory_size_mb = 0; + protected $shared_memory_size_mb = 0; /** * Immutable. Specification for Kubernetes startup probe. * * Generated from protobuf field .google.cloud.aiplatform.v1.Probe startup_probe = 12 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $startup_probe = null; + protected $startup_probe = null; /** * Immutable. Specification for Kubernetes readiness probe. * * Generated from protobuf field .google.cloud.aiplatform.v1.Probe health_probe = 13 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $health_probe = null; + protected $health_probe = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelDeploymentMonitoringBigQueryTable.php b/AiPlatform/src/V1/ModelDeploymentMonitoringBigQueryTable.php index dc71f6b7bc76..18eb60eef093 100644 --- a/AiPlatform/src/V1/ModelDeploymentMonitoringBigQueryTable.php +++ b/AiPlatform/src/V1/ModelDeploymentMonitoringBigQueryTable.php @@ -21,13 +21,13 @@ class ModelDeploymentMonitoringBigQueryTable extends \Google\Protobuf\Internal\M * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelDeploymentMonitoringBigQueryTable.LogSource log_source = 1; */ - private $log_source = 0; + protected $log_source = 0; /** * The type of log. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelDeploymentMonitoringBigQueryTable.LogType log_type = 2; */ - private $log_type = 0; + protected $log_type = 0; /** * The created BigQuery table to store logs. Customer could do their own query * & analysis. Format: @@ -35,14 +35,14 @@ class ModelDeploymentMonitoringBigQueryTable extends \Google\Protobuf\Internal\M * * Generated from protobuf field string bigquery_table_path = 3; */ - private $bigquery_table_path = ''; + protected $bigquery_table_path = ''; /** * Output only. The schema version of the request/response logging BigQuery * table. Default to v1 if unset. * * Generated from protobuf field string request_response_logging_schema_version = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $request_response_logging_schema_version = ''; + protected $request_response_logging_schema_version = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelDeploymentMonitoringJob.php b/AiPlatform/src/V1/ModelDeploymentMonitoringJob.php index fd51b218aca6..1e74fba8d552 100644 --- a/AiPlatform/src/V1/ModelDeploymentMonitoringJob.php +++ b/AiPlatform/src/V1/ModelDeploymentMonitoringJob.php @@ -22,7 +22,7 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The user-defined name of the ModelDeploymentMonitoringJob. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -31,14 +31,14 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Required. Endpoint resource name. * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` * * Generated from protobuf field string endpoint = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Output only. The detailed state of the monitoring job. * When the job is still creating, the state will be 'PENDING'. @@ -48,19 +48,19 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.JobState state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Schedule state when the monitoring job is in Running state. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.MonitoringScheduleState schedule_state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $schedule_state = 0; + protected $schedule_state = 0; /** * Output only. Latest triggered monitoring pipeline metadata. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.LatestMonitoringPipelineMetadata latest_monitoring_pipeline_metadata = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $latest_monitoring_pipeline_metadata = null; + protected $latest_monitoring_pipeline_metadata = null; /** * Required. The config for monitoring objectives. This is a per DeployedModel * config. Each DeployedModel needs to be configured separately. @@ -73,19 +73,19 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelDeploymentMonitoringScheduleConfig model_deployment_monitoring_schedule_config = 7 [(.google.api.field_behavior) = REQUIRED]; */ - private $model_deployment_monitoring_schedule_config = null; + protected $model_deployment_monitoring_schedule_config = null; /** * Required. Sample Strategy for logging. * * Generated from protobuf field .google.cloud.aiplatform.v1.SamplingStrategy logging_sampling_strategy = 8 [(.google.api.field_behavior) = REQUIRED]; */ - private $logging_sampling_strategy = null; + protected $logging_sampling_strategy = null; /** * Alert config for model monitoring. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelMonitoringAlertConfig model_monitoring_alert_config = 15; */ - private $model_monitoring_alert_config = null; + protected $model_monitoring_alert_config = null; /** * YAML schema file uri describing the format of a single instance, * which are given to format this Endpoint's prediction (and explanation). @@ -94,7 +94,7 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string predict_instance_schema_uri = 9; */ - private $predict_instance_schema_uri = ''; + protected $predict_instance_schema_uri = ''; /** * Sample Predict instance, same format as * [PredictRequest.instances][google.cloud.aiplatform.v1.PredictRequest.instances], @@ -105,7 +105,7 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value sample_predict_instance = 19; */ - private $sample_predict_instance = null; + protected $sample_predict_instance = null; /** * YAML schema file uri describing the format of a single instance that you * want Tensorflow Data Validation (TFDV) to analyze. @@ -120,7 +120,7 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string analysis_instance_schema_uri = 16; */ - private $analysis_instance_schema_uri = ''; + protected $analysis_instance_schema_uri = ''; /** * Output only. The created bigquery tables for the job under customer * project. Customer could do their own query & analysis. There could be 4 log @@ -138,7 +138,7 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration log_ttl = 17; */ - private $log_ttl = null; + protected $log_ttl = null; /** * The labels with user-defined metadata to organize your * ModelDeploymentMonitoringJob. @@ -155,27 +155,27 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this ModelDeploymentMonitoringJob was updated * most recently. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. Timestamp when this monitoring pipeline will be scheduled to * run for the next round. * * Generated from protobuf field .google.protobuf.Timestamp next_schedule_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_schedule_time = null; + protected $next_schedule_time = null; /** * Stats anomalies base folder path. * * Generated from protobuf field .google.cloud.aiplatform.v1.GcsDestination stats_anomalies_base_directory = 20; */ - private $stats_anomalies_base_directory = null; + protected $stats_anomalies_base_directory = null; /** * Customer-managed encryption key spec for a ModelDeploymentMonitoringJob. If * set, this ModelDeploymentMonitoringJob and all sub-resources of this @@ -183,7 +183,7 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 21; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * If true, the scheduled monitoring pipeline logs are sent to * Google Cloud Logging, including pipeline status and anomalies detected. @@ -192,14 +192,14 @@ class ModelDeploymentMonitoringJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_monitoring_pipeline_logs = 22; */ - private $enable_monitoring_pipeline_logs = false; + protected $enable_monitoring_pipeline_logs = false; /** * Output only. Only populated when the job's state is `JOB_STATE_FAILED` or * `JOB_STATE_CANCELLED`. * * Generated from protobuf field .google.rpc.Status error = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelDeploymentMonitoringJob/LatestMonitoringPipelineMetadata.php b/AiPlatform/src/V1/ModelDeploymentMonitoringJob/LatestMonitoringPipelineMetadata.php index 73879ccbf61c..dc0013fe6fb2 100644 --- a/AiPlatform/src/V1/ModelDeploymentMonitoringJob/LatestMonitoringPipelineMetadata.php +++ b/AiPlatform/src/V1/ModelDeploymentMonitoringJob/LatestMonitoringPipelineMetadata.php @@ -21,13 +21,13 @@ class LatestMonitoringPipelineMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp run_time = 1; */ - private $run_time = null; + protected $run_time = null; /** * The status of the most recent monitoring pipeline. * * Generated from protobuf field .google.rpc.Status status = 2; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelDeploymentMonitoringObjectiveConfig.php b/AiPlatform/src/V1/ModelDeploymentMonitoringObjectiveConfig.php index a9150a24ab2d..b7a45633e0c1 100644 --- a/AiPlatform/src/V1/ModelDeploymentMonitoringObjectiveConfig.php +++ b/AiPlatform/src/V1/ModelDeploymentMonitoringObjectiveConfig.php @@ -21,13 +21,13 @@ class ModelDeploymentMonitoringObjectiveConfig extends \Google\Protobuf\Internal * * Generated from protobuf field string deployed_model_id = 1; */ - private $deployed_model_id = ''; + protected $deployed_model_id = ''; /** * The objective config of for the modelmonitoring job of this deployed model. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelMonitoringObjectiveConfig objective_config = 2; */ - private $objective_config = null; + protected $objective_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelDeploymentMonitoringScheduleConfig.php b/AiPlatform/src/V1/ModelDeploymentMonitoringScheduleConfig.php index c5caa03cc95f..6d211b7d9260 100644 --- a/AiPlatform/src/V1/ModelDeploymentMonitoringScheduleConfig.php +++ b/AiPlatform/src/V1/ModelDeploymentMonitoringScheduleConfig.php @@ -22,7 +22,7 @@ class ModelDeploymentMonitoringScheduleConfig extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.protobuf.Duration monitor_interval = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $monitor_interval = null; + protected $monitor_interval = null; /** * The time window of the prediction data being included in each prediction * dataset. This window specifies how long the data should be collected from @@ -35,7 +35,7 @@ class ModelDeploymentMonitoringScheduleConfig extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.protobuf.Duration monitor_window = 2; */ - private $monitor_window = null; + protected $monitor_window = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelEvaluation.php b/AiPlatform/src/V1/ModelEvaluation.php index 4b77948de81e..75535dee1223 100644 --- a/AiPlatform/src/V1/ModelEvaluation.php +++ b/AiPlatform/src/V1/ModelEvaluation.php @@ -21,13 +21,13 @@ class ModelEvaluation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * The display name of the ModelEvaluation. * * Generated from protobuf field string display_name = 10; */ - private $display_name = ''; + protected $display_name = ''; /** * Points to a YAML file stored on Google Cloud Storage describing the * [metrics][google.cloud.aiplatform.v1.ModelEvaluation.metrics] of this @@ -36,20 +36,20 @@ class ModelEvaluation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metrics_schema_uri = 2; */ - private $metrics_schema_uri = ''; + protected $metrics_schema_uri = ''; /** * Evaluation metrics of the Model. The schema of the metrics is stored in * [metrics_schema_uri][google.cloud.aiplatform.v1.ModelEvaluation.metrics_schema_uri] * * Generated from protobuf field .google.protobuf.Value metrics = 3; */ - private $metrics = null; + protected $metrics = null; /** * Output only. Timestamp when this ModelEvaluation was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * All possible * [dimensions][google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice.dimension] @@ -71,7 +71,7 @@ class ModelEvaluation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string data_item_schema_uri = 6; */ - private $data_item_schema_uri = ''; + protected $data_item_schema_uri = ''; /** * Points to a YAML file stored on Google Cloud Storage describing * [EvaluatedDataItemView.predictions][], @@ -86,7 +86,7 @@ class ModelEvaluation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_schema_uri = 7; */ - private $annotation_schema_uri = ''; + protected $annotation_schema_uri = ''; /** * Aggregated explanation metrics for the Model's prediction output over the * data this ModelEvaluation uses. This field is populated only if the Model @@ -94,7 +94,7 @@ class ModelEvaluation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelExplanation model_explanation = 8; */ - private $model_explanation = null; + protected $model_explanation = null; /** * Describes the values of * [ExplanationSpec][google.cloud.aiplatform.v1.ExplanationSpec] that are used @@ -111,7 +111,7 @@ class ModelEvaluation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value metadata = 11; */ - private $metadata = null; + protected $metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelEvaluation/ModelEvaluationExplanationSpec.php b/AiPlatform/src/V1/ModelEvaluation/ModelEvaluationExplanationSpec.php index a5df2982ed0f..0a0c01d92107 100644 --- a/AiPlatform/src/V1/ModelEvaluation/ModelEvaluationExplanationSpec.php +++ b/AiPlatform/src/V1/ModelEvaluation/ModelEvaluationExplanationSpec.php @@ -21,13 +21,13 @@ class ModelEvaluationExplanationSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string explanation_type = 1; */ - private $explanation_type = ''; + protected $explanation_type = ''; /** * Explanation spec details. * * Generated from protobuf field .google.cloud.aiplatform.v1.ExplanationSpec explanation_spec = 2; */ - private $explanation_spec = null; + protected $explanation_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelEvaluationSlice.php b/AiPlatform/src/V1/ModelEvaluationSlice.php index 83bc3de76270..b17aaa83713d 100644 --- a/AiPlatform/src/V1/ModelEvaluationSlice.php +++ b/AiPlatform/src/V1/ModelEvaluationSlice.php @@ -21,13 +21,13 @@ class ModelEvaluationSlice extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. The slice of the test data that is used to evaluate the Model. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice slice = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $slice = null; + protected $slice = null; /** * Output only. Points to a YAML file stored on Google Cloud Storage * describing the @@ -37,7 +37,7 @@ class ModelEvaluationSlice extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metrics_schema_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $metrics_schema_uri = ''; + protected $metrics_schema_uri = ''; /** * Output only. Sliced evaluation metrics of the Model. The schema of the * metrics is stored in @@ -45,13 +45,13 @@ class ModelEvaluationSlice extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value metrics = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $metrics = null; + protected $metrics = null; /** * Output only. Timestamp when this ModelEvaluationSlice was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Aggregated explanation metrics for the Model's prediction * output over the data this ModelEvaluation uses. This field is populated @@ -60,7 +60,7 @@ class ModelEvaluationSlice extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelExplanation model_explanation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $model_explanation = null; + protected $model_explanation = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelEvaluationSlice/Slice.php b/AiPlatform/src/V1/ModelEvaluationSlice/Slice.php index de9c85443908..8577348d06ca 100644 --- a/AiPlatform/src/V1/ModelEvaluationSlice/Slice.php +++ b/AiPlatform/src/V1/ModelEvaluationSlice/Slice.php @@ -28,19 +28,19 @@ class Slice extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dimension = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $dimension = ''; + protected $dimension = ''; /** * Output only. The value of the dimension in this slice. * * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $value = ''; + protected $value = ''; /** * Output only. Specification for how the data was sliced. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice.SliceSpec slice_spec = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $slice_spec = null; + protected $slice_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelEvaluationSlice/Slice/SliceSpec/Range.php b/AiPlatform/src/V1/ModelEvaluationSlice/Slice/SliceSpec/Range.php index 4bffbb63bb7a..46c579ccf49b 100644 --- a/AiPlatform/src/V1/ModelEvaluationSlice/Slice/SliceSpec/Range.php +++ b/AiPlatform/src/V1/ModelEvaluationSlice/Slice/SliceSpec/Range.php @@ -21,13 +21,13 @@ class Range extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float low = 1; */ - private $low = 0.0; + protected $low = 0.0; /** * Exclusive high value for the range. * * Generated from protobuf field float high = 2; */ - private $high = 0.0; + protected $high = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelEvaluationSlice/Slice/SliceSpec/SliceConfig.php b/AiPlatform/src/V1/ModelEvaluationSlice/Slice/SliceSpec/SliceConfig.php index 378208b5648f..015cc27e13b6 100644 --- a/AiPlatform/src/V1/ModelEvaluationSlice/Slice/SliceSpec/SliceConfig.php +++ b/AiPlatform/src/V1/ModelEvaluationSlice/Slice/SliceSpec/SliceConfig.php @@ -176,7 +176,7 @@ public function hasAllValues() * Generated from protobuf field .google.protobuf.BoolValue all_values = 3; * @return bool|null */ - public function getAllValuesValue() + public function getAllValuesUnwrapped() { return $this->readWrapperValue("all_values"); } @@ -209,7 +209,7 @@ public function setAllValues($var) * @param bool|null $var * @return $this */ - public function setAllValuesValue($var) + public function setAllValuesUnwrapped($var) { $this->writeWrapperValue("all_values", $var); return $this;} diff --git a/AiPlatform/src/V1/ModelGardenServiceClient.php b/AiPlatform/src/V1/ModelGardenServiceClient.php deleted file mode 100644 index 9980f24b5bb6..000000000000 --- a/AiPlatform/src/V1/ModelGardenServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -string public_model_name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_model_name = ''; + protected $public_model_name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelMonitoringAlertConfig.php b/AiPlatform/src/V1/ModelMonitoringAlertConfig.php index eaf5432936a2..e4f7302e6c6e 100644 --- a/AiPlatform/src/V1/ModelMonitoringAlertConfig.php +++ b/AiPlatform/src/V1/ModelMonitoringAlertConfig.php @@ -24,7 +24,7 @@ class ModelMonitoringAlertConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_logging = 2; */ - private $enable_logging = false; + protected $enable_logging = false; /** * Resource names of the NotificationChannels to send alert. * Must be of the format diff --git a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig.php b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig.php index f23da4853be6..f1a3811fc390 100644 --- a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig.php +++ b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig.php @@ -22,25 +22,25 @@ class ModelMonitoringObjectiveConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelMonitoringObjectiveConfig.TrainingDataset training_dataset = 1; */ - private $training_dataset = null; + protected $training_dataset = null; /** * The config for skew between training data and prediction data. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelMonitoringObjectiveConfig.TrainingPredictionSkewDetectionConfig training_prediction_skew_detection_config = 2; */ - private $training_prediction_skew_detection_config = null; + protected $training_prediction_skew_detection_config = null; /** * The config for drift of prediction data. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelMonitoringObjectiveConfig.PredictionDriftDetectionConfig prediction_drift_detection_config = 3; */ - private $prediction_drift_detection_config = null; + protected $prediction_drift_detection_config = null; /** * The config for integrating with Vertex Explainable AI. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelMonitoringObjectiveConfig.ExplanationConfig explanation_config = 5; */ - private $explanation_config = null; + protected $explanation_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/ExplanationConfig.php b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/ExplanationConfig.php index 630da357f600..b211fa281fe4 100644 --- a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/ExplanationConfig.php +++ b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/ExplanationConfig.php @@ -23,13 +23,13 @@ class ExplanationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_feature_attributes = 1; */ - private $enable_feature_attributes = false; + protected $enable_feature_attributes = false; /** * Predictions generated by the BatchPredictionJob using baseline dataset. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelMonitoringObjectiveConfig.ExplanationConfig.ExplanationBaseline explanation_baseline = 2; */ - private $explanation_baseline = null; + protected $explanation_baseline = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/ExplanationConfig/ExplanationBaseline.php b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/ExplanationConfig/ExplanationBaseline.php index 648c3723dcdd..3d355902f76c 100644 --- a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/ExplanationConfig/ExplanationBaseline.php +++ b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/ExplanationConfig/ExplanationBaseline.php @@ -23,7 +23,7 @@ class ExplanationBaseline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelMonitoringObjectiveConfig.ExplanationConfig.ExplanationBaseline.PredictionFormat prediction_format = 1; */ - private $prediction_format = 0; + protected $prediction_format = 0; protected $destination; /** diff --git a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/PredictionDriftDetectionConfig.php b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/PredictionDriftDetectionConfig.php index faddad6fd4f0..4ff6b59338ba 100644 --- a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/PredictionDriftDetectionConfig.php +++ b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/PredictionDriftDetectionConfig.php @@ -38,7 +38,7 @@ class PredictionDriftDetectionConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ThresholdConfig default_drift_threshold = 5; */ - private $default_drift_threshold = null; + protected $default_drift_threshold = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/TrainingDataset.php b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/TrainingDataset.php index 1ee4a17880e8..9d87aae2f919 100644 --- a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/TrainingDataset.php +++ b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/TrainingDataset.php @@ -28,7 +28,7 @@ class TrainingDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string data_format = 2; */ - private $data_format = ''; + protected $data_format = ''; /** * The target field name the model is to predict. * This field will be excluded when doing Predict and (or) Explain for the @@ -36,14 +36,14 @@ class TrainingDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string target_field = 6; */ - private $target_field = ''; + protected $target_field = ''; /** * Strategy to sample data from Training Dataset. * If not set, we process the whole dataset. * * Generated from protobuf field .google.cloud.aiplatform.v1.SamplingStrategy logging_sampling_strategy = 7; */ - private $logging_sampling_strategy = null; + protected $logging_sampling_strategy = null; protected $data_source; /** diff --git a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/TrainingPredictionSkewDetectionConfig.php b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/TrainingPredictionSkewDetectionConfig.php index f622fba72daf..01cddd750ccf 100644 --- a/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/TrainingPredictionSkewDetectionConfig.php +++ b/AiPlatform/src/V1/ModelMonitoringObjectiveConfig/TrainingPredictionSkewDetectionConfig.php @@ -40,7 +40,7 @@ class TrainingPredictionSkewDetectionConfig extends \Google\Protobuf\Internal\Me * * Generated from protobuf field .google.cloud.aiplatform.v1.ThresholdConfig default_skew_threshold = 6; */ - private $default_skew_threshold = null; + protected $default_skew_threshold = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ModelMonitoringStatsAnomalies.php b/AiPlatform/src/V1/ModelMonitoringStatsAnomalies.php index ec7ab2681915..f96bd2e25161 100644 --- a/AiPlatform/src/V1/ModelMonitoringStatsAnomalies.php +++ b/AiPlatform/src/V1/ModelMonitoringStatsAnomalies.php @@ -20,19 +20,19 @@ class ModelMonitoringStatsAnomalies extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelDeploymentMonitoringObjectiveType objective = 1; */ - private $objective = 0; + protected $objective = 0; /** * Deployed Model ID. * * Generated from protobuf field string deployed_model_id = 2; */ - private $deployed_model_id = ''; + protected $deployed_model_id = ''; /** * Number of anomalies within all stats. * * Generated from protobuf field int32 anomaly_count = 3; */ - private $anomaly_count = 0; + protected $anomaly_count = 0; /** * A list of historical Stats and Anomalies generated for all Features. * diff --git a/AiPlatform/src/V1/ModelMonitoringStatsAnomalies/FeatureHistoricStatsAnomalies.php b/AiPlatform/src/V1/ModelMonitoringStatsAnomalies/FeatureHistoricStatsAnomalies.php index 56a04a2be9b3..010cfdcbc913 100644 --- a/AiPlatform/src/V1/ModelMonitoringStatsAnomalies/FeatureHistoricStatsAnomalies.php +++ b/AiPlatform/src/V1/ModelMonitoringStatsAnomalies/FeatureHistoricStatsAnomalies.php @@ -20,19 +20,19 @@ class FeatureHistoricStatsAnomalies extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_display_name = 1; */ - private $feature_display_name = ''; + protected $feature_display_name = ''; /** * Threshold for anomaly detection. * * Generated from protobuf field .google.cloud.aiplatform.v1.ThresholdConfig threshold = 3; */ - private $threshold = null; + protected $threshold = null; /** * Stats calculated for the Training Dataset. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureStatsAnomaly training_stats = 4; */ - private $training_stats = null; + protected $training_stats = null; /** * A list of historical stats generated by different time window's * Prediction Dataset. diff --git a/AiPlatform/src/V1/ModelServiceClient.php b/AiPlatform/src/V1/ModelServiceClient.php deleted file mode 100644 index 4415a352ea74..000000000000 --- a/AiPlatform/src/V1/ModelServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.ModelService/UploadModel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets a Model. - * @param \Google\Cloud\AIPlatform\V1\GetModelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetModel(\Google\Cloud\AIPlatform\V1\GetModelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/GetModel', - $argument, - ['\Google\Cloud\AIPlatform\V1\Model', 'decode'], - $metadata, $options); - } - - /** - * Lists Models in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListModelsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListModels(\Google\Cloud\AIPlatform\V1\ListModelsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/ListModels', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListModelsResponse', 'decode'], - $metadata, $options); - } - - /** - * Lists versions of the specified model. - * @param \Google\Cloud\AIPlatform\V1\ListModelVersionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListModelVersions(\Google\Cloud\AIPlatform\V1\ListModelVersionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/ListModelVersions', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListModelVersionsResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates a Model. - * @param \Google\Cloud\AIPlatform\V1\UpdateModelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateModel(\Google\Cloud\AIPlatform\V1\UpdateModelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/UpdateModel', - $argument, - ['\Google\Cloud\AIPlatform\V1\Model', 'decode'], - $metadata, $options); - } - - /** - * Deletes a Model. - * - * A model cannot be deleted if any - * [Endpoint][google.cloud.aiplatform.v1.Endpoint] resource has a - * [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] based on the - * model in its - * [deployed_models][google.cloud.aiplatform.v1.Endpoint.deployed_models] - * field. - * @param \Google\Cloud\AIPlatform\V1\DeleteModelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteModel(\Google\Cloud\AIPlatform\V1\DeleteModelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/DeleteModel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a Model version. - * - * Model version can only be deleted if there are no - * [DeployedModels][google.cloud.aiplatform.v1.DeployedModel] created from it. - * Deleting the only version in the Model is not allowed. Use - * [DeleteModel][google.cloud.aiplatform.v1.ModelService.DeleteModel] for - * deleting the Model instead. - * @param \Google\Cloud\AIPlatform\V1\DeleteModelVersionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteModelVersion(\Google\Cloud\AIPlatform\V1\DeleteModelVersionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/DeleteModelVersion', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Merges a set of aliases for a Model version. - * @param \Google\Cloud\AIPlatform\V1\MergeVersionAliasesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function MergeVersionAliases(\Google\Cloud\AIPlatform\V1\MergeVersionAliasesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/MergeVersionAliases', - $argument, - ['\Google\Cloud\AIPlatform\V1\Model', 'decode'], - $metadata, $options); - } - - /** - * Exports a trained, exportable Model to a location specified by the - * user. A Model is considered to be exportable if it has at least one - * [supported export - * format][google.cloud.aiplatform.v1.Model.supported_export_formats]. - * @param \Google\Cloud\AIPlatform\V1\ExportModelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ExportModel(\Google\Cloud\AIPlatform\V1\ExportModelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/ExportModel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Copies an already existing Vertex AI Model into the specified Location. - * The source Model must exist in the same Project. - * When copying custom Models, the users themselves are responsible for - * [Model.metadata][google.cloud.aiplatform.v1.Model.metadata] content to be - * region-agnostic, as well as making sure that any resources (e.g. files) it - * depends on remain accessible. - * @param \Google\Cloud\AIPlatform\V1\CopyModelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CopyModel(\Google\Cloud\AIPlatform\V1\CopyModelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/CopyModel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Imports an externally generated ModelEvaluation. - * @param \Google\Cloud\AIPlatform\V1\ImportModelEvaluationRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ImportModelEvaluation(\Google\Cloud\AIPlatform\V1\ImportModelEvaluationRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/ImportModelEvaluation', - $argument, - ['\Google\Cloud\AIPlatform\V1\ModelEvaluation', 'decode'], - $metadata, $options); - } - - /** - * Imports a list of externally generated ModelEvaluationSlice. - * @param \Google\Cloud\AIPlatform\V1\BatchImportModelEvaluationSlicesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchImportModelEvaluationSlices(\Google\Cloud\AIPlatform\V1\BatchImportModelEvaluationSlicesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/BatchImportModelEvaluationSlices', - $argument, - ['\Google\Cloud\AIPlatform\V1\BatchImportModelEvaluationSlicesResponse', 'decode'], - $metadata, $options); - } - - /** - * Imports a list of externally generated EvaluatedAnnotations. - * @param \Google\Cloud\AIPlatform\V1\BatchImportEvaluatedAnnotationsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchImportEvaluatedAnnotations(\Google\Cloud\AIPlatform\V1\BatchImportEvaluatedAnnotationsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/BatchImportEvaluatedAnnotations', - $argument, - ['\Google\Cloud\AIPlatform\V1\BatchImportEvaluatedAnnotationsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets a ModelEvaluation. - * @param \Google\Cloud\AIPlatform\V1\GetModelEvaluationRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetModelEvaluation(\Google\Cloud\AIPlatform\V1\GetModelEvaluationRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/GetModelEvaluation', - $argument, - ['\Google\Cloud\AIPlatform\V1\ModelEvaluation', 'decode'], - $metadata, $options); - } - - /** - * Lists ModelEvaluations in a Model. - * @param \Google\Cloud\AIPlatform\V1\ListModelEvaluationsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListModelEvaluations(\Google\Cloud\AIPlatform\V1\ListModelEvaluationsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/ListModelEvaluations', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListModelEvaluationsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets a ModelEvaluationSlice. - * @param \Google\Cloud\AIPlatform\V1\GetModelEvaluationSliceRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetModelEvaluationSlice(\Google\Cloud\AIPlatform\V1\GetModelEvaluationSliceRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/GetModelEvaluationSlice', - $argument, - ['\Google\Cloud\AIPlatform\V1\ModelEvaluationSlice', 'decode'], - $metadata, $options); - } - - /** - * Lists ModelEvaluationSlices in a ModelEvaluation. - * @param \Google\Cloud\AIPlatform\V1\ListModelEvaluationSlicesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListModelEvaluationSlices(\Google\Cloud\AIPlatform\V1\ListModelEvaluationSlicesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.ModelService/ListModelEvaluationSlices', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListModelEvaluationSlicesResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/ModelSourceInfo.php b/AiPlatform/src/V1/ModelSourceInfo.php index 42ef8a06c0e4..64cd00677481 100644 --- a/AiPlatform/src/V1/ModelSourceInfo.php +++ b/AiPlatform/src/V1/ModelSourceInfo.php @@ -20,7 +20,7 @@ class ModelSourceInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelSourceInfo.ModelSourceType source_type = 1; */ - private $source_type = 0; + protected $source_type = 0; /** * If this Model is copy of another Model. If true then * [source_type][google.cloud.aiplatform.v1.ModelSourceInfo.source_type] @@ -28,7 +28,7 @@ class ModelSourceInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool copy = 2; */ - private $copy = false; + protected $copy = false; /** * Constructor. diff --git a/AiPlatform/src/V1/MutateDeployedIndexOperationMetadata.php b/AiPlatform/src/V1/MutateDeployedIndexOperationMetadata.php index 5a5f217405ea..21262d06a69a 100644 --- a/AiPlatform/src/V1/MutateDeployedIndexOperationMetadata.php +++ b/AiPlatform/src/V1/MutateDeployedIndexOperationMetadata.php @@ -21,13 +21,13 @@ class MutateDeployedIndexOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * The unique index id specified by user * * Generated from protobuf field string deployed_index_id = 2; */ - private $deployed_index_id = ''; + protected $deployed_index_id = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/MutateDeployedIndexRequest.php b/AiPlatform/src/V1/MutateDeployedIndexRequest.php index 9127ab629377..36d175f20a78 100644 --- a/AiPlatform/src/V1/MutateDeployedIndexRequest.php +++ b/AiPlatform/src/V1/MutateDeployedIndexRequest.php @@ -23,7 +23,7 @@ class MutateDeployedIndexRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string index_endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $index_endpoint = ''; + protected $index_endpoint = ''; /** * Required. The DeployedIndex to be updated within the IndexEndpoint. * Currently, the updatable fields are [DeployedIndex][automatic_resources] @@ -31,7 +31,7 @@ class MutateDeployedIndexRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedIndex deployed_index = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployed_index = null; + protected $deployed_index = null; /** * @param string $indexEndpoint Required. The name of the IndexEndpoint resource into which to deploy an diff --git a/AiPlatform/src/V1/MutateDeployedIndexResponse.php b/AiPlatform/src/V1/MutateDeployedIndexResponse.php index fa0760eeea78..28c82f3d6727 100644 --- a/AiPlatform/src/V1/MutateDeployedIndexResponse.php +++ b/AiPlatform/src/V1/MutateDeployedIndexResponse.php @@ -21,7 +21,7 @@ class MutateDeployedIndexResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedIndex deployed_index = 1; */ - private $deployed_index = null; + protected $deployed_index = null; /** * Constructor. diff --git a/AiPlatform/src/V1/MutateDeployedModelOperationMetadata.php b/AiPlatform/src/V1/MutateDeployedModelOperationMetadata.php index 2b176d7085a7..a90ec39619a7 100644 --- a/AiPlatform/src/V1/MutateDeployedModelOperationMetadata.php +++ b/AiPlatform/src/V1/MutateDeployedModelOperationMetadata.php @@ -21,7 +21,7 @@ class MutateDeployedModelOperationMetadata extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/MutateDeployedModelRequest.php b/AiPlatform/src/V1/MutateDeployedModelRequest.php index 0b77576556db..eca7a1d0a436 100644 --- a/AiPlatform/src/V1/MutateDeployedModelRequest.php +++ b/AiPlatform/src/V1/MutateDeployedModelRequest.php @@ -23,7 +23,7 @@ class MutateDeployedModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Required. The DeployedModel to be mutated within the Endpoint. Only the * following fields can be mutated: @@ -39,14 +39,14 @@ class MutateDeployedModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedModel deployed_model = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployed_model = null; + protected $deployed_model = null; /** * Required. The update mask applies to the resource. See * [google.protobuf.FieldMask][google.protobuf.FieldMask]. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $endpoint Required. The name of the Endpoint resource into which to mutate a diff --git a/AiPlatform/src/V1/MutateDeployedModelResponse.php b/AiPlatform/src/V1/MutateDeployedModelResponse.php index bb21a6c766eb..02ea51d2a1e3 100644 --- a/AiPlatform/src/V1/MutateDeployedModelResponse.php +++ b/AiPlatform/src/V1/MutateDeployedModelResponse.php @@ -21,7 +21,7 @@ class MutateDeployedModelResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DeployedModel deployed_model = 1; */ - private $deployed_model = null; + protected $deployed_model = null; /** * Constructor. diff --git a/AiPlatform/src/V1/NasJob.php b/AiPlatform/src/V1/NasJob.php index 8d066f83b5e0..8336936c13f3 100644 --- a/AiPlatform/src/V1/NasJob.php +++ b/AiPlatform/src/V1/NasJob.php @@ -20,7 +20,7 @@ class NasJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The display name of the NasJob. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -28,58 +28,58 @@ class NasJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Required. The specification of a NasJob. * * Generated from protobuf field .google.cloud.aiplatform.v1.NasJobSpec nas_job_spec = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $nas_job_spec = null; + protected $nas_job_spec = null; /** * Output only. Output of the NasJob. * * Generated from protobuf field .google.cloud.aiplatform.v1.NasJobOutput nas_job_output = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $nas_job_output = null; + protected $nas_job_output = null; /** * Output only. The detailed state of the job. * * Generated from protobuf field .google.cloud.aiplatform.v1.JobState state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Time when the NasJob was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Time when the NasJob for the first time entered the * `JOB_STATE_RUNNING` state. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Time when the NasJob entered any of the following states: * `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Time when the NasJob was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. Only populated when job's state is JOB_STATE_FAILED or * JOB_STATE_CANCELLED. * * Generated from protobuf field .google.rpc.Status error = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * The labels with user-defined metadata to organize NasJobs. * Label keys and values can be no longer than 64 characters @@ -97,7 +97,7 @@ class NasJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 13; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Optional. Enable a separation of Custom model training * and restricted image training for tenant project. diff --git a/AiPlatform/src/V1/NasJobSpec.php b/AiPlatform/src/V1/NasJobSpec.php index f20b9d6998bb..d54b7d83386a 100644 --- a/AiPlatform/src/V1/NasJobSpec.php +++ b/AiPlatform/src/V1/NasJobSpec.php @@ -23,13 +23,13 @@ class NasJobSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string resume_nas_job_id = 3; */ - private $resume_nas_job_id = ''; + protected $resume_nas_job_id = ''; /** * It defines the search space for Neural Architecture Search (NAS). * * Generated from protobuf field string search_space_spec = 1; */ - private $search_space_spec = ''; + protected $search_space_spec = ''; protected $nas_algorithm_spec; /** diff --git a/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec.php b/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec.php index 16f0c87e8500..a281da5c6b84 100644 --- a/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec.php +++ b/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec.php @@ -21,20 +21,20 @@ class MultiTrialAlgorithmSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.NasJobSpec.MultiTrialAlgorithmSpec.MultiTrialAlgorithm multi_trial_algorithm = 1; */ - private $multi_trial_algorithm = 0; + protected $multi_trial_algorithm = 0; /** * Metric specs for the NAS job. * Validation for this field is done at `multi_trial_algorithm_spec` field. * * Generated from protobuf field .google.cloud.aiplatform.v1.NasJobSpec.MultiTrialAlgorithmSpec.MetricSpec metric = 2; */ - private $metric = null; + protected $metric = null; /** * Required. Spec for search trials. * * Generated from protobuf field .google.cloud.aiplatform.v1.NasJobSpec.MultiTrialAlgorithmSpec.SearchTrialSpec search_trial_spec = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $search_trial_spec = null; + protected $search_trial_spec = null; /** * Spec for train trials. Top N [TrainTrialSpec.max_parallel_trial_count] * search trials will be trained for every M @@ -42,7 +42,7 @@ class MultiTrialAlgorithmSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.NasJobSpec.MultiTrialAlgorithmSpec.TrainTrialSpec train_trial_spec = 4; */ - private $train_trial_spec = null; + protected $train_trial_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/MetricSpec.php b/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/MetricSpec.php index 4f63012015c7..5f6b311c9da5 100644 --- a/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/MetricSpec.php +++ b/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/MetricSpec.php @@ -20,13 +20,13 @@ class MetricSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metric_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $metric_id = ''; + protected $metric_id = ''; /** * Required. The optimization goal of the metric. * * Generated from protobuf field .google.cloud.aiplatform.v1.NasJobSpec.MultiTrialAlgorithmSpec.MetricSpec.GoalType goal = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $goal = 0; + protected $goal = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/SearchTrialSpec.php b/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/SearchTrialSpec.php index 8868685bf7d1..b17fbe4c6f9c 100644 --- a/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/SearchTrialSpec.php +++ b/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/SearchTrialSpec.php @@ -21,20 +21,20 @@ class SearchTrialSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.CustomJobSpec search_trial_job_spec = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $search_trial_job_spec = null; + protected $search_trial_job_spec = null; /** * Required. The maximum number of Neural Architecture Search (NAS) trials * to run. * * Generated from protobuf field int32 max_trial_count = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_trial_count = 0; + protected $max_trial_count = 0; /** * Required. The maximum number of trials to run in parallel. * * Generated from protobuf field int32 max_parallel_trial_count = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_parallel_trial_count = 0; + protected $max_parallel_trial_count = 0; /** * The number of failed trials that need to be seen before failing * the NasJob. @@ -43,7 +43,7 @@ class SearchTrialSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 max_failed_trial_count = 4; */ - private $max_failed_trial_count = 0; + protected $max_failed_trial_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/TrainTrialSpec.php b/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/TrainTrialSpec.php index 4d05fec877fb..e2ca699e1258 100644 --- a/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/TrainTrialSpec.php +++ b/AiPlatform/src/V1/NasJobSpec/MultiTrialAlgorithmSpec/TrainTrialSpec.php @@ -21,13 +21,13 @@ class TrainTrialSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.CustomJobSpec train_trial_job_spec = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $train_trial_job_spec = null; + protected $train_trial_job_spec = null; /** * Required. The maximum number of trials to run in parallel. * * Generated from protobuf field int32 max_parallel_trial_count = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_parallel_trial_count = 0; + protected $max_parallel_trial_count = 0; /** * Required. Frequency of search trials to start train stage. Top N * [TrainTrialSpec.max_parallel_trial_count] @@ -36,7 +36,7 @@ class TrainTrialSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 frequency = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $frequency = 0; + protected $frequency = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/NasTrial.php b/AiPlatform/src/V1/NasTrial.php index 11a8658154bc..d902f57a3342 100644 --- a/AiPlatform/src/V1/NasTrial.php +++ b/AiPlatform/src/V1/NasTrial.php @@ -20,32 +20,32 @@ class NasTrial extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $id = ''; + protected $id = ''; /** * Output only. The detailed state of the NasTrial. * * Generated from protobuf field .google.cloud.aiplatform.v1.NasTrial.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The final measurement containing the objective value. * * Generated from protobuf field .google.cloud.aiplatform.v1.Measurement final_measurement = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $final_measurement = null; + protected $final_measurement = null; /** * Output only. Time when the NasTrial was started. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Time when the NasTrial's status changed to `SUCCEEDED` or * `INFEASIBLE`. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Constructor. diff --git a/AiPlatform/src/V1/NasTrialDetail.php b/AiPlatform/src/V1/NasTrialDetail.php index f561c1453d95..031e875a2bb4 100644 --- a/AiPlatform/src/V1/NasTrialDetail.php +++ b/AiPlatform/src/V1/NasTrialDetail.php @@ -21,19 +21,19 @@ class NasTrialDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * The parameters for the NasJob NasTrial. * * Generated from protobuf field string parameters = 2; */ - private $parameters = ''; + protected $parameters = ''; /** * The requested search NasTrial. * * Generated from protobuf field .google.cloud.aiplatform.v1.NasTrial search_trial = 3; */ - private $search_trial = null; + protected $search_trial = null; /** * The train NasTrial corresponding to * [search_trial][google.cloud.aiplatform.v1.NasTrialDetail.search_trial]. @@ -43,7 +43,7 @@ class NasTrialDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.NasTrial train_trial = 4; */ - private $train_trial = null; + protected $train_trial = null; /** * Constructor. diff --git a/AiPlatform/src/V1/NearestNeighborQuery.php b/AiPlatform/src/V1/NearestNeighborQuery.php index 4dd061e872ae..6e527c3f9dec 100644 --- a/AiPlatform/src/V1/NearestNeighborQuery.php +++ b/AiPlatform/src/V1/NearestNeighborQuery.php @@ -21,7 +21,7 @@ class NearestNeighborQuery extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 neighbor_count = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $neighbor_count = 0; + protected $neighbor_count = 0; /** * Optional. The list of string filters. * @@ -36,13 +36,13 @@ class NearestNeighborQuery extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 per_crowding_attribute_neighbor_count = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $per_crowding_attribute_neighbor_count = 0; + protected $per_crowding_attribute_neighbor_count = 0; /** * Optional. Parameters that can be set to tune query on the fly. * * Generated from protobuf field .google.cloud.aiplatform.v1.NearestNeighborQuery.Parameters parameters = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $parameters = null; + protected $parameters = null; protected $instance; /** diff --git a/AiPlatform/src/V1/NearestNeighborQuery/Parameters.php b/AiPlatform/src/V1/NearestNeighborQuery/Parameters.php index d0fe3a1ad631..61782e69bc46 100644 --- a/AiPlatform/src/V1/NearestNeighborQuery/Parameters.php +++ b/AiPlatform/src/V1/NearestNeighborQuery/Parameters.php @@ -23,7 +23,7 @@ class Parameters extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 approximate_neighbor_candidates = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $approximate_neighbor_candidates = 0; + protected $approximate_neighbor_candidates = 0; /** * Optional. The fraction of the number of leaves to search, set at query * time allows user to tune search performance. This value increase result @@ -32,7 +32,7 @@ class Parameters extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double leaf_nodes_search_fraction = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $leaf_nodes_search_fraction = 0.0; + protected $leaf_nodes_search_fraction = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/NearestNeighborQuery/StringFilter.php b/AiPlatform/src/V1/NearestNeighborQuery/StringFilter.php index 74ed5fb4b40c..3e39be2aefbf 100644 --- a/AiPlatform/src/V1/NearestNeighborQuery/StringFilter.php +++ b/AiPlatform/src/V1/NearestNeighborQuery/StringFilter.php @@ -27,7 +27,7 @@ class StringFilter extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; /** * Optional. The allowed tokens. * diff --git a/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata.php b/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata.php index f736938b9b45..3cc0969f3b97 100644 --- a/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata.php +++ b/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata.php @@ -31,7 +31,7 @@ class NearestNeighborSearchOperationMetadata extends \Google\Protobuf\Internal\M * * Generated from protobuf field int64 data_bytes_count = 2; */ - private $data_bytes_count = 0; + protected $data_bytes_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata/ContentValidationStats.php b/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata/ContentValidationStats.php index e173039221ee..9eb81cfaab91 100644 --- a/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata/ContentValidationStats.php +++ b/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata/ContentValidationStats.php @@ -18,19 +18,19 @@ class ContentValidationStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string source_gcs_uri = 1; */ - private $source_gcs_uri = ''; + protected $source_gcs_uri = ''; /** * Number of records in this file that were successfully processed. * * Generated from protobuf field int64 valid_record_count = 2; */ - private $valid_record_count = 0; + protected $valid_record_count = 0; /** * Number of records in this file we skipped due to validate errors. * * Generated from protobuf field int64 invalid_record_count = 3; */ - private $invalid_record_count = 0; + protected $invalid_record_count = 0; /** * The detail information of the partial failures encountered for those * invalid records that couldn't be parsed. @@ -44,13 +44,13 @@ class ContentValidationStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 valid_sparse_record_count = 5; */ - private $valid_sparse_record_count = 0; + protected $valid_sparse_record_count = 0; /** * Number of sparse records in this file we skipped due to validate errors. * * Generated from protobuf field int64 invalid_sparse_record_count = 6; */ - private $invalid_sparse_record_count = 0; + protected $invalid_sparse_record_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata/RecordError.php b/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata/RecordError.php index 602d298d20c7..7ba5bc4af61d 100644 --- a/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata/RecordError.php +++ b/AiPlatform/src/V1/NearestNeighborSearchOperationMetadata/RecordError.php @@ -18,7 +18,7 @@ class RecordError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.NearestNeighborSearchOperationMetadata.RecordError.RecordErrorType error_type = 1; */ - private $error_type = 0; + protected $error_type = 0; /** * A human-readable message that is shown to the user to help them fix the * error. Note that this message may change from time to time, your code @@ -26,25 +26,25 @@ class RecordError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string error_message = 2; */ - private $error_message = ''; + protected $error_message = ''; /** * Cloud Storage URI pointing to the original file in user's bucket. * * Generated from protobuf field string source_gcs_uri = 3; */ - private $source_gcs_uri = ''; + protected $source_gcs_uri = ''; /** * Empty if the embedding id is failed to parse. * * Generated from protobuf field string embedding_id = 4; */ - private $embedding_id = ''; + protected $embedding_id = ''; /** * The original content of this record. * * Generated from protobuf field string raw_record = 5; */ - private $raw_record = ''; + protected $raw_record = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/NearestNeighbors/Neighbor.php b/AiPlatform/src/V1/NearestNeighbors/Neighbor.php index 5b81e6c5ccfc..22b7fcde8dbd 100644 --- a/AiPlatform/src/V1/NearestNeighbors/Neighbor.php +++ b/AiPlatform/src/V1/NearestNeighbors/Neighbor.php @@ -20,13 +20,13 @@ class Neighbor extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_id = 1; */ - private $entity_id = ''; + protected $entity_id = ''; /** * The distance between the neighbor and the query vector. * * Generated from protobuf field double distance = 2; */ - private $distance = 0.0; + protected $distance = 0.0; /** * The attributes of the neighbor, e.g. filters, crowding and metadata * Note that full entities are returned only when "return_full_entity" @@ -35,7 +35,7 @@ class Neighbor extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FetchFeatureValuesResponse entity_key_values = 3; */ - private $entity_key_values = null; + protected $entity_key_values = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Neighbor.php b/AiPlatform/src/V1/Neighbor.php index 9b5f6c96a2d0..7ed5352a8dda 100644 --- a/AiPlatform/src/V1/Neighbor.php +++ b/AiPlatform/src/V1/Neighbor.php @@ -20,13 +20,13 @@ class Neighbor extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string neighbor_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $neighbor_id = ''; + protected $neighbor_id = ''; /** * Output only. The neighbor distance. * * Generated from protobuf field double neighbor_distance = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $neighbor_distance = 0.0; + protected $neighbor_distance = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/NetworkSpec.php b/AiPlatform/src/V1/NetworkSpec.php index ec4e2234714b..ecdb76c73b77 100644 --- a/AiPlatform/src/V1/NetworkSpec.php +++ b/AiPlatform/src/V1/NetworkSpec.php @@ -20,14 +20,14 @@ class NetworkSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_internet_access = 1; */ - private $enable_internet_access = false; + protected $enable_internet_access = false; /** * The full name of the Google Compute Engine * [network](https://cloud.google.com//compute/docs/networks-and-firewalls#networks) * * Generated from protobuf field string network = 2 [(.google.api.resource_reference) = { */ - private $network = ''; + protected $network = ''; /** * The name of the subnet that this instance is in. * Format: @@ -35,7 +35,7 @@ class NetworkSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string subnetwork = 3 [(.google.api.resource_reference) = { */ - private $subnetwork = ''; + protected $subnetwork = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/NfsMount.php b/AiPlatform/src/V1/NfsMount.php index d22ad9d916d1..b1b11b26b5ad 100644 --- a/AiPlatform/src/V1/NfsMount.php +++ b/AiPlatform/src/V1/NfsMount.php @@ -20,7 +20,7 @@ class NfsMount extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string server = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $server = ''; + protected $server = ''; /** * Required. Source path exported from NFS server. * Has to start with '/', and combined with the ip address, it indicates @@ -28,14 +28,14 @@ class NfsMount extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string path = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $path = ''; + protected $path = ''; /** * Required. Destination mount path. The NFS will be mounted for the user * under /mnt/nfs/ * * Generated from protobuf field string mount_point = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $mount_point = ''; + protected $mount_point = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/NotebookEucConfig.php b/AiPlatform/src/V1/NotebookEucConfig.php index c8a7ee268192..cc1758b89cf2 100644 --- a/AiPlatform/src/V1/NotebookEucConfig.php +++ b/AiPlatform/src/V1/NotebookEucConfig.php @@ -22,7 +22,7 @@ class NotebookEucConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool euc_disabled = 1 [(.google.api.field_behavior) = INPUT_ONLY]; */ - private $euc_disabled = false; + protected $euc_disabled = false; /** * Output only. Whether ActAs check is bypassed for service account attached * to the VM. If false, we need ActAs check for the default Compute Engine @@ -34,7 +34,7 @@ class NotebookEucConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool bypass_actas_check = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $bypass_actas_check = false; + protected $bypass_actas_check = false; /** * Constructor. diff --git a/AiPlatform/src/V1/NotebookIdleShutdownConfig.php b/AiPlatform/src/V1/NotebookIdleShutdownConfig.php index b418f7c370ce..012706eb54b8 100644 --- a/AiPlatform/src/V1/NotebookIdleShutdownConfig.php +++ b/AiPlatform/src/V1/NotebookIdleShutdownConfig.php @@ -23,13 +23,13 @@ class NotebookIdleShutdownConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration idle_timeout = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $idle_timeout = null; + protected $idle_timeout = null; /** * Whether Idle Shutdown is disabled in this NotebookRuntimeTemplate. * * Generated from protobuf field bool idle_shutdown_disabled = 2; */ - private $idle_shutdown_disabled = false; + protected $idle_shutdown_disabled = false; /** * Constructor. diff --git a/AiPlatform/src/V1/NotebookRuntime.php b/AiPlatform/src/V1/NotebookRuntime.php index 5efa79f05f93..b7e1dde9a37e 100644 --- a/AiPlatform/src/V1/NotebookRuntime.php +++ b/AiPlatform/src/V1/NotebookRuntime.php @@ -22,44 +22,44 @@ class NotebookRuntime extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The user email of the NotebookRuntime. * * Generated from protobuf field string runtime_user = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $runtime_user = ''; + protected $runtime_user = ''; /** * Output only. The pointer to NotebookRuntimeTemplate this NotebookRuntime is * created from. * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookRuntimeTemplateRef notebook_runtime_template_ref = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $notebook_runtime_template_ref = null; + protected $notebook_runtime_template_ref = null; /** * Output only. The proxy endpoint used to access the NotebookRuntime. * * Generated from protobuf field string proxy_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $proxy_uri = ''; + protected $proxy_uri = ''; /** * Output only. Timestamp when this NotebookRuntime was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this NotebookRuntime was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. The health state of the NotebookRuntime. * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookRuntime.HealthState health_state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $health_state = 0; + protected $health_state = 0; /** * Required. The display name of the NotebookRuntime. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -67,31 +67,31 @@ class NotebookRuntime extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 10 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * The description of the NotebookRuntime. * * Generated from protobuf field string description = 11; */ - private $description = ''; + protected $description = ''; /** * Output only. The service account that the NotebookRuntime workload runs as. * * Generated from protobuf field string service_account = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $service_account = ''; + protected $service_account = ''; /** * Output only. The runtime (instance) state of the NotebookRuntime. * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookRuntime.RuntimeState runtime_state = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $runtime_state = 0; + protected $runtime_state = 0; /** * Output only. Whether NotebookRuntime is upgradable. * * Generated from protobuf field bool is_upgradable = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $is_upgradable = false; + protected $is_upgradable = false; /** * The labels with user-defined metadata to organize your * NotebookRuntime. @@ -121,25 +121,25 @@ class NotebookRuntime extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $expiration_time = null; + protected $expiration_time = null; /** * Output only. The VM os image version of NotebookRuntime. * * Generated from protobuf field string version = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $version = ''; + protected $version = ''; /** * Output only. The type of the notebook runtime. * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookRuntimeType notebook_runtime_type = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $notebook_runtime_type = 0; + protected $notebook_runtime_type = 0; /** * Output only. The idle shutdown configuration of the notebook runtime. * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookIdleShutdownConfig idle_shutdown_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $idle_shutdown_config = null; + protected $idle_shutdown_config = null; /** * Optional. The Compute Engine tags to add to runtime (see [Tagging * instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)). @@ -152,19 +152,19 @@ class NotebookRuntime extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Output only. Reserved for future use. * * Generated from protobuf field bool satisfies_pzs = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $satisfies_pzs = false; + protected $satisfies_pzs = false; /** * Output only. Reserved for future use. * * Generated from protobuf field bool satisfies_pzi = 30 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $satisfies_pzi = false; + protected $satisfies_pzi = false; /** * Constructor. diff --git a/AiPlatform/src/V1/NotebookRuntimeTemplate.php b/AiPlatform/src/V1/NotebookRuntimeTemplate.php index a51d25cacec7..be48eae24404 100644 --- a/AiPlatform/src/V1/NotebookRuntimeTemplate.php +++ b/AiPlatform/src/V1/NotebookRuntimeTemplate.php @@ -22,7 +22,7 @@ class NotebookRuntimeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Required. The display name of the NotebookRuntimeTemplate. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -30,26 +30,26 @@ class NotebookRuntimeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * The description of the NotebookRuntimeTemplate. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Output only. The default template to use if not specified. * * Generated from protobuf field bool is_default = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $is_default = false; + protected $is_default = false; /** * Optional. Immutable. The specification of a single machine for the * template. * * Generated from protobuf field .google.cloud.aiplatform.v1.MachineSpec machine_spec = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = IMMUTABLE]; */ - private $machine_spec = null; + protected $machine_spec = null; /** * Optional. The specification of [persistent * disk][https://cloud.google.com/compute/docs/disks/persistent-disks] @@ -57,13 +57,13 @@ class NotebookRuntimeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PersistentDiskSpec data_persistent_disk_spec = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $data_persistent_disk_spec = null; + protected $data_persistent_disk_spec = null; /** * Optional. Network spec. * * Generated from protobuf field .google.cloud.aiplatform.v1.NetworkSpec network_spec = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $network_spec = null; + protected $network_spec = null; /** * The service account that the runtime workload runs as. * You can use any service account within the same project, but you @@ -74,14 +74,14 @@ class NotebookRuntimeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 13; */ - private $service_account = ''; + protected $service_account = ''; /** * Used to perform consistent read-modify-write updates. If not set, a blind * "overwrite" update happens. * * Generated from protobuf field string etag = 14; */ - private $etag = ''; + protected $etag = ''; /** * The labels with user-defined metadata to organize the * NotebookRuntimeTemplates. @@ -99,38 +99,38 @@ class NotebookRuntimeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookIdleShutdownConfig idle_shutdown_config = 17; */ - private $idle_shutdown_config = null; + protected $idle_shutdown_config = null; /** * EUC configuration of the NotebookRuntimeTemplate. * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookEucConfig euc_config = 18; */ - private $euc_config = null; + protected $euc_config = null; /** * Output only. Timestamp when this NotebookRuntimeTemplate was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this NotebookRuntimeTemplate was most recently * updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. Immutable. The type of the notebook runtime template. * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookRuntimeType notebook_runtime_type = 19 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = IMMUTABLE]; */ - private $notebook_runtime_type = 0; + protected $notebook_runtime_type = 0; /** * Optional. Immutable. Runtime Shielded VM spec. * * Generated from protobuf field .google.cloud.aiplatform.v1.ShieldedVmConfig shielded_vm_config = 20 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = IMMUTABLE]; */ - private $shielded_vm_config = null; + protected $shielded_vm_config = null; /** * Optional. The Compute Engine tags to add to runtime (see [Tagging * instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)). @@ -143,7 +143,7 @@ class NotebookRuntimeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 23; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/NotebookRuntimeTemplateRef.php b/AiPlatform/src/V1/NotebookRuntimeTemplateRef.php index c25187dc2d1e..0061713944c1 100644 --- a/AiPlatform/src/V1/NotebookRuntimeTemplateRef.php +++ b/AiPlatform/src/V1/NotebookRuntimeTemplateRef.php @@ -20,7 +20,7 @@ class NotebookRuntimeTemplateRef extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string notebook_runtime_template = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { */ - private $notebook_runtime_template = ''; + protected $notebook_runtime_template = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/NotebookServiceClient.php b/AiPlatform/src/V1/NotebookServiceClient.php deleted file mode 100644 index fd2e95bbb0a2..000000000000 --- a/AiPlatform/src/V1/NotebookServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the ModelDeploymentMonitoringJob to pause. diff --git a/AiPlatform/src/V1/PauseScheduleRequest.php b/AiPlatform/src/V1/PauseScheduleRequest.php index 5b9a213493f3..b041afecb65a 100644 --- a/AiPlatform/src/V1/PauseScheduleRequest.php +++ b/AiPlatform/src/V1/PauseScheduleRequest.php @@ -23,7 +23,7 @@ class PauseScheduleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the Schedule resource to be paused. diff --git a/AiPlatform/src/V1/PersistentDiskSpec.php b/AiPlatform/src/V1/PersistentDiskSpec.php index 0487c4cfeaae..83a6db5c472d 100644 --- a/AiPlatform/src/V1/PersistentDiskSpec.php +++ b/AiPlatform/src/V1/PersistentDiskSpec.php @@ -25,13 +25,13 @@ class PersistentDiskSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk_type = 1; */ - private $disk_type = ''; + protected $disk_type = ''; /** * Size in GB of the disk (default is 100GB). * * Generated from protobuf field int64 disk_size_gb = 2; */ - private $disk_size_gb = 0; + protected $disk_size_gb = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/PersistentResource.php b/AiPlatform/src/V1/PersistentResource.php index a58d3e2d1662..e8a7e58fc0dd 100644 --- a/AiPlatform/src/V1/PersistentResource.php +++ b/AiPlatform/src/V1/PersistentResource.php @@ -23,7 +23,7 @@ class PersistentResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $name = ''; + protected $name = ''; /** * Optional. The display name of the PersistentResource. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -31,7 +31,7 @@ class PersistentResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $display_name = ''; + protected $display_name = ''; /** * Required. The spec of the pools of different resources. * @@ -43,33 +43,33 @@ class PersistentResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PersistentResource.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Only populated when persistent resource's state is `STOPPING` * or `ERROR`. * * Generated from protobuf field .google.rpc.Status error = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Output only. Time when the PersistentResource was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Time when the PersistentResource for the first time entered * the `RUNNING` state. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Time when the PersistentResource was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Optional. The labels with user-defined metadata to organize * PersistentResource. @@ -83,10 +83,10 @@ class PersistentResource extends \Google\Protobuf\Internal\Message private $labels; /** * Optional. The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to peered with + * [network](/compute/docs/networks-and-firewalls#networks) to peered with * Vertex AI to host the persistent resources. * For example, `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. @@ -98,7 +98,7 @@ class PersistentResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 11 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $network = ''; + protected $network = ''; /** * Optional. Customer-managed encryption key spec for a PersistentResource. * If set, this PersistentResource and all sub-resources of this @@ -106,20 +106,20 @@ class PersistentResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Optional. Persistent Resource runtime spec. * For example, used for Ray cluster configuration. * * Generated from protobuf field .google.cloud.aiplatform.v1.ResourceRuntimeSpec resource_runtime_spec = 13 [(.google.api.field_behavior) = OPTIONAL]; */ - private $resource_runtime_spec = null; + protected $resource_runtime_spec = null; /** * Output only. Runtime information of the Persistent Resource. * * Generated from protobuf field .google.cloud.aiplatform.v1.ResourceRuntime resource_runtime = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $resource_runtime = null; + protected $resource_runtime = null; /** * Optional. A list of names for the reserved IP ranges under the VPC network * that can be used for this persistent resource. @@ -167,10 +167,10 @@ class PersistentResource extends \Google\Protobuf\Internal\Message * See https://goo.gl/xmQnxf for more information and examples of labels. * @type string $network * Optional. The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to peered with + * [network](/compute/docs/networks-and-firewalls#networks) to peered with * Vertex AI to host the persistent resources. * For example, `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. @@ -496,10 +496,10 @@ public function setLabels($var) /** * Optional. The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to peered with + * [network](/compute/docs/networks-and-firewalls#networks) to peered with * Vertex AI to host the persistent resources. * For example, `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. @@ -519,10 +519,10 @@ public function getNetwork() /** * Optional. The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to peered with + * [network](/compute/docs/networks-and-firewalls#networks) to peered with * Vertex AI to host the persistent resources. * For example, `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. diff --git a/AiPlatform/src/V1/PersistentResourceServiceClient.php b/AiPlatform/src/V1/PersistentResourceServiceClient.php deleted file mode 100644 index 1d1f41c667c9..000000000000 --- a/AiPlatform/src/V1/PersistentResourceServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * The display name of the Pipeline. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -28,56 +28,56 @@ class PipelineJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * Output only. Pipeline creation time. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Pipeline start time. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Pipeline end time. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Timestamp when this PipelineJob was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The spec of the pipeline. * * Generated from protobuf field .google.protobuf.Struct pipeline_spec = 7; */ - private $pipeline_spec = null; + protected $pipeline_spec = null; /** * Output only. The detailed state of the job. * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineState state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The details of pipeline run. Not available in the list view. * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineJobDetail job_detail = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $job_detail = null; + protected $job_detail = null; /** * Output only. The error that occurred during pipeline execution. * Only populated when the pipeline's state is FAILED or CANCELLED. * * Generated from protobuf field .google.rpc.Status error = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * The labels with user-defined metadata to organize PipelineJob. * Label keys and values can be no longer than 64 characters @@ -95,14 +95,14 @@ class PipelineJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineJob.RuntimeConfig runtime_config = 12; */ - private $runtime_config = null; + protected $runtime_config = null; /** * Customer-managed encryption key spec for a pipelineJob. If set, this * PipelineJob and all of its sub-resources will be secured by this key. * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 16; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * The service account that the pipeline workload runs as. * If not specified, the Compute Engine default service account in the project @@ -114,13 +114,13 @@ class PipelineJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 17; */ - private $service_account = ''; + protected $service_account = ''; /** * The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the + * [network](/compute/docs/networks-and-firewalls#networks) to which the * Pipeline Job's workload should be peered. For example, * `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. @@ -132,7 +132,7 @@ class PipelineJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 18 [(.google.api.resource_reference) = { */ - private $network = ''; + protected $network = ''; /** * A list of names for the reserved ip ranges under the VPC network * that can be used for this Pipeline Job's workload. @@ -153,7 +153,7 @@ class PipelineJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string template_uri = 19; */ - private $template_uri = ''; + protected $template_uri = ''; /** * Output only. Pipeline template metadata. Will fill up fields if * [PipelineJob.template_uri][google.cloud.aiplatform.v1.PipelineJob.template_uri] @@ -161,14 +161,14 @@ class PipelineJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineTemplateMetadata template_metadata = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $template_metadata = null; + protected $template_metadata = null; /** * Output only. The schedule resource name. * Only returned if the Pipeline is created by Schedule API. * * Generated from protobuf field string schedule_name = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $schedule_name = ''; + protected $schedule_name = ''; /** * Constructor. @@ -222,10 +222,10 @@ class PipelineJob extends \Google\Protobuf\Internal\Message * permission on this service account. * @type string $network * The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the + * [network](/compute/docs/networks-and-firewalls#networks) to which the * Pipeline Job's workload should be peered. For example, * `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. @@ -749,10 +749,10 @@ public function setServiceAccount($var) /** * The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the + * [network](/compute/docs/networks-and-firewalls#networks) to which the * Pipeline Job's workload should be peered. For example, * `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. @@ -772,10 +772,10 @@ public function getNetwork() /** * The full name of the Compute Engine - * [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the + * [network](/compute/docs/networks-and-firewalls#networks) to which the * Pipeline Job's workload should be peered. For example, * `projects/12345/global/networks/myVPC`. - * [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert) + * [Format](/compute/docs/reference/rest/v1/networks/insert) * is of the form `projects/{project}/global/networks/{network}`. * Where {project} is a project number, as in `12345`, and {network} is a * network name. diff --git a/AiPlatform/src/V1/PipelineJob/RuntimeConfig.php b/AiPlatform/src/V1/PipelineJob/RuntimeConfig.php index 3daf8644c22c..47eee6655fb9 100644 --- a/AiPlatform/src/V1/PipelineJob/RuntimeConfig.php +++ b/AiPlatform/src/V1/PipelineJob/RuntimeConfig.php @@ -40,7 +40,7 @@ class RuntimeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string gcs_output_directory = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $gcs_output_directory = ''; + protected $gcs_output_directory = ''; /** * The runtime parameters of the PipelineJob. The parameters will be * passed into @@ -63,7 +63,7 @@ class RuntimeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineFailurePolicy failure_policy = 4; */ - private $failure_policy = 0; + protected $failure_policy = 0; /** * The runtime artifacts of the PipelineJob. The key will be the input * artifact name and the value would be one of the InputArtifact. diff --git a/AiPlatform/src/V1/PipelineJobDetail.php b/AiPlatform/src/V1/PipelineJobDetail.php index 6892ed9b0037..4371fc9f412b 100644 --- a/AiPlatform/src/V1/PipelineJobDetail.php +++ b/AiPlatform/src/V1/PipelineJobDetail.php @@ -20,13 +20,13 @@ class PipelineJobDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Context pipeline_context = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $pipeline_context = null; + protected $pipeline_context = null; /** * Output only. The context of the current pipeline run. * * Generated from protobuf field .google.cloud.aiplatform.v1.Context pipeline_run_context = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $pipeline_run_context = null; + protected $pipeline_run_context = null; /** * Output only. The runtime details of the tasks under the pipeline. * diff --git a/AiPlatform/src/V1/PipelineServiceClient.php b/AiPlatform/src/V1/PipelineServiceClient.php deleted file mode 100644 index 601a3df96da0..000000000000 --- a/AiPlatform/src/V1/PipelineServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/CreateTrainingPipeline', - $argument, - ['\Google\Cloud\AIPlatform\V1\TrainingPipeline', 'decode'], - $metadata, $options); - } - - /** - * Gets a TrainingPipeline. - * @param \Google\Cloud\AIPlatform\V1\GetTrainingPipelineRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetTrainingPipeline(\Google\Cloud\AIPlatform\V1\GetTrainingPipelineRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/GetTrainingPipeline', - $argument, - ['\Google\Cloud\AIPlatform\V1\TrainingPipeline', 'decode'], - $metadata, $options); - } - - /** - * Lists TrainingPipelines in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListTrainingPipelinesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListTrainingPipelines(\Google\Cloud\AIPlatform\V1\ListTrainingPipelinesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/ListTrainingPipelines', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListTrainingPipelinesResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a TrainingPipeline. - * @param \Google\Cloud\AIPlatform\V1\DeleteTrainingPipelineRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteTrainingPipeline(\Google\Cloud\AIPlatform\V1\DeleteTrainingPipelineRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/DeleteTrainingPipeline', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Cancels a TrainingPipeline. - * Starts asynchronous cancellation on the TrainingPipeline. The server - * makes a best effort to cancel the pipeline, but success is not - * guaranteed. Clients can use - * [PipelineService.GetTrainingPipeline][google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline] - * or other methods to check whether the cancellation succeeded or whether the - * pipeline completed despite cancellation. On successful cancellation, - * the TrainingPipeline is not deleted; instead it becomes a pipeline with - * a - * [TrainingPipeline.error][google.cloud.aiplatform.v1.TrainingPipeline.error] - * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`, and - * [TrainingPipeline.state][google.cloud.aiplatform.v1.TrainingPipeline.state] - * is set to `CANCELLED`. - * @param \Google\Cloud\AIPlatform\V1\CancelTrainingPipelineRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CancelTrainingPipeline(\Google\Cloud\AIPlatform\V1\CancelTrainingPipelineRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/CancelTrainingPipeline', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Creates a PipelineJob. A PipelineJob will run immediately when created. - * @param \Google\Cloud\AIPlatform\V1\CreatePipelineJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreatePipelineJob(\Google\Cloud\AIPlatform\V1\CreatePipelineJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/CreatePipelineJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\PipelineJob', 'decode'], - $metadata, $options); - } - - /** - * Gets a PipelineJob. - * @param \Google\Cloud\AIPlatform\V1\GetPipelineJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetPipelineJob(\Google\Cloud\AIPlatform\V1\GetPipelineJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/GetPipelineJob', - $argument, - ['\Google\Cloud\AIPlatform\V1\PipelineJob', 'decode'], - $metadata, $options); - } - - /** - * Lists PipelineJobs in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListPipelineJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListPipelineJobs(\Google\Cloud\AIPlatform\V1\ListPipelineJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/ListPipelineJobs', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListPipelineJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a PipelineJob. - * @param \Google\Cloud\AIPlatform\V1\DeletePipelineJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeletePipelineJob(\Google\Cloud\AIPlatform\V1\DeletePipelineJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/DeletePipelineJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Cancels a PipelineJob. - * Starts asynchronous cancellation on the PipelineJob. The server - * makes a best effort to cancel the pipeline, but success is not - * guaranteed. Clients can use - * [PipelineService.GetPipelineJob][google.cloud.aiplatform.v1.PipelineService.GetPipelineJob] - * or other methods to check whether the cancellation succeeded or whether the - * pipeline completed despite cancellation. On successful cancellation, - * the PipelineJob is not deleted; instead it becomes a pipeline with - * a [PipelineJob.error][google.cloud.aiplatform.v1.PipelineJob.error] value - * with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding - * to `Code.CANCELLED`, and - * [PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to - * `CANCELLED`. - * @param \Google\Cloud\AIPlatform\V1\CancelPipelineJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CancelPipelineJob(\Google\Cloud\AIPlatform\V1\CancelPipelineJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PipelineService/CancelPipelineJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/PipelineTaskDetail.php b/AiPlatform/src/V1/PipelineTaskDetail.php index c11bebe40378..a50bd22cfa69 100644 --- a/AiPlatform/src/V1/PipelineTaskDetail.php +++ b/AiPlatform/src/V1/PipelineTaskDetail.php @@ -20,64 +20,64 @@ class PipelineTaskDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 task_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $task_id = 0; + protected $task_id = 0; /** * Output only. The id of the parent task if the task is within a component * scope. Empty if the task is at the root level. * * Generated from protobuf field int64 parent_task_id = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $parent_task_id = 0; + protected $parent_task_id = 0; /** * Output only. The user specified name of the task that is defined in * [pipeline_spec][google.cloud.aiplatform.v1.PipelineJob.pipeline_spec]. * * Generated from protobuf field string task_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $task_name = ''; + protected $task_name = ''; /** * Output only. Task create time. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Task start time. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Task end time. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. The detailed execution info. * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineTaskExecutorDetail executor_detail = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $executor_detail = null; + protected $executor_detail = null; /** * Output only. State of the task. * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineTaskDetail.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The execution metadata of the task. * * Generated from protobuf field .google.cloud.aiplatform.v1.Execution execution = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $execution = null; + protected $execution = null; /** * Output only. The error that occurred during task execution. * Only populated when the task's state is FAILED or CANCELLED. * * Generated from protobuf field .google.rpc.Status error = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Output only. A list of task status. This field keeps a record of task * status evolving over time. diff --git a/AiPlatform/src/V1/PipelineTaskDetail/PipelineTaskStatus.php b/AiPlatform/src/V1/PipelineTaskDetail/PipelineTaskStatus.php index 79639be6f57a..c582f003989f 100644 --- a/AiPlatform/src/V1/PipelineTaskDetail/PipelineTaskStatus.php +++ b/AiPlatform/src/V1/PipelineTaskDetail/PipelineTaskStatus.php @@ -20,13 +20,13 @@ class PipelineTaskStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp update_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. The state of the task. * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineTaskDetail.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The error that occurred during the state. May be set when * the state is any of the non-final state (PENDING/RUNNING/CANCELLING) or @@ -36,7 +36,7 @@ class PipelineTaskStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.rpc.Status error = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Constructor. diff --git a/AiPlatform/src/V1/PipelineTaskExecutorDetail/ContainerDetail.php b/AiPlatform/src/V1/PipelineTaskExecutorDetail/ContainerDetail.php index ef14edf9c94e..fb5257874dd9 100644 --- a/AiPlatform/src/V1/PipelineTaskExecutorDetail/ContainerDetail.php +++ b/AiPlatform/src/V1/PipelineTaskExecutorDetail/ContainerDetail.php @@ -23,7 +23,7 @@ class ContainerDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string main_job = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $main_job = ''; + protected $main_job = ''; /** * Output only. The name of the * [CustomJob][google.cloud.aiplatform.v1.CustomJob] for the @@ -33,7 +33,7 @@ class ContainerDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string pre_caching_check_job = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $pre_caching_check_job = ''; + protected $pre_caching_check_job = ''; /** * Output only. The names of the previously failed * [CustomJob][google.cloud.aiplatform.v1.CustomJob] for the main container diff --git a/AiPlatform/src/V1/PipelineTaskExecutorDetail/CustomJobDetail.php b/AiPlatform/src/V1/PipelineTaskExecutorDetail/CustomJobDetail.php index fae9e6a075c2..f1f898fcd76b 100644 --- a/AiPlatform/src/V1/PipelineTaskExecutorDetail/CustomJobDetail.php +++ b/AiPlatform/src/V1/PipelineTaskExecutorDetail/CustomJobDetail.php @@ -21,7 +21,7 @@ class CustomJobDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string job = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $job = ''; + protected $job = ''; /** * Output only. The names of the previously failed * [CustomJob][google.cloud.aiplatform.v1.CustomJob]. The list includes the diff --git a/AiPlatform/src/V1/PipelineTemplateMetadata.php b/AiPlatform/src/V1/PipelineTemplateMetadata.php index 1018b49a69ed..a009c94678ac 100644 --- a/AiPlatform/src/V1/PipelineTemplateMetadata.php +++ b/AiPlatform/src/V1/PipelineTemplateMetadata.php @@ -27,7 +27,7 @@ class PipelineTemplateMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 3; */ - private $version = ''; + protected $version = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/Port.php b/AiPlatform/src/V1/Port.php index def3873b6c21..6e9ac572fcdd 100644 --- a/AiPlatform/src/V1/Port.php +++ b/AiPlatform/src/V1/Port.php @@ -21,7 +21,7 @@ class Port extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 container_port = 3; */ - private $container_port = 0; + protected $container_port = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/PredefinedSplit.php b/AiPlatform/src/V1/PredefinedSplit.php index ef14fb5c0e83..730def2309d1 100644 --- a/AiPlatform/src/V1/PredefinedSplit.php +++ b/AiPlatform/src/V1/PredefinedSplit.php @@ -27,7 +27,7 @@ class PredefinedSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $key = ''; + protected $key = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/PredictRequest.php b/AiPlatform/src/V1/PredictRequest.php index a0e4c18580a1..389959a55afd 100644 --- a/AiPlatform/src/V1/PredictRequest.php +++ b/AiPlatform/src/V1/PredictRequest.php @@ -23,7 +23,7 @@ class PredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Required. The instances that are the input to the prediction call. * A DeployedModel may have an upper limit on the number of instances it @@ -47,7 +47,7 @@ class PredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value parameters = 3; */ - private $parameters = null; + protected $parameters = null; /** * @param string $endpoint Required. The name of the Endpoint requested to serve the prediction. diff --git a/AiPlatform/src/V1/PredictRequestResponseLoggingConfig.php b/AiPlatform/src/V1/PredictRequestResponseLoggingConfig.php index 1ae527784567..4dcb30ae67cc 100644 --- a/AiPlatform/src/V1/PredictRequestResponseLoggingConfig.php +++ b/AiPlatform/src/V1/PredictRequestResponseLoggingConfig.php @@ -20,14 +20,14 @@ class PredictRequestResponseLoggingConfig extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field bool enabled = 1; */ - private $enabled = false; + protected $enabled = false; /** * Percentage of requests to be logged, expressed as a fraction in * range(0,1]. * * Generated from protobuf field double sampling_rate = 2; */ - private $sampling_rate = 0.0; + protected $sampling_rate = 0.0; /** * BigQuery table for logging. * If only given a project, a new dataset will be created with name @@ -38,7 +38,7 @@ class PredictRequestResponseLoggingConfig extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field .google.cloud.aiplatform.v1.BigQueryDestination bigquery_destination = 3; */ - private $bigquery_destination = null; + protected $bigquery_destination = null; /** * Constructor. diff --git a/AiPlatform/src/V1/PredictResponse.php b/AiPlatform/src/V1/PredictResponse.php index 73963c60196d..66f26ce95edf 100644 --- a/AiPlatform/src/V1/PredictResponse.php +++ b/AiPlatform/src/V1/PredictResponse.php @@ -31,21 +31,21 @@ class PredictResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string deployed_model_id = 2; */ - private $deployed_model_id = ''; + protected $deployed_model_id = ''; /** * Output only. The resource name of the Model which is deployed as the * DeployedModel that this prediction hits. * * Generated from protobuf field string model = 3 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * Output only. The version ID of the Model which is deployed as the * DeployedModel that this prediction hits. * * Generated from protobuf field string model_version_id = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $model_version_id = ''; + protected $model_version_id = ''; /** * Output only. The [display * name][google.cloud.aiplatform.v1.Model.display_name] of the Model which is @@ -53,14 +53,14 @@ class PredictResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model_display_name = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $model_display_name = ''; + protected $model_display_name = ''; /** * Output only. Request-level metadata returned by the model. The metadata * type will be dependent upon the model implementation. * * Generated from protobuf field .google.protobuf.Value metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $metadata = null; + protected $metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/PredictSchemata.php b/AiPlatform/src/V1/PredictSchemata.php index da256c34e467..3dd33cc0e6bb 100644 --- a/AiPlatform/src/V1/PredictSchemata.php +++ b/AiPlatform/src/V1/PredictSchemata.php @@ -34,7 +34,7 @@ class PredictSchemata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_schema_uri = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $instance_schema_uri = ''; + protected $instance_schema_uri = ''; /** * Immutable. Points to a YAML file stored on Google Cloud Storage describing * the parameters of prediction and explanation via @@ -52,7 +52,7 @@ class PredictSchemata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parameters_schema_uri = 2 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $parameters_schema_uri = ''; + protected $parameters_schema_uri = ''; /** * Immutable. Points to a YAML file stored on Google Cloud Storage describing * the format of a single prediction produced by this Model, which are @@ -70,7 +70,7 @@ class PredictSchemata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string prediction_schema_uri = 3 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $prediction_schema_uri = ''; + protected $prediction_schema_uri = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/PredictionServiceClient.php b/AiPlatform/src/V1/PredictionServiceClient.php deleted file mode 100644 index da9af7577070..000000000000 --- a/AiPlatform/src/V1/PredictionServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.PredictionService/Predict', - $argument, - ['\Google\Cloud\AIPlatform\V1\PredictResponse', 'decode'], - $metadata, $options); - } - - /** - * Perform an online prediction with an arbitrary HTTP payload. - * - * The response includes the following HTTP headers: - * - * * `X-Vertex-AI-Endpoint-Id`: ID of the - * [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this - * prediction. - * - * * `X-Vertex-AI-Deployed-Model-Id`: ID of the Endpoint's - * [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this - * prediction. - * @param \Google\Cloud\AIPlatform\V1\RawPredictRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function RawPredict(\Google\Cloud\AIPlatform\V1\RawPredictRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PredictionService/RawPredict', - $argument, - ['\Google\Api\HttpBody', 'decode'], - $metadata, $options); - } - - /** - * Perform an online explanation. - * - * If - * [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] - * is specified, the corresponding DeployModel must have - * [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] - * populated. If - * [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] - * is not specified, all DeployedModels must have - * [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] - * populated. Only deployed AutoML tabular Models have - * explanation_spec. - * @param \Google\Cloud\AIPlatform\V1\ExplainRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function Explain(\Google\Cloud\AIPlatform\V1\ExplainRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.PredictionService/Explain', - $argument, - ['\Google\Cloud\AIPlatform\V1\ExplainResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/Presets.php b/AiPlatform/src/V1/Presets.php index 85b0fe7e550a..3b2066227e65 100644 --- a/AiPlatform/src/V1/Presets.php +++ b/AiPlatform/src/V1/Presets.php @@ -21,7 +21,7 @@ class Presets extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.aiplatform.v1.Presets.Query query = 1; */ - private $query = null; + protected $query = null; /** * The modality of the uploaded model, which automatically configures the * distance measurement and feature normalization for the underlying example @@ -30,7 +30,7 @@ class Presets extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Presets.Modality modality = 2; */ - private $modality = 0; + protected $modality = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/PrivateEndpoints.php b/AiPlatform/src/V1/PrivateEndpoints.php index ab0d213bd9cf..d8b2a2851f77 100644 --- a/AiPlatform/src/V1/PrivateEndpoints.php +++ b/AiPlatform/src/V1/PrivateEndpoints.php @@ -24,26 +24,26 @@ class PrivateEndpoints extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string predict_http_uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $predict_http_uri = ''; + protected $predict_http_uri = ''; /** * Output only. Http(s) path to send explain requests. * * Generated from protobuf field string explain_http_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $explain_http_uri = ''; + protected $explain_http_uri = ''; /** * Output only. Http(s) path to send health check requests. * * Generated from protobuf field string health_http_uri = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $health_http_uri = ''; + protected $health_http_uri = ''; /** * Output only. The name of the service attachment resource. Populated if * private service connect is enabled. * * Generated from protobuf field string service_attachment = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $service_attachment = ''; + protected $service_attachment = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/PrivateServiceConnectConfig.php b/AiPlatform/src/V1/PrivateServiceConnectConfig.php index bccce955cc89..f8ba7cc670b9 100644 --- a/AiPlatform/src/V1/PrivateServiceConnectConfig.php +++ b/AiPlatform/src/V1/PrivateServiceConnectConfig.php @@ -20,7 +20,7 @@ class PrivateServiceConnectConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_private_service_connect = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $enable_private_service_connect = false; + protected $enable_private_service_connect = false; /** * A list of Projects from which the forwarding rule will target the service * attachment. diff --git a/AiPlatform/src/V1/Probe.php b/AiPlatform/src/V1/Probe.php index 9634b19f663e..5783d584ecdf 100644 --- a/AiPlatform/src/V1/Probe.php +++ b/AiPlatform/src/V1/Probe.php @@ -23,7 +23,7 @@ class Probe extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 period_seconds = 2; */ - private $period_seconds = 0; + protected $period_seconds = 0; /** * Number of seconds after which the probe times out. Defaults to 1 second. * Minimum value is 1. Must be greater or equal to period_seconds. @@ -31,7 +31,7 @@ class Probe extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 timeout_seconds = 3; */ - private $timeout_seconds = 0; + protected $timeout_seconds = 0; protected $probe_type; /** diff --git a/AiPlatform/src/V1/PscAutomatedEndpoints.php b/AiPlatform/src/V1/PscAutomatedEndpoints.php index 8b4ed8311659..38684c5a3079 100644 --- a/AiPlatform/src/V1/PscAutomatedEndpoints.php +++ b/AiPlatform/src/V1/PscAutomatedEndpoints.php @@ -21,19 +21,19 @@ class PscAutomatedEndpoints extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project_id = 1; */ - private $project_id = ''; + protected $project_id = ''; /** * Corresponding network in pscAutomationConfigs. * * Generated from protobuf field string network = 2; */ - private $network = ''; + protected $network = ''; /** * Ip Address created by the automated forwarding rule. * * Generated from protobuf field string match_address = 3; */ - private $match_address = ''; + protected $match_address = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/PublisherModel.php b/AiPlatform/src/V1/PublisherModel.php index daa85979ab06..4acc5cd3902b 100644 --- a/AiPlatform/src/V1/PublisherModel.php +++ b/AiPlatform/src/V1/PublisherModel.php @@ -20,7 +20,7 @@ class PublisherModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Immutable. The version ID of the PublisherModel. * A new version is committed when a new model version is uploaded under an @@ -29,19 +29,19 @@ class PublisherModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version_id = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $version_id = ''; + protected $version_id = ''; /** * Required. Indicates the open source category of the publisher model. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.OpenSourceCategory open_source_category = 7 [(.google.api.field_behavior) = REQUIRED]; */ - private $open_source_category = 0; + protected $open_source_category = 0; /** * Optional. Supported call-to-action options. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction supported_actions = 19 [(.google.api.field_behavior) = OPTIONAL]; */ - private $supported_actions = null; + protected $supported_actions = null; /** * Optional. Additional information about the model's Frameworks. * @@ -53,13 +53,13 @@ class PublisherModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.LaunchStage launch_stage = 29 [(.google.api.field_behavior) = OPTIONAL]; */ - private $launch_stage = 0; + protected $launch_stage = 0; /** * Optional. Indicates the state of the model version. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.VersionState version_state = 37 [(.google.api.field_behavior) = OPTIONAL]; */ - private $version_state = 0; + protected $version_state = 0; /** * Optional. Output only. Immutable. Used to indicate this model has a * publisher model and provide the template of the publisher model resource @@ -67,7 +67,7 @@ class PublisherModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string publisher_model_template = 30 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $publisher_model_template = ''; + protected $publisher_model_template = ''; /** * Optional. The schemata that describes formats of the PublisherModel's * predictions and explanations as given and returned via @@ -75,7 +75,7 @@ class PublisherModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PredictSchemata predict_schemata = 31 [(.google.api.field_behavior) = OPTIONAL]; */ - private $predict_schemata = null; + protected $predict_schemata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/PublisherModel/CallToAction.php b/AiPlatform/src/V1/PublisherModel/CallToAction.php index ce1778237c8d..fed087385f9d 100644 --- a/AiPlatform/src/V1/PublisherModel/CallToAction.php +++ b/AiPlatform/src/V1/PublisherModel/CallToAction.php @@ -20,79 +20,79 @@ class CallToAction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.ViewRestApi view_rest_api = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $view_rest_api = null; + protected $view_rest_api = null; /** * Optional. Open notebook of the PublisherModel. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.RegionalResourceReferences open_notebook = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $open_notebook = null; + protected $open_notebook = null; /** * Optional. Open notebooks of the PublisherModel. * * Generated from protobuf field optional .google.cloud.aiplatform.v1.PublisherModel.CallToAction.OpenNotebooks open_notebooks = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $open_notebooks = null; + protected $open_notebooks = null; /** * Optional. Create application using the PublisherModel. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.RegionalResourceReferences create_application = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $create_application = null; + protected $create_application = null; /** * Optional. Open fine-tuning pipeline of the PublisherModel. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.RegionalResourceReferences open_fine_tuning_pipeline = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $open_fine_tuning_pipeline = null; + protected $open_fine_tuning_pipeline = null; /** * Optional. Open fine-tuning pipelines of the PublisherModel. * * Generated from protobuf field optional .google.cloud.aiplatform.v1.PublisherModel.CallToAction.OpenFineTuningPipelines open_fine_tuning_pipelines = 13 [(.google.api.field_behavior) = OPTIONAL]; */ - private $open_fine_tuning_pipelines = null; + protected $open_fine_tuning_pipelines = null; /** * Optional. Open prompt-tuning pipeline of the PublisherModel. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.RegionalResourceReferences open_prompt_tuning_pipeline = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $open_prompt_tuning_pipeline = null; + protected $open_prompt_tuning_pipeline = null; /** * Optional. Open Genie / Playground. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.RegionalResourceReferences open_genie = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $open_genie = null; + protected $open_genie = null; /** * Optional. Deploy the PublisherModel to Vertex Endpoint. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.Deploy deploy = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $deploy = null; + protected $deploy = null; /** * Optional. Deploy PublisherModel to Google Kubernetes Engine. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.DeployGke deploy_gke = 14 [(.google.api.field_behavior) = OPTIONAL]; */ - private $deploy_gke = null; + protected $deploy_gke = null; /** * Optional. Open in Generation AI Studio. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.RegionalResourceReferences open_generation_ai_studio = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $open_generation_ai_studio = null; + protected $open_generation_ai_studio = null; /** * Optional. Request for access. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.RegionalResourceReferences request_access = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_access = null; + protected $request_access = null; /** * Optional. Open evaluation pipeline of the PublisherModel. * * Generated from protobuf field .google.cloud.aiplatform.v1.PublisherModel.CallToAction.RegionalResourceReferences open_evaluation_pipeline = 11 [(.google.api.field_behavior) = OPTIONAL]; */ - private $open_evaluation_pipeline = null; + protected $open_evaluation_pipeline = null; /** * Constructor. diff --git a/AiPlatform/src/V1/PublisherModel/CallToAction/Deploy.php b/AiPlatform/src/V1/PublisherModel/CallToAction/Deploy.php index 057ad509a6ab..05b01a0de67e 100644 --- a/AiPlatform/src/V1/PublisherModel/CallToAction/Deploy.php +++ b/AiPlatform/src/V1/PublisherModel/CallToAction/Deploy.php @@ -21,48 +21,48 @@ class Deploy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model_display_name = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $model_display_name = ''; + protected $model_display_name = ''; /** * Optional. Large model reference. When this is set, model_artifact_spec * is not needed. * * Generated from protobuf field .google.cloud.aiplatform.v1.LargeModelReference large_model_reference = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $large_model_reference = null; + protected $large_model_reference = null; /** * Optional. The specification of the container that is to be used when * deploying this Model in Vertex AI. Not present for Large Models. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelContainerSpec container_spec = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $container_spec = null; + protected $container_spec = null; /** * Optional. The path to the directory containing the Model artifact and * any of its supporting files. * * Generated from protobuf field string artifact_uri = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $artifact_uri = ''; + protected $artifact_uri = ''; /** * Optional. The name of the deploy task (e.g., "text to image * generation"). * * Generated from protobuf field optional string deploy_task_name = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $deploy_task_name = null; + protected $deploy_task_name = null; /** * Required. The title of the regional resource reference. * * Generated from protobuf field string title = 8 [(.google.api.field_behavior) = REQUIRED]; */ - private $title = ''; + protected $title = ''; /** * Optional. The signed URI for ephemeral Cloud Storage access to model * artifact. * * Generated from protobuf field string public_artifact_uri = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $public_artifact_uri = ''; + protected $public_artifact_uri = ''; protected $prediction_resources; /** diff --git a/AiPlatform/src/V1/PublisherModel/CallToAction/RegionalResourceReferences.php b/AiPlatform/src/V1/PublisherModel/CallToAction/RegionalResourceReferences.php index efc16c0098d1..6fa9953885ea 100644 --- a/AiPlatform/src/V1/PublisherModel/CallToAction/RegionalResourceReferences.php +++ b/AiPlatform/src/V1/PublisherModel/CallToAction/RegionalResourceReferences.php @@ -27,25 +27,25 @@ class RegionalResourceReferences extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string title = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $title = ''; + protected $title = ''; /** * Optional. Title of the resource. * * Generated from protobuf field optional string resource_title = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $resource_title = null; + protected $resource_title = null; /** * Optional. Use case (CUJ) of the resource. * * Generated from protobuf field optional string resource_use_case = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $resource_use_case = null; + protected $resource_use_case = null; /** * Optional. Description of the resource. * * Generated from protobuf field optional string resource_description = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $resource_description = null; + protected $resource_description = null; /** * Constructor. diff --git a/AiPlatform/src/V1/PublisherModel/CallToAction/ViewRestApi.php b/AiPlatform/src/V1/PublisherModel/CallToAction/ViewRestApi.php index 9413f11171a4..fb27ec3d0677 100644 --- a/AiPlatform/src/V1/PublisherModel/CallToAction/ViewRestApi.php +++ b/AiPlatform/src/V1/PublisherModel/CallToAction/ViewRestApi.php @@ -26,7 +26,7 @@ class ViewRestApi extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string title = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $title = ''; + protected $title = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/PublisherModel/Documentation.php b/AiPlatform/src/V1/PublisherModel/Documentation.php index 325fa405f9cc..9c0aec557d49 100644 --- a/AiPlatform/src/V1/PublisherModel/Documentation.php +++ b/AiPlatform/src/V1/PublisherModel/Documentation.php @@ -21,13 +21,13 @@ class Documentation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string title = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $title = ''; + protected $title = ''; /** * Required. Content of this piece of document (in Markdown format). * * Generated from protobuf field string content = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $content = ''; + protected $content = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/PurgeArtifactsMetadata.php b/AiPlatform/src/V1/PurgeArtifactsMetadata.php index b0661f6d74b3..5c273df921ef 100644 --- a/AiPlatform/src/V1/PurgeArtifactsMetadata.php +++ b/AiPlatform/src/V1/PurgeArtifactsMetadata.php @@ -21,7 +21,7 @@ class PurgeArtifactsMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/PurgeArtifactsRequest.php b/AiPlatform/src/V1/PurgeArtifactsRequest.php index 537fb664fb25..45c817be093f 100644 --- a/AiPlatform/src/V1/PurgeArtifactsRequest.php +++ b/AiPlatform/src/V1/PurgeArtifactsRequest.php @@ -23,14 +23,14 @@ class PurgeArtifactsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. A required filter matching the Artifacts to be purged. * E.g., `update_time <= 2020-11-19T11:30:00-04:00`. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Flag to indicate to actually perform the purge. * If `force` is set to false, the method will return a sample of @@ -38,7 +38,7 @@ class PurgeArtifactsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool force = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $force = false; + protected $force = false; /** * @param string $parent Required. The metadata store to purge Artifacts from. diff --git a/AiPlatform/src/V1/PurgeArtifactsResponse.php b/AiPlatform/src/V1/PurgeArtifactsResponse.php index ccd482eeccd2..db7da9771d03 100644 --- a/AiPlatform/src/V1/PurgeArtifactsResponse.php +++ b/AiPlatform/src/V1/PurgeArtifactsResponse.php @@ -22,7 +22,7 @@ class PurgeArtifactsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 purge_count = 1; */ - private $purge_count = 0; + protected $purge_count = 0; /** * A sample of the Artifact names that will be deleted. * Only populated if `force` is set to false. The maximum number of samples is diff --git a/AiPlatform/src/V1/PurgeContextsMetadata.php b/AiPlatform/src/V1/PurgeContextsMetadata.php index b1f8e6822b97..44825c76a605 100644 --- a/AiPlatform/src/V1/PurgeContextsMetadata.php +++ b/AiPlatform/src/V1/PurgeContextsMetadata.php @@ -21,7 +21,7 @@ class PurgeContextsMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/PurgeContextsRequest.php b/AiPlatform/src/V1/PurgeContextsRequest.php index 50d73fdc8b24..5e768771c02c 100644 --- a/AiPlatform/src/V1/PurgeContextsRequest.php +++ b/AiPlatform/src/V1/PurgeContextsRequest.php @@ -23,14 +23,14 @@ class PurgeContextsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. A required filter matching the Contexts to be purged. * E.g., `update_time <= 2020-11-19T11:30:00-04:00`. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Flag to indicate to actually perform the purge. * If `force` is set to false, the method will return a sample of @@ -38,7 +38,7 @@ class PurgeContextsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool force = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $force = false; + protected $force = false; /** * @param string $parent Required. The metadata store to purge Contexts from. diff --git a/AiPlatform/src/V1/PurgeContextsResponse.php b/AiPlatform/src/V1/PurgeContextsResponse.php index cc4428647f08..2e7c049e895b 100644 --- a/AiPlatform/src/V1/PurgeContextsResponse.php +++ b/AiPlatform/src/V1/PurgeContextsResponse.php @@ -22,7 +22,7 @@ class PurgeContextsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 purge_count = 1; */ - private $purge_count = 0; + protected $purge_count = 0; /** * A sample of the Context names that will be deleted. * Only populated if `force` is set to false. The maximum number of samples is diff --git a/AiPlatform/src/V1/PurgeExecutionsMetadata.php b/AiPlatform/src/V1/PurgeExecutionsMetadata.php index 5c6a3c4d83bc..d0cd029efbd3 100644 --- a/AiPlatform/src/V1/PurgeExecutionsMetadata.php +++ b/AiPlatform/src/V1/PurgeExecutionsMetadata.php @@ -21,7 +21,7 @@ class PurgeExecutionsMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/PurgeExecutionsRequest.php b/AiPlatform/src/V1/PurgeExecutionsRequest.php index dad2ce348aca..3cd814d9caa0 100644 --- a/AiPlatform/src/V1/PurgeExecutionsRequest.php +++ b/AiPlatform/src/V1/PurgeExecutionsRequest.php @@ -23,14 +23,14 @@ class PurgeExecutionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. A required filter matching the Executions to be purged. * E.g., `update_time <= 2020-11-19T11:30:00-04:00`. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Flag to indicate to actually perform the purge. * If `force` is set to false, the method will return a sample of @@ -38,7 +38,7 @@ class PurgeExecutionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool force = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $force = false; + protected $force = false; /** * @param string $parent Required. The metadata store to purge Executions from. diff --git a/AiPlatform/src/V1/PurgeExecutionsResponse.php b/AiPlatform/src/V1/PurgeExecutionsResponse.php index 14073c7872b5..493a6831374a 100644 --- a/AiPlatform/src/V1/PurgeExecutionsResponse.php +++ b/AiPlatform/src/V1/PurgeExecutionsResponse.php @@ -23,7 +23,7 @@ class PurgeExecutionsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 purge_count = 1; */ - private $purge_count = 0; + protected $purge_count = 0; /** * A sample of the Execution names that will be deleted. * Only populated if `force` is set to false. The maximum number of samples is diff --git a/AiPlatform/src/V1/PythonPackageSpec.php b/AiPlatform/src/V1/PythonPackageSpec.php index b8430078710f..12e697f54867 100644 --- a/AiPlatform/src/V1/PythonPackageSpec.php +++ b/AiPlatform/src/V1/PythonPackageSpec.php @@ -25,7 +25,7 @@ class PythonPackageSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string executor_image_uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $executor_image_uri = ''; + protected $executor_image_uri = ''; /** * Required. The Google Cloud Storage location of the Python package files * which are the training program and its dependent packages. The maximum @@ -39,7 +39,7 @@ class PythonPackageSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string python_module = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $python_module = ''; + protected $python_module = ''; /** * Command line arguments to be passed to the Python task. * diff --git a/AiPlatform/src/V1/QueryArtifactLineageSubgraphRequest.php b/AiPlatform/src/V1/QueryArtifactLineageSubgraphRequest.php index 03eefb94f9d9..a1cc28dde0c0 100644 --- a/AiPlatform/src/V1/QueryArtifactLineageSubgraphRequest.php +++ b/AiPlatform/src/V1/QueryArtifactLineageSubgraphRequest.php @@ -26,7 +26,7 @@ class QueryArtifactLineageSubgraphRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string artifact = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $artifact = ''; + protected $artifact = ''; /** * Specifies the size of the lineage graph in terms of number of hops from the * specified artifact. @@ -36,7 +36,7 @@ class QueryArtifactLineageSubgraphRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field int32 max_hops = 2; */ - private $max_hops = 0; + protected $max_hops = 0; /** * Filter specifying the boolean condition for the Artifacts to satisfy in * order to be part of the Lineage Subgraph. @@ -63,7 +63,7 @@ class QueryArtifactLineageSubgraphRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string filter = 3; */ - private $filter = ''; + protected $filter = ''; /** * @param string $artifact Required. The resource name of the Artifact whose Lineage needs to be diff --git a/AiPlatform/src/V1/QueryContextLineageSubgraphRequest.php b/AiPlatform/src/V1/QueryContextLineageSubgraphRequest.php index 3c5d72451db5..d1cbcb689944 100644 --- a/AiPlatform/src/V1/QueryContextLineageSubgraphRequest.php +++ b/AiPlatform/src/V1/QueryContextLineageSubgraphRequest.php @@ -27,7 +27,7 @@ class QueryContextLineageSubgraphRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string context = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $context = ''; + protected $context = ''; /** * @param string $context Required. The resource name of the Context whose Artifacts and Executions diff --git a/AiPlatform/src/V1/QueryDeployedModelsRequest.php b/AiPlatform/src/V1/QueryDeployedModelsRequest.php index fb48cd5a1e9b..abd29b8c6976 100644 --- a/AiPlatform/src/V1/QueryDeployedModelsRequest.php +++ b/AiPlatform/src/V1/QueryDeployedModelsRequest.php @@ -22,14 +22,14 @@ class QueryDeployedModelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string deployment_resource_pool = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployment_resource_pool = ''; + protected $deployment_resource_pool = ''; /** * The maximum number of DeployedModels to return. The service may return * fewer than this value. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous `QueryDeployedModels` call. * Provide this to retrieve the subsequent page. @@ -39,7 +39,7 @@ class QueryDeployedModelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $deploymentResourcePool Required. The name of the target DeploymentResourcePool to query. diff --git a/AiPlatform/src/V1/QueryDeployedModelsResponse.php b/AiPlatform/src/V1/QueryDeployedModelsResponse.php index e93eced1db1d..10c15e8c6606 100644 --- a/AiPlatform/src/V1/QueryDeployedModelsResponse.php +++ b/AiPlatform/src/V1/QueryDeployedModelsResponse.php @@ -28,7 +28,7 @@ class QueryDeployedModelsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * References to the DeployedModels that share the specified * deploymentResourcePool. @@ -41,14 +41,14 @@ class QueryDeployedModelsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 total_deployed_model_count = 4; */ - private $total_deployed_model_count = 0; + protected $total_deployed_model_count = 0; /** * The total number of Endpoints that have DeployedModels on this * DeploymentResourcePool. * * Generated from protobuf field int32 total_endpoint_count = 5; */ - private $total_endpoint_count = 0; + protected $total_endpoint_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/QueryExecutionInputsAndOutputsRequest.php b/AiPlatform/src/V1/QueryExecutionInputsAndOutputsRequest.php index e97fd7fb36ed..7ff55225859c 100644 --- a/AiPlatform/src/V1/QueryExecutionInputsAndOutputsRequest.php +++ b/AiPlatform/src/V1/QueryExecutionInputsAndOutputsRequest.php @@ -23,7 +23,7 @@ class QueryExecutionInputsAndOutputsRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string execution = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $execution = ''; + protected $execution = ''; /** * @param string $execution Required. The resource name of the Execution whose input and output diff --git a/AiPlatform/src/V1/RawPredictRequest.php b/AiPlatform/src/V1/RawPredictRequest.php index e9c10f73b092..a9fd56069156 100644 --- a/AiPlatform/src/V1/RawPredictRequest.php +++ b/AiPlatform/src/V1/RawPredictRequest.php @@ -23,7 +23,7 @@ class RawPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * The prediction input. Supports HTTP headers and arbitrary data payload. * A [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] may have an @@ -41,7 +41,7 @@ class RawPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.api.HttpBody http_body = 2; */ - private $http_body = null; + protected $http_body = null; /** * @param string $endpoint Required. The name of the Endpoint requested to serve the prediction. diff --git a/AiPlatform/src/V1/RayMetricSpec.php b/AiPlatform/src/V1/RayMetricSpec.php index 126e139fd411..a704034e4a2d 100644 --- a/AiPlatform/src/V1/RayMetricSpec.php +++ b/AiPlatform/src/V1/RayMetricSpec.php @@ -20,7 +20,7 @@ class RayMetricSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disabled = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $disabled = false; + protected $disabled = false; /** * Constructor. diff --git a/AiPlatform/src/V1/RaySpec.php b/AiPlatform/src/V1/RaySpec.php index d2826aac5857..d8354d76c376 100644 --- a/AiPlatform/src/V1/RaySpec.php +++ b/AiPlatform/src/V1/RaySpec.php @@ -28,7 +28,7 @@ class RaySpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string image_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $image_uri = ''; + protected $image_uri = ''; /** * Optional. Required if image_uri isn't set. A map of resource_pool_id to * prebuild Ray image if user need to use different images for different @@ -51,13 +51,13 @@ class RaySpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string head_node_resource_pool_id = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $head_node_resource_pool_id = ''; + protected $head_node_resource_pool_id = ''; /** * Optional. Ray metrics configurations. * * Generated from protobuf field .google.cloud.aiplatform.v1.RayMetricSpec ray_metric_spec = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $ray_metric_spec = null; + protected $ray_metric_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ReadFeatureValuesRequest.php b/AiPlatform/src/V1/ReadFeatureValuesRequest.php index 7c0561037be4..c8b14314a1e7 100644 --- a/AiPlatform/src/V1/ReadFeatureValuesRequest.php +++ b/AiPlatform/src/V1/ReadFeatureValuesRequest.php @@ -25,7 +25,7 @@ class ReadFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_type = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $entity_type = ''; + protected $entity_type = ''; /** * Required. ID for a specific entity. For example, * for a machine learning model predicting user clicks on a website, an entity @@ -33,13 +33,13 @@ class ReadFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $entity_id = ''; + protected $entity_id = ''; /** * Required. Selector choosing Features of the target EntityType. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureSelector feature_selector = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_selector = null; + protected $feature_selector = null; /** * @param string $entityType Required. The resource name of the EntityType for the entity being read. diff --git a/AiPlatform/src/V1/ReadFeatureValuesResponse.php b/AiPlatform/src/V1/ReadFeatureValuesResponse.php index 66ab61217f88..b430cb4ba2ac 100644 --- a/AiPlatform/src/V1/ReadFeatureValuesResponse.php +++ b/AiPlatform/src/V1/ReadFeatureValuesResponse.php @@ -21,7 +21,7 @@ class ReadFeatureValuesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ReadFeatureValuesResponse.Header header = 1; */ - private $header = null; + protected $header = null; /** * Entity view with Feature values. This may be the entity in the * Featurestore if values for all Features were requested, or a projection @@ -30,7 +30,7 @@ class ReadFeatureValuesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ReadFeatureValuesResponse.EntityView entity_view = 2; */ - private $entity_view = null; + protected $entity_view = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ReadFeatureValuesResponse/EntityView.php b/AiPlatform/src/V1/ReadFeatureValuesResponse/EntityView.php index c3dc884dfead..52f83d82edb5 100644 --- a/AiPlatform/src/V1/ReadFeatureValuesResponse/EntityView.php +++ b/AiPlatform/src/V1/ReadFeatureValuesResponse/EntityView.php @@ -20,7 +20,7 @@ class EntityView extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_id = 1; */ - private $entity_id = ''; + protected $entity_id = ''; /** * Each piece of data holds the k * requested values for one requested Feature. If no values diff --git a/AiPlatform/src/V1/ReadFeatureValuesResponse/FeatureDescriptor.php b/AiPlatform/src/V1/ReadFeatureValuesResponse/FeatureDescriptor.php index 1194d9d604a0..47ed878c75aa 100644 --- a/AiPlatform/src/V1/ReadFeatureValuesResponse/FeatureDescriptor.php +++ b/AiPlatform/src/V1/ReadFeatureValuesResponse/FeatureDescriptor.php @@ -20,7 +20,7 @@ class FeatureDescriptor extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1; */ - private $id = ''; + protected $id = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ReadFeatureValuesResponse/Header.php b/AiPlatform/src/V1/ReadFeatureValuesResponse/Header.php index e2cb3f0d5114..57b5f9059624 100644 --- a/AiPlatform/src/V1/ReadFeatureValuesResponse/Header.php +++ b/AiPlatform/src/V1/ReadFeatureValuesResponse/Header.php @@ -25,7 +25,7 @@ class Header extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_type = 1 [(.google.api.resource_reference) = { */ - private $entity_type = ''; + protected $entity_type = ''; /** * List of Feature metadata corresponding to each piece of * [ReadFeatureValuesResponse.EntityView.data][google.cloud.aiplatform.v1.ReadFeatureValuesResponse.EntityView.data]. diff --git a/AiPlatform/src/V1/ReadIndexDatapointsRequest.php b/AiPlatform/src/V1/ReadIndexDatapointsRequest.php index 530eca132afc..815684e21007 100644 --- a/AiPlatform/src/V1/ReadIndexDatapointsRequest.php +++ b/AiPlatform/src/V1/ReadIndexDatapointsRequest.php @@ -23,13 +23,13 @@ class ReadIndexDatapointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string index_endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $index_endpoint = ''; + protected $index_endpoint = ''; /** * The ID of the DeployedIndex that will serve the request. * * Generated from protobuf field string deployed_index_id = 2; */ - private $deployed_index_id = ''; + protected $deployed_index_id = ''; /** * IDs of the datapoints to be searched for. * diff --git a/AiPlatform/src/V1/ReadTensorboardBlobDataRequest.php b/AiPlatform/src/V1/ReadTensorboardBlobDataRequest.php index 66bcfaf21c55..f1b5a98f39ff 100644 --- a/AiPlatform/src/V1/ReadTensorboardBlobDataRequest.php +++ b/AiPlatform/src/V1/ReadTensorboardBlobDataRequest.php @@ -23,7 +23,7 @@ class ReadTensorboardBlobDataRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string time_series = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $time_series = ''; + protected $time_series = ''; /** * IDs of the blobs to read. * diff --git a/AiPlatform/src/V1/ReadTensorboardSizeRequest.php b/AiPlatform/src/V1/ReadTensorboardSizeRequest.php index a5b74b2d907f..4d0e91a974d4 100644 --- a/AiPlatform/src/V1/ReadTensorboardSizeRequest.php +++ b/AiPlatform/src/V1/ReadTensorboardSizeRequest.php @@ -23,7 +23,7 @@ class ReadTensorboardSizeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string tensorboard = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $tensorboard = ''; + protected $tensorboard = ''; /** * @param string $tensorboard Required. The name of the Tensorboard resource. diff --git a/AiPlatform/src/V1/ReadTensorboardSizeResponse.php b/AiPlatform/src/V1/ReadTensorboardSizeResponse.php index e09c5a6d8b3b..2994b561384b 100644 --- a/AiPlatform/src/V1/ReadTensorboardSizeResponse.php +++ b/AiPlatform/src/V1/ReadTensorboardSizeResponse.php @@ -21,7 +21,7 @@ class ReadTensorboardSizeResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 storage_size_byte = 1; */ - private $storage_size_byte = 0; + protected $storage_size_byte = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/ReadTensorboardTimeSeriesDataRequest.php b/AiPlatform/src/V1/ReadTensorboardTimeSeriesDataRequest.php index 30583a5287d3..c675a1635476 100644 --- a/AiPlatform/src/V1/ReadTensorboardTimeSeriesDataRequest.php +++ b/AiPlatform/src/V1/ReadTensorboardTimeSeriesDataRequest.php @@ -23,7 +23,7 @@ class ReadTensorboardTimeSeriesDataRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string tensorboard_time_series = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $tensorboard_time_series = ''; + protected $tensorboard_time_series = ''; /** * The maximum number of TensorboardTimeSeries' data to return. * This value should be a positive integer. @@ -31,13 +31,13 @@ class ReadTensorboardTimeSeriesDataRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field int32 max_data_points = 2; */ - private $max_data_points = 0; + protected $max_data_points = 0; /** * Reads the TensorboardTimeSeries' data that match the filter expression. * * Generated from protobuf field string filter = 3; */ - private $filter = ''; + protected $filter = ''; /** * @param string $tensorboardTimeSeries Required. The resource name of the TensorboardTimeSeries to read data from. diff --git a/AiPlatform/src/V1/ReadTensorboardTimeSeriesDataResponse.php b/AiPlatform/src/V1/ReadTensorboardTimeSeriesDataResponse.php index b0be9f22724c..1f6ca585dba7 100644 --- a/AiPlatform/src/V1/ReadTensorboardTimeSeriesDataResponse.php +++ b/AiPlatform/src/V1/ReadTensorboardTimeSeriesDataResponse.php @@ -21,7 +21,7 @@ class ReadTensorboardTimeSeriesDataResponse extends \Google\Protobuf\Internal\Me * * Generated from protobuf field .google.cloud.aiplatform.v1.TimeSeriesData time_series_data = 1; */ - private $time_series_data = null; + protected $time_series_data = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ReadTensorboardUsageRequest.php b/AiPlatform/src/V1/ReadTensorboardUsageRequest.php index 5af61a8282e3..bc4901420dd1 100644 --- a/AiPlatform/src/V1/ReadTensorboardUsageRequest.php +++ b/AiPlatform/src/V1/ReadTensorboardUsageRequest.php @@ -23,7 +23,7 @@ class ReadTensorboardUsageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string tensorboard = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $tensorboard = ''; + protected $tensorboard = ''; /** * @param string $tensorboard Required. The name of the Tensorboard resource. diff --git a/AiPlatform/src/V1/ReadTensorboardUsageResponse/PerUserUsageData.php b/AiPlatform/src/V1/ReadTensorboardUsageResponse/PerUserUsageData.php index c3c058d17b12..5f061c454a6d 100644 --- a/AiPlatform/src/V1/ReadTensorboardUsageResponse/PerUserUsageData.php +++ b/AiPlatform/src/V1/ReadTensorboardUsageResponse/PerUserUsageData.php @@ -20,13 +20,13 @@ class PerUserUsageData extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string username = 1; */ - private $username = ''; + protected $username = ''; /** * Number of times the user has read data within the Tensorboard. * * Generated from protobuf field int64 view_count = 2; */ - private $view_count = 0; + protected $view_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/RebootPersistentResourceOperationMetadata.php b/AiPlatform/src/V1/RebootPersistentResourceOperationMetadata.php index 5ca9b9efdd0e..7d4abb0ac994 100644 --- a/AiPlatform/src/V1/RebootPersistentResourceOperationMetadata.php +++ b/AiPlatform/src/V1/RebootPersistentResourceOperationMetadata.php @@ -20,13 +20,13 @@ class RebootPersistentResourceOperationMetadata extends \Google\Protobuf\Interna * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Progress Message for Reboot LRO * * Generated from protobuf field string progress_message = 2; */ - private $progress_message = ''; + protected $progress_message = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/RebootPersistentResourceRequest.php b/AiPlatform/src/V1/RebootPersistentResourceRequest.php index 7ec9c42a0365..442ded6f5a16 100644 --- a/AiPlatform/src/V1/RebootPersistentResourceRequest.php +++ b/AiPlatform/src/V1/RebootPersistentResourceRequest.php @@ -23,7 +23,7 @@ class RebootPersistentResourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the PersistentResource resource. diff --git a/AiPlatform/src/V1/RemoveContextChildrenRequest.php b/AiPlatform/src/V1/RemoveContextChildrenRequest.php index b3037fd7b4e5..bedcf0cfd6db 100644 --- a/AiPlatform/src/V1/RemoveContextChildrenRequest.php +++ b/AiPlatform/src/V1/RemoveContextChildrenRequest.php @@ -23,7 +23,7 @@ class RemoveContextChildrenRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string context = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $context = ''; + protected $context = ''; /** * The resource names of the child Contexts. * diff --git a/AiPlatform/src/V1/RemoveDatapointsRequest.php b/AiPlatform/src/V1/RemoveDatapointsRequest.php index 6f08732e8f6e..5ca14e91ad51 100644 --- a/AiPlatform/src/V1/RemoveDatapointsRequest.php +++ b/AiPlatform/src/V1/RemoveDatapointsRequest.php @@ -23,7 +23,7 @@ class RemoveDatapointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string index = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $index = ''; + protected $index = ''; /** * A list of datapoint ids to be deleted. * diff --git a/AiPlatform/src/V1/ResourcePool.php b/AiPlatform/src/V1/ResourcePool.php index ba312b74a449..035e41fac877 100644 --- a/AiPlatform/src/V1/ResourcePool.php +++ b/AiPlatform/src/V1/ResourcePool.php @@ -23,38 +23,38 @@ class ResourcePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $id = ''; + protected $id = ''; /** * Required. Immutable. The specification of a single machine. * * Generated from protobuf field .google.cloud.aiplatform.v1.MachineSpec machine_spec = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; */ - private $machine_spec = null; + protected $machine_spec = null; /** * Optional. The total number of machines to use for this resource pool. * * Generated from protobuf field optional int64 replica_count = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $replica_count = null; + protected $replica_count = null; /** * Optional. Disk spec for the machine in this node pool. * * Generated from protobuf field .google.cloud.aiplatform.v1.DiskSpec disk_spec = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $disk_spec = null; + protected $disk_spec = null; /** * Output only. The number of machines currently in use by training jobs for * this resource pool. Will replace idle_replica_count. * * Generated from protobuf field int64 used_replica_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $used_replica_count = 0; + protected $used_replica_count = 0; /** * Optional. Optional spec to configure GKE autoscaling * * Generated from protobuf field .google.cloud.aiplatform.v1.ResourcePool.AutoscalingSpec autoscaling_spec = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $autoscaling_spec = null; + protected $autoscaling_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ResourcePool/AutoscalingSpec.php b/AiPlatform/src/V1/ResourcePool/AutoscalingSpec.php index af0d2a21b1c6..7ce4c11037b7 100644 --- a/AiPlatform/src/V1/ResourcePool/AutoscalingSpec.php +++ b/AiPlatform/src/V1/ResourcePool/AutoscalingSpec.php @@ -21,14 +21,14 @@ class AutoscalingSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 min_replica_count = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $min_replica_count = null; + protected $min_replica_count = null; /** * Optional. max replicas in the node pool, * must be ≥ replica_count and > min_replica_count or will throw error * * Generated from protobuf field optional int64 max_replica_count = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $max_replica_count = null; + protected $max_replica_count = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ResourceRuntimeSpec.php b/AiPlatform/src/V1/ResourceRuntimeSpec.php index 2603db6b157e..9bf65b864d45 100644 --- a/AiPlatform/src/V1/ResourceRuntimeSpec.php +++ b/AiPlatform/src/V1/ResourceRuntimeSpec.php @@ -23,14 +23,14 @@ class ResourceRuntimeSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.ServiceAccountSpec service_account_spec = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $service_account_spec = null; + protected $service_account_spec = null; /** * Optional. Ray cluster configuration. * Required when creating a dedicated RayCluster on the PersistentResource. * * Generated from protobuf field .google.cloud.aiplatform.v1.RaySpec ray_spec = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $ray_spec = null; + protected $ray_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ResourcesConsumed.php b/AiPlatform/src/V1/ResourcesConsumed.php index 6279ff842f6c..0d41d5452433 100644 --- a/AiPlatform/src/V1/ResourcesConsumed.php +++ b/AiPlatform/src/V1/ResourcesConsumed.php @@ -22,7 +22,7 @@ class ResourcesConsumed extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double replica_hours = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $replica_hours = 0.0; + protected $replica_hours = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/RestoreDatasetVersionOperationMetadata.php b/AiPlatform/src/V1/RestoreDatasetVersionOperationMetadata.php index 59efa8dfd619..217bf03075fb 100644 --- a/AiPlatform/src/V1/RestoreDatasetVersionOperationMetadata.php +++ b/AiPlatform/src/V1/RestoreDatasetVersionOperationMetadata.php @@ -21,7 +21,7 @@ class RestoreDatasetVersionOperationMetadata extends \Google\Protobuf\Internal\M * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/RestoreDatasetVersionRequest.php b/AiPlatform/src/V1/RestoreDatasetVersionRequest.php index 9b2afc54d556..15ded4c0ef97 100644 --- a/AiPlatform/src/V1/RestoreDatasetVersionRequest.php +++ b/AiPlatform/src/V1/RestoreDatasetVersionRequest.php @@ -23,7 +23,7 @@ class RestoreDatasetVersionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the DatasetVersion resource. diff --git a/AiPlatform/src/V1/ResumeModelDeploymentMonitoringJobRequest.php b/AiPlatform/src/V1/ResumeModelDeploymentMonitoringJobRequest.php index 58fc6d6b097f..221166cae089 100644 --- a/AiPlatform/src/V1/ResumeModelDeploymentMonitoringJobRequest.php +++ b/AiPlatform/src/V1/ResumeModelDeploymentMonitoringJobRequest.php @@ -23,7 +23,7 @@ class ResumeModelDeploymentMonitoringJobRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the ModelDeploymentMonitoringJob to resume. diff --git a/AiPlatform/src/V1/ResumeScheduleRequest.php b/AiPlatform/src/V1/ResumeScheduleRequest.php index a34f4ed6d71b..b0fcb05d11b4 100644 --- a/AiPlatform/src/V1/ResumeScheduleRequest.php +++ b/AiPlatform/src/V1/ResumeScheduleRequest.php @@ -23,7 +23,7 @@ class ResumeScheduleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. Whether to backfill missed runs when the schedule is resumed from * PAUSED state. If set to true, all missed runs will be scheduled. New runs @@ -33,7 +33,7 @@ class ResumeScheduleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool catch_up = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $catch_up = false; + protected $catch_up = false; /** * @param string $name Required. The name of the Schedule resource to be resumed. diff --git a/AiPlatform/src/V1/Retrieval.php b/AiPlatform/src/V1/Retrieval.php index 581e7d138df4..584bb80f7da7 100644 --- a/AiPlatform/src/V1/Retrieval.php +++ b/AiPlatform/src/V1/Retrieval.php @@ -22,7 +22,7 @@ class Retrieval extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disable_attribution = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $disable_attribution = false; + protected $disable_attribution = false; protected $source; /** diff --git a/AiPlatform/src/V1/SafetyRating.php b/AiPlatform/src/V1/SafetyRating.php index 52caea6e68a7..1e6d16fb0727 100644 --- a/AiPlatform/src/V1/SafetyRating.php +++ b/AiPlatform/src/V1/SafetyRating.php @@ -20,38 +20,38 @@ class SafetyRating extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.HarmCategory category = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $category = 0; + protected $category = 0; /** * Output only. Harm probability levels in the content. * * Generated from protobuf field .google.cloud.aiplatform.v1.SafetyRating.HarmProbability probability = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $probability = 0; + protected $probability = 0; /** * Output only. Harm probability score. * * Generated from protobuf field float probability_score = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $probability_score = 0.0; + protected $probability_score = 0.0; /** * Output only. Harm severity levels in the content. * * Generated from protobuf field .google.cloud.aiplatform.v1.SafetyRating.HarmSeverity severity = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $severity = 0; + protected $severity = 0; /** * Output only. Harm severity score. * * Generated from protobuf field float severity_score = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $severity_score = 0.0; + protected $severity_score = 0.0; /** * Output only. Indicates whether the content was filtered out because of this * rating. * * Generated from protobuf field bool blocked = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $blocked = false; + protected $blocked = false; /** * Constructor. diff --git a/AiPlatform/src/V1/SafetySetting.php b/AiPlatform/src/V1/SafetySetting.php index 35baf65e189e..c0e1166ab466 100644 --- a/AiPlatform/src/V1/SafetySetting.php +++ b/AiPlatform/src/V1/SafetySetting.php @@ -20,20 +20,20 @@ class SafetySetting extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.HarmCategory category = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $category = 0; + protected $category = 0; /** * Required. The harm block threshold. * * Generated from protobuf field .google.cloud.aiplatform.v1.SafetySetting.HarmBlockThreshold threshold = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $threshold = 0; + protected $threshold = 0; /** * Optional. Specify if the threshold is used for probability or severity * score. If not specified, the threshold is used for probability score. * * Generated from protobuf field .google.cloud.aiplatform.v1.SafetySetting.HarmBlockMethod method = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $method = 0; + protected $method = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/SampleConfig.php b/AiPlatform/src/V1/SampleConfig.php index b9d38f11b642..661b3269d4fd 100644 --- a/AiPlatform/src/V1/SampleConfig.php +++ b/AiPlatform/src/V1/SampleConfig.php @@ -22,7 +22,7 @@ class SampleConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.SampleConfig.SampleStrategy sample_strategy = 5; */ - private $sample_strategy = 0; + protected $sample_strategy = 0; protected $initial_batch_sample_size; protected $following_batch_sample_size; diff --git a/AiPlatform/src/V1/SampledShapleyAttribution.php b/AiPlatform/src/V1/SampledShapleyAttribution.php index 915167ea132a..d278e3bd3fe2 100644 --- a/AiPlatform/src/V1/SampledShapleyAttribution.php +++ b/AiPlatform/src/V1/SampledShapleyAttribution.php @@ -24,7 +24,7 @@ class SampledShapleyAttribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 path_count = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $path_count = 0; + protected $path_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/SamplingStrategy.php b/AiPlatform/src/V1/SamplingStrategy.php index 694247c239ad..848503ce1523 100644 --- a/AiPlatform/src/V1/SamplingStrategy.php +++ b/AiPlatform/src/V1/SamplingStrategy.php @@ -21,7 +21,7 @@ class SamplingStrategy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.SamplingStrategy.RandomSampleConfig random_sample_config = 1; */ - private $random_sample_config = null; + protected $random_sample_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/SamplingStrategy/RandomSampleConfig.php b/AiPlatform/src/V1/SamplingStrategy/RandomSampleConfig.php index 22f73a5ff5ff..770395755056 100644 --- a/AiPlatform/src/V1/SamplingStrategy/RandomSampleConfig.php +++ b/AiPlatform/src/V1/SamplingStrategy/RandomSampleConfig.php @@ -20,7 +20,7 @@ class RandomSampleConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double sample_rate = 1; */ - private $sample_rate = 0.0; + protected $sample_rate = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/SavedQuery.php b/AiPlatform/src/V1/SavedQuery.php index dcc241e41967..82d7fd0f4e47 100644 --- a/AiPlatform/src/V1/SavedQuery.php +++ b/AiPlatform/src/V1/SavedQuery.php @@ -21,7 +21,7 @@ class SavedQuery extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The user-defined name of the SavedQuery. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -29,31 +29,31 @@ class SavedQuery extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Some additional information about the SavedQuery. * * Generated from protobuf field .google.protobuf.Value metadata = 12; */ - private $metadata = null; + protected $metadata = null; /** * Output only. Timestamp when this SavedQuery was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when SavedQuery was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. Filters on the Annotations in the dataset. * * Generated from protobuf field string annotation_filter = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $annotation_filter = ''; + protected $annotation_filter = ''; /** * Required. Problem type of the SavedQuery. * Allowed values: @@ -70,27 +70,27 @@ class SavedQuery extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string problem_type = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $problem_type = ''; + protected $problem_type = ''; /** * Output only. Number of AnnotationSpecs in the context of the SavedQuery. * * Generated from protobuf field int32 annotation_spec_count = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $annotation_spec_count = 0; + protected $annotation_spec_count = 0; /** * Used to perform a consistent read-modify-write update. If not set, a blind * "overwrite" update happens. * * Generated from protobuf field string etag = 8; */ - private $etag = ''; + protected $etag = ''; /** * Output only. If the Annotations belonging to the SavedQuery can be used for * AutoML training. * * Generated from protobuf field bool support_automl_training = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $support_automl_training = false; + protected $support_automl_training = false; /** * Constructor. diff --git a/AiPlatform/src/V1/Scalar.php b/AiPlatform/src/V1/Scalar.php index 779a9e69be7b..5e961e590f11 100644 --- a/AiPlatform/src/V1/Scalar.php +++ b/AiPlatform/src/V1/Scalar.php @@ -20,7 +20,7 @@ class Scalar extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double value = 1; */ - private $value = 0.0; + protected $value = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/Schedule.php b/AiPlatform/src/V1/Schedule.php index 2fd34e7efc25..89cc4b07e8c6 100644 --- a/AiPlatform/src/V1/Schedule.php +++ b/AiPlatform/src/V1/Schedule.php @@ -21,7 +21,7 @@ class Schedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $name = ''; + protected $name = ''; /** * Required. User provided name of the Schedule. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -29,14 +29,14 @@ class Schedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Optional. Timestamp after which the first run can be scheduled. * Default to Schedule create time if not specified. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $start_time = null; + protected $start_time = null; /** * Optional. Timestamp after which no new runs can be scheduled. * If specified, The schedule will be completed when either @@ -47,7 +47,7 @@ class Schedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp end_time = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $end_time = null; + protected $end_time = null; /** * Optional. Maximum run count of the schedule. * If specified, The schedule will be completed when either @@ -58,31 +58,31 @@ class Schedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 max_run_count = 16 [(.google.api.field_behavior) = OPTIONAL]; */ - private $max_run_count = 0; + protected $max_run_count = 0; /** * Output only. The number of runs started by this schedule. * * Generated from protobuf field int64 started_run_count = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $started_run_count = 0; + protected $started_run_count = 0; /** * Output only. The state of this Schedule. * * Generated from protobuf field .google.cloud.aiplatform.v1.Schedule.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Timestamp when this Schedule was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Schedule was updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. Timestamp when this Schedule should schedule the next run. * Having a next_run_time in the past means the runs are being started @@ -90,21 +90,21 @@ class Schedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp next_run_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_run_time = null; + protected $next_run_time = null; /** * Output only. Timestamp when this Schedule was last paused. * Unset if never paused. * * Generated from protobuf field .google.protobuf.Timestamp last_pause_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $last_pause_time = null; + protected $last_pause_time = null; /** * Output only. Timestamp when this Schedule was last resumed. * Unset if never resumed from pause. * * Generated from protobuf field .google.protobuf.Timestamp last_resume_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $last_resume_time = null; + protected $last_resume_time = null; /** * Required. Maximum number of runs that can be started concurrently for this * Schedule. This is the limit for starting the scheduled requests and not the @@ -112,7 +112,7 @@ class Schedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 max_concurrent_run_count = 11 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_concurrent_run_count = 0; + protected $max_concurrent_run_count = 0; /** * Optional. Whether new scheduled runs can be queued when max_concurrent_runs * limit is reached. If set to true, new runs will be queued instead of @@ -120,7 +120,7 @@ class Schedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_queueing = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $allow_queueing = false; + protected $allow_queueing = false; /** * Output only. Whether to backfill missed runs when the schedule is resumed * from PAUSED state. If set to true, all missed runs will be scheduled. New @@ -128,7 +128,7 @@ class Schedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool catch_up = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $catch_up = false; + protected $catch_up = false; /** * Output only. Response of the last scheduled run. * This is the response for starting the scheduled requests and not the @@ -137,7 +137,7 @@ class Schedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Schedule.RunResponse last_scheduled_run_response = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $last_scheduled_run_response = null; + protected $last_scheduled_run_response = null; protected $time_specification; protected $request; diff --git a/AiPlatform/src/V1/Schedule/RunResponse.php b/AiPlatform/src/V1/Schedule/RunResponse.php index 0cd7dfa917d9..62593a3f5306 100644 --- a/AiPlatform/src/V1/Schedule/RunResponse.php +++ b/AiPlatform/src/V1/Schedule/RunResponse.php @@ -20,13 +20,13 @@ class RunResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp scheduled_run_time = 1; */ - private $scheduled_run_time = null; + protected $scheduled_run_time = null; /** * The response of the scheduled run. * * Generated from protobuf field string run_response = 2; */ - private $run_response = ''; + protected $run_response = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ScheduleServiceClient.php b/AiPlatform/src/V1/ScheduleServiceClient.php deleted file mode 100644 index e172aec6ea60..000000000000 --- a/AiPlatform/src/V1/ScheduleServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -.google.protobuf.Duration timeout = 1; */ - private $timeout = null; + protected $timeout = null; /** * Restarts the entire CustomJob if a worker gets restarted. * This feature can be used by distributed training jobs that are not @@ -28,7 +28,7 @@ class Scheduling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool restart_job_on_worker_restart = 3; */ - private $restart_job_on_worker_restart = false; + protected $restart_job_on_worker_restart = false; /** * Optional. Indicates if the job should retry for internal errors after the * job starts running. If true, overrides @@ -36,7 +36,7 @@ class Scheduling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool disable_retries = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $disable_retries = false; + protected $disable_retries = false; /** * Constructor. diff --git a/AiPlatform/src/V1/Schema.php b/AiPlatform/src/V1/Schema.php index 4fed6769878d..86a814c3aea4 100644 --- a/AiPlatform/src/V1/Schema.php +++ b/AiPlatform/src/V1/Schema.php @@ -23,7 +23,7 @@ class Schema extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $type = 0; + protected $type = 0; /** * Optional. The format of the data. * Supported formats: @@ -33,50 +33,50 @@ class Schema extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string format = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $format = ''; + protected $format = ''; /** * Optional. The title of the Schema. * * Generated from protobuf field string title = 24 [(.google.api.field_behavior) = OPTIONAL]; */ - private $title = ''; + protected $title = ''; /** * Optional. The description of the data. * * Generated from protobuf field string description = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Optional. Indicates if the value may be null. * * Generated from protobuf field bool nullable = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $nullable = false; + protected $nullable = false; /** * Optional. Default value of the data. * * Generated from protobuf field .google.protobuf.Value default = 23 [(.google.api.field_behavior) = OPTIONAL]; */ - private $default = null; + protected $default = null; /** * Optional. SCHEMA FIELDS FOR TYPE ARRAY * Schema of the elements of Type.ARRAY. * * Generated from protobuf field .google.cloud.aiplatform.v1.Schema items = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $items = null; + protected $items = null; /** * Optional. Minimum number of the elements for Type.ARRAY. * * Generated from protobuf field int64 min_items = 21 [(.google.api.field_behavior) = OPTIONAL]; */ - private $min_items = 0; + protected $min_items = 0; /** * Optional. Maximum number of the elements for Type.ARRAY. * * Generated from protobuf field int64 max_items = 22 [(.google.api.field_behavior) = OPTIONAL]; */ - private $max_items = 0; + protected $max_items = 0; /** * Optional. Possible values of the element of Type.STRING with enum format. * For example we can define an Enum Direction as : @@ -103,53 +103,53 @@ class Schema extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 min_properties = 14 [(.google.api.field_behavior) = OPTIONAL]; */ - private $min_properties = 0; + protected $min_properties = 0; /** * Optional. Maximum number of the properties for Type.OBJECT. * * Generated from protobuf field int64 max_properties = 15 [(.google.api.field_behavior) = OPTIONAL]; */ - private $max_properties = 0; + protected $max_properties = 0; /** * Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER * Minimum value of the Type.INTEGER and Type.NUMBER * * Generated from protobuf field double minimum = 16 [(.google.api.field_behavior) = OPTIONAL]; */ - private $minimum = 0.0; + protected $minimum = 0.0; /** * Optional. Maximum value of the Type.INTEGER and Type.NUMBER * * Generated from protobuf field double maximum = 17 [(.google.api.field_behavior) = OPTIONAL]; */ - private $maximum = 0.0; + protected $maximum = 0.0; /** * Optional. SCHEMA FIELDS FOR TYPE STRING * Minimum length of the Type.STRING * * Generated from protobuf field int64 min_length = 18 [(.google.api.field_behavior) = OPTIONAL]; */ - private $min_length = 0; + protected $min_length = 0; /** * Optional. Maximum length of the Type.STRING * * Generated from protobuf field int64 max_length = 19 [(.google.api.field_behavior) = OPTIONAL]; */ - private $max_length = 0; + protected $max_length = 0; /** * Optional. Pattern of the Type.STRING to restrict a string to a regular * expression. * * Generated from protobuf field string pattern = 20 [(.google.api.field_behavior) = OPTIONAL]; */ - private $pattern = ''; + protected $pattern = ''; /** * Optional. Example of the object. Will only populated when the object is the * root. * * Generated from protobuf field .google.protobuf.Value example = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $example = null; + protected $example = null; /** * Constructor. diff --git a/AiPlatform/src/V1/SearchDataItemsRequest.php b/AiPlatform/src/V1/SearchDataItemsRequest.php index 80214aa4d1c8..627f8ecaf19c 100644 --- a/AiPlatform/src/V1/SearchDataItemsRequest.php +++ b/AiPlatform/src/V1/SearchDataItemsRequest.php @@ -23,7 +23,7 @@ class SearchDataItemsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $dataset = ''; + protected $dataset = ''; /** * The resource name of a SavedQuery(annotation set in UI). * Format: @@ -43,7 +43,7 @@ class SearchDataItemsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string data_labeling_job = 3; */ - private $data_labeling_job = ''; + protected $data_labeling_job = ''; /** * An expression for filtering the DataItem that will be returned. * * `data_item_id` - for = or !=. @@ -57,7 +57,7 @@ class SearchDataItemsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string data_item_filter = 4; */ - private $data_item_filter = ''; + protected $data_item_filter = ''; /** * An expression for filtering the Annotations that will be returned per * DataItem. @@ -83,7 +83,7 @@ class SearchDataItemsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask field_mask = 6; */ - private $field_mask = null; + protected $field_mask = null; /** * If set, only up to this many of Annotations will be returned per * DataItemView. The maximum value is 1000. If not set, the maximum value will @@ -91,14 +91,14 @@ class SearchDataItemsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 annotations_limit = 7; */ - private $annotations_limit = 0; + protected $annotations_limit = 0; /** * Requested page size. Server may return fewer results than requested. * Default and maximum page size is 100. * * Generated from protobuf field int32 page_size = 8; */ - private $page_size = 0; + protected $page_size = 0; /** * A comma-separated list of fields to order by, sorted in ascending order. * Use "desc" after a field name for descending. @@ -117,7 +117,7 @@ class SearchDataItemsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 10; */ - private $page_token = ''; + protected $page_token = ''; protected $order; /** diff --git a/AiPlatform/src/V1/SearchDataItemsRequest/OrderByAnnotation.php b/AiPlatform/src/V1/SearchDataItemsRequest/OrderByAnnotation.php index 688ee2b906bd..708439caf60b 100644 --- a/AiPlatform/src/V1/SearchDataItemsRequest/OrderByAnnotation.php +++ b/AiPlatform/src/V1/SearchDataItemsRequest/OrderByAnnotation.php @@ -21,7 +21,7 @@ class OrderByAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string saved_query = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $saved_query = ''; + protected $saved_query = ''; /** * A comma-separated list of annotation fields to order by, sorted in * ascending order. Use "desc" after a field name for descending. Must also @@ -29,7 +29,7 @@ class OrderByAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 2; */ - private $order_by = ''; + protected $order_by = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/SearchDataItemsResponse.php b/AiPlatform/src/V1/SearchDataItemsResponse.php index 36f12d6efd1f..b2e4f2eee135 100644 --- a/AiPlatform/src/V1/SearchDataItemsResponse.php +++ b/AiPlatform/src/V1/SearchDataItemsResponse.php @@ -30,7 +30,7 @@ class SearchDataItemsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/SearchEntryPoint.php b/AiPlatform/src/V1/SearchEntryPoint.php index b9d692394464..ad159bbc4f8d 100644 --- a/AiPlatform/src/V1/SearchEntryPoint.php +++ b/AiPlatform/src/V1/SearchEntryPoint.php @@ -21,14 +21,14 @@ class SearchEntryPoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string rendered_content = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $rendered_content = ''; + protected $rendered_content = ''; /** * Optional. Base64 encoded JSON representing array of tuple. * * Generated from protobuf field bytes sdk_blob = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $sdk_blob = ''; + protected $sdk_blob = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/SearchFeaturesRequest.php b/AiPlatform/src/V1/SearchFeaturesRequest.php index 8c40e22e5153..cc217005173e 100644 --- a/AiPlatform/src/V1/SearchFeaturesRequest.php +++ b/AiPlatform/src/V1/SearchFeaturesRequest.php @@ -23,7 +23,7 @@ class SearchFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $location = ''; + protected $location = ''; /** * Query string that is a conjunction of field-restricted queries and/or * field-restricted filters. Field-restricted queries and filters can be @@ -76,7 +76,7 @@ class SearchFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string query = 3; */ - private $query = ''; + protected $query = ''; /** * The maximum number of Features to return. The service may return fewer * than this value. If unspecified, at most 100 Features will be returned. @@ -85,7 +85,7 @@ class SearchFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 4; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * [FeaturestoreService.SearchFeatures][google.cloud.aiplatform.v1.FeaturestoreService.SearchFeatures] @@ -96,7 +96,7 @@ class SearchFeaturesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 5; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $location Required. The resource name of the Location to search Features. diff --git a/AiPlatform/src/V1/SearchFeaturesResponse.php b/AiPlatform/src/V1/SearchFeaturesResponse.php index 788e1f68232d..636aeed0f6a2 100644 --- a/AiPlatform/src/V1/SearchFeaturesResponse.php +++ b/AiPlatform/src/V1/SearchFeaturesResponse.php @@ -36,7 +36,7 @@ class SearchFeaturesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/SearchMigratableResourcesRequest.php b/AiPlatform/src/V1/SearchMigratableResourcesRequest.php index ebc06fa0e291..8f8a2b73fd50 100644 --- a/AiPlatform/src/V1/SearchMigratableResourcesRequest.php +++ b/AiPlatform/src/V1/SearchMigratableResourcesRequest.php @@ -24,20 +24,20 @@ class SearchMigratableResourcesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The standard page size. * The default and maximum value is 100. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The standard page token. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter for your search. You can use the following types of filters: * * Resource type filters. The following strings filter for a specific type @@ -53,7 +53,7 @@ class SearchMigratableResourcesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * @param string $parent Required. The location that the migratable resources should be searched diff --git a/AiPlatform/src/V1/SearchMigratableResourcesResponse.php b/AiPlatform/src/V1/SearchMigratableResourcesResponse.php index 985ac3037688..28f96674416c 100644 --- a/AiPlatform/src/V1/SearchMigratableResourcesResponse.php +++ b/AiPlatform/src/V1/SearchMigratableResourcesResponse.php @@ -30,7 +30,7 @@ class SearchMigratableResourcesResponse extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesRequest.php b/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesRequest.php index ad67e6648c42..9538a5de4774 100644 --- a/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesRequest.php +++ b/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesRequest.php @@ -23,14 +23,14 @@ class SearchModelDeploymentMonitoringStatsAnomaliesRequest extends \Google\Proto * * Generated from protobuf field string model_deployment_monitoring_job = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $model_deployment_monitoring_job = ''; + protected $model_deployment_monitoring_job = ''; /** * Required. The DeployedModel ID of the * [ModelDeploymentMonitoringObjectiveConfig.deployed_model_id]. * * Generated from protobuf field string deployed_model_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployed_model_id = ''; + protected $deployed_model_id = ''; /** * The feature display name. If specified, only return the stats belonging to * this feature. Format: @@ -39,7 +39,7 @@ class SearchModelDeploymentMonitoringStatsAnomaliesRequest extends \Google\Proto * * Generated from protobuf field string feature_display_name = 3; */ - private $feature_display_name = ''; + protected $feature_display_name = ''; /** * Required. Objectives of the stats to retrieve. * @@ -51,7 +51,7 @@ class SearchModelDeploymentMonitoringStatsAnomaliesRequest extends \Google\Proto * * Generated from protobuf field int32 page_size = 5; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token received from a previous * [JobService.SearchModelDeploymentMonitoringStatsAnomalies][google.cloud.aiplatform.v1.JobService.SearchModelDeploymentMonitoringStatsAnomalies] @@ -59,21 +59,21 @@ class SearchModelDeploymentMonitoringStatsAnomaliesRequest extends \Google\Proto * * Generated from protobuf field string page_token = 6; */ - private $page_token = ''; + protected $page_token = ''; /** * The earliest timestamp of stats being generated. * If not set, indicates fetching stats till the earliest possible one. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 7; */ - private $start_time = null; + protected $start_time = null; /** * The latest timestamp of stats being generated. * If not set, indicates feching stats till the latest possible one. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 8; */ - private $end_time = null; + protected $end_time = null; /** * @param string $modelDeploymentMonitoringJob Required. ModelDeploymentMonitoring Job resource name. diff --git a/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesRequest/StatsAnomaliesObjective.php b/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesRequest/StatsAnomaliesObjective.php index 2e7379de47b7..c5c5dbf7fa7b 100644 --- a/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesRequest/StatsAnomaliesObjective.php +++ b/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesRequest/StatsAnomaliesObjective.php @@ -18,7 +18,7 @@ class StatsAnomaliesObjective extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field .google.cloud.aiplatform.v1.ModelDeploymentMonitoringObjectiveType type = 1; */ - private $type = 0; + protected $type = 0; /** * If set, all attribution scores between * [SearchModelDeploymentMonitoringStatsAnomaliesRequest.start_time][google.cloud.aiplatform.v1.SearchModelDeploymentMonitoringStatsAnomaliesRequest.start_time] @@ -30,7 +30,7 @@ class StatsAnomaliesObjective extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 top_feature_count = 4; */ - private $top_feature_count = 0; + protected $top_feature_count = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesResponse.php b/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesResponse.php index fa055bdc8e55..3b4668717392 100644 --- a/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesResponse.php +++ b/AiPlatform/src/V1/SearchModelDeploymentMonitoringStatsAnomaliesResponse.php @@ -32,7 +32,7 @@ class SearchModelDeploymentMonitoringStatsAnomaliesResponse extends \Google\Prot * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/SearchNearestEntitiesRequest.php b/AiPlatform/src/V1/SearchNearestEntitiesRequest.php index f490ab6e3270..f1098caf7ca7 100644 --- a/AiPlatform/src/V1/SearchNearestEntitiesRequest.php +++ b/AiPlatform/src/V1/SearchNearestEntitiesRequest.php @@ -22,13 +22,13 @@ class SearchNearestEntitiesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_view = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $feature_view = ''; + protected $feature_view = ''; /** * Required. The query. * * Generated from protobuf field .google.cloud.aiplatform.v1.NearestNeighborQuery query = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $query = null; + protected $query = null; /** * Optional. If set to true, the full entities (including all vector values * and metadata) of the nearest neighbors are returned; otherwise only entity @@ -37,7 +37,7 @@ class SearchNearestEntitiesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool return_full_entity = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $return_full_entity = false; + protected $return_full_entity = false; /** * Constructor. diff --git a/AiPlatform/src/V1/SearchNearestEntitiesResponse.php b/AiPlatform/src/V1/SearchNearestEntitiesResponse.php index 53e3b7e45b7d..8ddfef06dc8b 100644 --- a/AiPlatform/src/V1/SearchNearestEntitiesResponse.php +++ b/AiPlatform/src/V1/SearchNearestEntitiesResponse.php @@ -21,7 +21,7 @@ class SearchNearestEntitiesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.NearestNeighbors nearest_neighbors = 1; */ - private $nearest_neighbors = null; + protected $nearest_neighbors = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Segment.php b/AiPlatform/src/V1/Segment.php deleted file mode 100644 index 63d273996c64..000000000000 --- a/AiPlatform/src/V1/Segment.php +++ /dev/null @@ -1,143 +0,0 @@ -google.cloud.aiplatform.v1.Segment - */ -class Segment extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The index of a Part object within its parent Content object. - * - * Generated from protobuf field int32 part_index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $part_index = 0; - /** - * Output only. Start index in the given Part, measured in bytes. Offset from - * the start of the Part, inclusive, starting at zero. - * - * Generated from protobuf field int32 start_index = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $start_index = 0; - /** - * Output only. End index in the given Part, measured in bytes. Offset from - * the start of the Part, exclusive, starting at zero. - * - * Generated from protobuf field int32 end_index = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $end_index = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $part_index - * Output only. The index of a Part object within its parent Content object. - * @type int $start_index - * Output only. Start index in the given Part, measured in bytes. Offset from - * the start of the Part, inclusive, starting at zero. - * @type int $end_index - * Output only. End index in the given Part, measured in bytes. Offset from - * the start of the Part, exclusive, starting at zero. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Aiplatform\V1\Content::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The index of a Part object within its parent Content object. - * - * Generated from protobuf field int32 part_index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getPartIndex() - { - return $this->part_index; - } - - /** - * Output only. The index of a Part object within its parent Content object. - * - * Generated from protobuf field int32 part_index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setPartIndex($var) - { - GPBUtil::checkInt32($var); - $this->part_index = $var; - - return $this; - } - - /** - * Output only. Start index in the given Part, measured in bytes. Offset from - * the start of the Part, inclusive, starting at zero. - * - * Generated from protobuf field int32 start_index = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getStartIndex() - { - return $this->start_index; - } - - /** - * Output only. Start index in the given Part, measured in bytes. Offset from - * the start of the Part, inclusive, starting at zero. - * - * Generated from protobuf field int32 start_index = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setStartIndex($var) - { - GPBUtil::checkInt32($var); - $this->start_index = $var; - - return $this; - } - - /** - * Output only. End index in the given Part, measured in bytes. Offset from - * the start of the Part, exclusive, starting at zero. - * - * Generated from protobuf field int32 end_index = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getEndIndex() - { - return $this->end_index; - } - - /** - * Output only. End index in the given Part, measured in bytes. Offset from - * the start of the Part, exclusive, starting at zero. - * - * Generated from protobuf field int32 end_index = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setEndIndex($var) - { - GPBUtil::checkInt32($var); - $this->end_index = $var; - - return $this; - } - -} - diff --git a/AiPlatform/src/V1/ServiceAccountSpec.php b/AiPlatform/src/V1/ServiceAccountSpec.php index 95c55ce9fbe5..43e9a58b5110 100644 --- a/AiPlatform/src/V1/ServiceAccountSpec.php +++ b/AiPlatform/src/V1/ServiceAccountSpec.php @@ -23,7 +23,7 @@ class ServiceAccountSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_custom_service_account = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $enable_custom_service_account = false; + protected $enable_custom_service_account = false; /** * Optional. Required when all below conditions are met * * `enable_custom_service_account` is true; @@ -37,7 +37,7 @@ class ServiceAccountSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $service_account = ''; + protected $service_account = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/ShieldedVmConfig.php b/AiPlatform/src/V1/ShieldedVmConfig.php index fda7ed22871d..fef3e5f2ec86 100644 --- a/AiPlatform/src/V1/ShieldedVmConfig.php +++ b/AiPlatform/src/V1/ShieldedVmConfig.php @@ -27,7 +27,7 @@ class ShieldedVmConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_secure_boot = 1; */ - private $enable_secure_boot = false; + protected $enable_secure_boot = false; /** * Constructor. diff --git a/AiPlatform/src/V1/SmoothGradConfig.php b/AiPlatform/src/V1/SmoothGradConfig.php index 69a4e700a76f..68fcd8ec3a2d 100644 --- a/AiPlatform/src/V1/SmoothGradConfig.php +++ b/AiPlatform/src/V1/SmoothGradConfig.php @@ -27,7 +27,7 @@ class SmoothGradConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 noisy_sample_count = 3; */ - private $noisy_sample_count = 0; + protected $noisy_sample_count = 0; protected $GradientNoiseSigma; /** diff --git a/AiPlatform/src/V1/SpecialistPool.php b/AiPlatform/src/V1/SpecialistPool.php index d7a2213c6f27..acbd7028f741 100644 --- a/AiPlatform/src/V1/SpecialistPool.php +++ b/AiPlatform/src/V1/SpecialistPool.php @@ -25,7 +25,7 @@ class SpecialistPool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; /** * Required. The user-defined name of the SpecialistPool. * The name can be up to 128 characters long and can consist of any UTF-8 @@ -34,13 +34,13 @@ class SpecialistPool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Output only. The number of managers in this SpecialistPool. * * Generated from protobuf field int32 specialist_managers_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $specialist_managers_count = 0; + protected $specialist_managers_count = 0; /** * The email addresses of the managers in the SpecialistPool. * diff --git a/AiPlatform/src/V1/SpecialistPoolServiceClient.php b/AiPlatform/src/V1/SpecialistPoolServiceClient.php deleted file mode 100644 index d913389ac7e8..000000000000 --- a/AiPlatform/src/V1/SpecialistPoolServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.SpecialistPoolService/CreateSpecialistPool', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets a SpecialistPool. - * @param \Google\Cloud\AIPlatform\V1\GetSpecialistPoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetSpecialistPool(\Google\Cloud\AIPlatform\V1\GetSpecialistPoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.SpecialistPoolService/GetSpecialistPool', - $argument, - ['\Google\Cloud\AIPlatform\V1\SpecialistPool', 'decode'], - $metadata, $options); - } - - /** - * Lists SpecialistPools in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListSpecialistPoolsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListSpecialistPools(\Google\Cloud\AIPlatform\V1\ListSpecialistPoolsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.SpecialistPoolService/ListSpecialistPools', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListSpecialistPoolsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a SpecialistPool as well as all Specialists in the pool. - * @param \Google\Cloud\AIPlatform\V1\DeleteSpecialistPoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteSpecialistPool(\Google\Cloud\AIPlatform\V1\DeleteSpecialistPoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.SpecialistPoolService/DeleteSpecialistPool', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates a SpecialistPool. - * @param \Google\Cloud\AIPlatform\V1\UpdateSpecialistPoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateSpecialistPool(\Google\Cloud\AIPlatform\V1\UpdateSpecialistPoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.SpecialistPoolService/UpdateSpecialistPool', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/StartNotebookRuntimeOperationMetadata.php b/AiPlatform/src/V1/StartNotebookRuntimeOperationMetadata.php index 7a7a00690d7a..0c969bac9e0f 100644 --- a/AiPlatform/src/V1/StartNotebookRuntimeOperationMetadata.php +++ b/AiPlatform/src/V1/StartNotebookRuntimeOperationMetadata.php @@ -21,14 +21,14 @@ class StartNotebookRuntimeOperationMetadata extends \Google\Protobuf\Internal\Me * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * A human-readable message that shows the intermediate progress details of * NotebookRuntime. * * Generated from protobuf field string progress_message = 2; */ - private $progress_message = ''; + protected $progress_message = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/StartNotebookRuntimeRequest.php b/AiPlatform/src/V1/StartNotebookRuntimeRequest.php index 97757ea4bab6..000e5cc7a293 100644 --- a/AiPlatform/src/V1/StartNotebookRuntimeRequest.php +++ b/AiPlatform/src/V1/StartNotebookRuntimeRequest.php @@ -24,7 +24,7 @@ class StartNotebookRuntimeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NotebookRuntime resource to be started. diff --git a/AiPlatform/src/V1/StopTrialRequest.php b/AiPlatform/src/V1/StopTrialRequest.php index a493573bf5b8..1954d1d69d78 100644 --- a/AiPlatform/src/V1/StopTrialRequest.php +++ b/AiPlatform/src/V1/StopTrialRequest.php @@ -23,7 +23,7 @@ class StopTrialRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/StratifiedSplit.php b/AiPlatform/src/V1/StratifiedSplit.php index ba1a0e79af0a..0a08505d2bd2 100644 --- a/AiPlatform/src/V1/StratifiedSplit.php +++ b/AiPlatform/src/V1/StratifiedSplit.php @@ -33,26 +33,26 @@ class StratifiedSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double training_fraction = 1; */ - private $training_fraction = 0.0; + protected $training_fraction = 0.0; /** * The fraction of the input data that is to be used to validate the Model. * * Generated from protobuf field double validation_fraction = 2; */ - private $validation_fraction = 0.0; + protected $validation_fraction = 0.0; /** * The fraction of the input data that is to be used to evaluate the Model. * * Generated from protobuf field double test_fraction = 3; */ - private $test_fraction = 0.0; + protected $test_fraction = 0.0; /** * Required. The key is a name of one of the Dataset's data columns. * The key provided must be for a categorical column. * * Generated from protobuf field string key = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $key = ''; + protected $key = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/StreamDirectPredictRequest.php b/AiPlatform/src/V1/StreamDirectPredictRequest.php index 5cd53ba6f936..2d21ad060147 100644 --- a/AiPlatform/src/V1/StreamDirectPredictRequest.php +++ b/AiPlatform/src/V1/StreamDirectPredictRequest.php @@ -27,7 +27,7 @@ class StreamDirectPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Optional. The prediction input. * @@ -39,7 +39,7 @@ class StreamDirectPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Tensor parameters = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $parameters = null; + protected $parameters = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StreamDirectPredictResponse.php b/AiPlatform/src/V1/StreamDirectPredictResponse.php index 6677eb8e7220..44425eea22f0 100644 --- a/AiPlatform/src/V1/StreamDirectPredictResponse.php +++ b/AiPlatform/src/V1/StreamDirectPredictResponse.php @@ -27,7 +27,7 @@ class StreamDirectPredictResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Tensor parameters = 2; */ - private $parameters = null; + protected $parameters = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StreamDirectRawPredictRequest.php b/AiPlatform/src/V1/StreamDirectRawPredictRequest.php index 30e80119f01b..a67a26f96fbb 100644 --- a/AiPlatform/src/V1/StreamDirectRawPredictRequest.php +++ b/AiPlatform/src/V1/StreamDirectRawPredictRequest.php @@ -33,7 +33,7 @@ class StreamDirectRawPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Optional. Fully qualified name of the API method being invoked to perform * predictions. @@ -44,13 +44,13 @@ class StreamDirectRawPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string method_name = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $method_name = ''; + protected $method_name = ''; /** * Optional. The prediction input. * * Generated from protobuf field bytes input = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $input = ''; + protected $input = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/StreamDirectRawPredictResponse.php b/AiPlatform/src/V1/StreamDirectRawPredictResponse.php index 5efd68fcdbfe..d0de9bdcf902 100644 --- a/AiPlatform/src/V1/StreamDirectRawPredictResponse.php +++ b/AiPlatform/src/V1/StreamDirectRawPredictResponse.php @@ -21,7 +21,7 @@ class StreamDirectRawPredictResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes output = 1; */ - private $output = ''; + protected $output = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/StreamRawPredictRequest.php b/AiPlatform/src/V1/StreamRawPredictRequest.php index 885c04914ccd..1d18a1f20baf 100644 --- a/AiPlatform/src/V1/StreamRawPredictRequest.php +++ b/AiPlatform/src/V1/StreamRawPredictRequest.php @@ -23,13 +23,13 @@ class StreamRawPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * The prediction input. Supports HTTP headers and arbitrary data payload. * * Generated from protobuf field .google.api.HttpBody http_body = 2; */ - private $http_body = null; + protected $http_body = null; /** * @param string $endpoint Required. The name of the Endpoint requested to serve the prediction. diff --git a/AiPlatform/src/V1/StreamingPredictRequest.php b/AiPlatform/src/V1/StreamingPredictRequest.php index 35b40a6787a1..712c1cdcd8e2 100644 --- a/AiPlatform/src/V1/StreamingPredictRequest.php +++ b/AiPlatform/src/V1/StreamingPredictRequest.php @@ -26,7 +26,7 @@ class StreamingPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * The prediction input. * @@ -38,7 +38,7 @@ class StreamingPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Tensor parameters = 3; */ - private $parameters = null; + protected $parameters = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StreamingPredictResponse.php b/AiPlatform/src/V1/StreamingPredictResponse.php index 44a7b5fce9ae..af912ba64203 100644 --- a/AiPlatform/src/V1/StreamingPredictResponse.php +++ b/AiPlatform/src/V1/StreamingPredictResponse.php @@ -27,7 +27,7 @@ class StreamingPredictResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Tensor parameters = 2; */ - private $parameters = null; + protected $parameters = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StreamingRawPredictRequest.php b/AiPlatform/src/V1/StreamingRawPredictRequest.php index cc16d4d3a4af..889f01be16b5 100644 --- a/AiPlatform/src/V1/StreamingRawPredictRequest.php +++ b/AiPlatform/src/V1/StreamingRawPredictRequest.php @@ -33,7 +33,7 @@ class StreamingRawPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Fully qualified name of the API method being invoked to perform * predictions. @@ -44,13 +44,13 @@ class StreamingRawPredictRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string method_name = 2; */ - private $method_name = ''; + protected $method_name = ''; /** * The prediction input. * * Generated from protobuf field bytes input = 3; */ - private $input = ''; + protected $input = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/StreamingRawPredictResponse.php b/AiPlatform/src/V1/StreamingRawPredictResponse.php index ba43e40ae271..b3d45235e160 100644 --- a/AiPlatform/src/V1/StreamingRawPredictResponse.php +++ b/AiPlatform/src/V1/StreamingRawPredictResponse.php @@ -21,7 +21,7 @@ class StreamingRawPredictResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes output = 1; */ - private $output = ''; + protected $output = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/StreamingReadFeatureValuesRequest.php b/AiPlatform/src/V1/StreamingReadFeatureValuesRequest.php index 16ca42866c64..4bb996f890bd 100644 --- a/AiPlatform/src/V1/StreamingReadFeatureValuesRequest.php +++ b/AiPlatform/src/V1/StreamingReadFeatureValuesRequest.php @@ -26,7 +26,7 @@ class StreamingReadFeatureValuesRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string entity_type = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $entity_type = ''; + protected $entity_type = ''; /** * Required. IDs of entities to read Feature values of. The maximum number of * IDs is 100. For example, for a machine learning model predicting user @@ -41,7 +41,7 @@ class StreamingReadFeatureValuesRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureSelector feature_selector = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_selector = null; + protected $feature_selector = null; /** * @param string $entityType Required. The resource name of the entities' type. diff --git a/AiPlatform/src/V1/StructFieldValue.php b/AiPlatform/src/V1/StructFieldValue.php index 63b52695701d..6ca556157e4e 100644 --- a/AiPlatform/src/V1/StructFieldValue.php +++ b/AiPlatform/src/V1/StructFieldValue.php @@ -20,13 +20,13 @@ class StructFieldValue extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * The value for this field. * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureValue value = 2; */ - private $value = null; + protected $value = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Study.php b/AiPlatform/src/V1/Study.php index 84644d762674..7acbb5184d95 100644 --- a/AiPlatform/src/V1/Study.php +++ b/AiPlatform/src/V1/Study.php @@ -21,38 +21,38 @@ class Study extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. Describes the Study, default value is empty string. * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Required. Configuration of the Study. * * Generated from protobuf field .google.cloud.aiplatform.v1.StudySpec study_spec = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $study_spec = null; + protected $study_spec = null; /** * Output only. The detailed state of a Study. * * Generated from protobuf field .google.cloud.aiplatform.v1.Study.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Time at which the study was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. A human readable reason why the Study is inactive. * This should be empty if a study is ACTIVE or COMPLETED. * * Generated from protobuf field string inactive_reason = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $inactive_reason = ''; + protected $inactive_reason = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec.php b/AiPlatform/src/V1/StudySpec.php index 5c324dbebffc..8fcef3d12932 100644 --- a/AiPlatform/src/V1/StudySpec.php +++ b/AiPlatform/src/V1/StudySpec.php @@ -32,7 +32,7 @@ class StudySpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.StudySpec.Algorithm algorithm = 3; */ - private $algorithm = 0; + protected $algorithm = 0; /** * The observation noise level of the study. * Currently only supported by the Vertex AI Vizier service. Not supported by @@ -40,20 +40,20 @@ class StudySpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.StudySpec.ObservationNoise observation_noise = 6; */ - private $observation_noise = 0; + protected $observation_noise = 0; /** * Describe which measurement selection type will be used * * Generated from protobuf field .google.cloud.aiplatform.v1.StudySpec.MeasurementSelectionType measurement_selection_type = 7; */ - private $measurement_selection_type = 0; + protected $measurement_selection_type = 0; /** * Conditions for automated stopping of a Study. Enable automated stopping by * configuring at least one condition. * * Generated from protobuf field optional .google.cloud.aiplatform.v1.StudySpec.StudyStoppingConfig study_stopping_config = 11; */ - private $study_stopping_config = null; + protected $study_stopping_config = null; protected $automated_stopping_spec; /** diff --git a/AiPlatform/src/V1/StudySpec/ConvexAutomatedStoppingSpec.php b/AiPlatform/src/V1/StudySpec/ConvexAutomatedStoppingSpec.php index 6ef4f13051f2..f69db186b29c 100644 --- a/AiPlatform/src/V1/StudySpec/ConvexAutomatedStoppingSpec.php +++ b/AiPlatform/src/V1/StudySpec/ConvexAutomatedStoppingSpec.php @@ -32,7 +32,7 @@ class ConvexAutomatedStoppingSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 max_step_count = 1; */ - private $max_step_count = 0; + protected $max_step_count = 0; /** * Minimum number of steps for a trial to complete. Trials which do not have * a measurement with step_count > min_step_count won't be considered for @@ -44,7 +44,7 @@ class ConvexAutomatedStoppingSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 min_step_count = 2; */ - private $min_step_count = 0; + protected $min_step_count = 0; /** * The minimal number of measurements in a Trial. Early-stopping checks * will not trigger if less than min_measurement_count+1 completed trials or @@ -53,7 +53,7 @@ class ConvexAutomatedStoppingSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 min_measurement_count = 3; */ - private $min_measurement_count = 0; + protected $min_measurement_count = 0; /** * The hyper-parameter name used in the tuning job that stands for learning * rate. Leave it blank if learning rate is not in a parameter in tuning. @@ -62,7 +62,7 @@ class ConvexAutomatedStoppingSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string learning_rate_parameter_name = 4; */ - private $learning_rate_parameter_name = ''; + protected $learning_rate_parameter_name = ''; /** * This bool determines whether or not the rule is applied based on * elapsed_secs or steps. If use_elapsed_duration==false, the early stopping @@ -74,7 +74,7 @@ class ConvexAutomatedStoppingSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool use_elapsed_duration = 5; */ - private $use_elapsed_duration = false; + protected $use_elapsed_duration = false; /** * ConvexAutomatedStoppingSpec by default only updates the trials that needs * to be early stopped using a newly trained auto-regressive model. When @@ -86,7 +86,7 @@ class ConvexAutomatedStoppingSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool update_all_stopped_trials = 6; */ - private $update_all_stopped_trials = null; + protected $update_all_stopped_trials = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec/DecayCurveAutomatedStoppingSpec.php b/AiPlatform/src/V1/StudySpec/DecayCurveAutomatedStoppingSpec.php index 6d2154e4cfe0..8067737f41cb 100644 --- a/AiPlatform/src/V1/StudySpec/DecayCurveAutomatedStoppingSpec.php +++ b/AiPlatform/src/V1/StudySpec/DecayCurveAutomatedStoppingSpec.php @@ -28,7 +28,7 @@ class DecayCurveAutomatedStoppingSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool use_elapsed_duration = 1; */ - private $use_elapsed_duration = false; + protected $use_elapsed_duration = false; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec/MedianAutomatedStoppingSpec.php b/AiPlatform/src/V1/StudySpec/MedianAutomatedStoppingSpec.php index b41e3ca9ae64..18310e9b6efe 100644 --- a/AiPlatform/src/V1/StudySpec/MedianAutomatedStoppingSpec.php +++ b/AiPlatform/src/V1/StudySpec/MedianAutomatedStoppingSpec.php @@ -28,7 +28,7 @@ class MedianAutomatedStoppingSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool use_elapsed_duration = 1; */ - private $use_elapsed_duration = false; + protected $use_elapsed_duration = false; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec/MetricSpec.php b/AiPlatform/src/V1/StudySpec/MetricSpec.php index ec91a70a1613..27ba5cf76bc2 100644 --- a/AiPlatform/src/V1/StudySpec/MetricSpec.php +++ b/AiPlatform/src/V1/StudySpec/MetricSpec.php @@ -21,20 +21,20 @@ class MetricSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string metric_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $metric_id = ''; + protected $metric_id = ''; /** * Required. The optimization goal of the metric. * * Generated from protobuf field .google.cloud.aiplatform.v1.StudySpec.MetricSpec.GoalType goal = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $goal = 0; + protected $goal = 0; /** * Used for safe search. In the case, the metric will be a safety * metric. You must provide a separate metric for objective metric. * * Generated from protobuf field optional .google.cloud.aiplatform.v1.StudySpec.MetricSpec.SafetyMetricConfig safety_config = 3; */ - private $safety_config = null; + protected $safety_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec/MetricSpec/SafetyMetricConfig.php b/AiPlatform/src/V1/StudySpec/MetricSpec/SafetyMetricConfig.php index 63972d5d7ba6..f860f6f155af 100644 --- a/AiPlatform/src/V1/StudySpec/MetricSpec/SafetyMetricConfig.php +++ b/AiPlatform/src/V1/StudySpec/MetricSpec/SafetyMetricConfig.php @@ -21,7 +21,7 @@ class SafetyMetricConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double safety_threshold = 1; */ - private $safety_threshold = 0.0; + protected $safety_threshold = 0.0; /** * Desired minimum fraction of safe trials (over total number of trials) * that should be targeted by the algorithm at any time during the @@ -32,7 +32,7 @@ class SafetyMetricConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double desired_min_safe_trials_fraction = 2; */ - private $desired_min_safe_trials_fraction = null; + protected $desired_min_safe_trials_fraction = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec/ParameterSpec.php b/AiPlatform/src/V1/StudySpec/ParameterSpec.php index 476ac2b8dfb4..163df9f7dc3e 100644 --- a/AiPlatform/src/V1/StudySpec/ParameterSpec.php +++ b/AiPlatform/src/V1/StudySpec/ParameterSpec.php @@ -21,14 +21,14 @@ class ParameterSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parameter_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $parameter_id = ''; + protected $parameter_id = ''; /** * How the parameter should be scaled. * Leave unset for `CATEGORICAL` parameters. * * Generated from protobuf field .google.cloud.aiplatform.v1.StudySpec.ParameterSpec.ScaleType scale_type = 6; */ - private $scale_type = 0; + protected $scale_type = 0; /** * A conditional parameter node is active if the parameter's value matches * the conditional node's parent_value_condition. diff --git a/AiPlatform/src/V1/StudySpec/ParameterSpec/CategoricalValueSpec.php b/AiPlatform/src/V1/StudySpec/ParameterSpec/CategoricalValueSpec.php index e80f8d762be0..3709b82cdaa5 100644 --- a/AiPlatform/src/V1/StudySpec/ParameterSpec/CategoricalValueSpec.php +++ b/AiPlatform/src/V1/StudySpec/ParameterSpec/CategoricalValueSpec.php @@ -30,7 +30,7 @@ class CategoricalValueSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string default_value = 3; */ - private $default_value = null; + protected $default_value = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec/ParameterSpec/ConditionalParameterSpec.php b/AiPlatform/src/V1/StudySpec/ParameterSpec/ConditionalParameterSpec.php index 1af1004db069..073f9e4699f6 100644 --- a/AiPlatform/src/V1/StudySpec/ParameterSpec/ConditionalParameterSpec.php +++ b/AiPlatform/src/V1/StudySpec/ParameterSpec/ConditionalParameterSpec.php @@ -20,7 +20,7 @@ class ConditionalParameterSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.StudySpec.ParameterSpec parameter_spec = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $parameter_spec = null; + protected $parameter_spec = null; protected $parent_value_condition; /** diff --git a/AiPlatform/src/V1/StudySpec/ParameterSpec/DiscreteValueSpec.php b/AiPlatform/src/V1/StudySpec/ParameterSpec/DiscreteValueSpec.php index 534a2552d915..4e365fa9aa5c 100644 --- a/AiPlatform/src/V1/StudySpec/ParameterSpec/DiscreteValueSpec.php +++ b/AiPlatform/src/V1/StudySpec/ParameterSpec/DiscreteValueSpec.php @@ -34,7 +34,7 @@ class DiscreteValueSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double default_value = 3; */ - private $default_value = null; + protected $default_value = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec/ParameterSpec/DoubleValueSpec.php b/AiPlatform/src/V1/StudySpec/ParameterSpec/DoubleValueSpec.php index 257d6b0b9a45..60c2894ec955 100644 --- a/AiPlatform/src/V1/StudySpec/ParameterSpec/DoubleValueSpec.php +++ b/AiPlatform/src/V1/StudySpec/ParameterSpec/DoubleValueSpec.php @@ -20,13 +20,13 @@ class DoubleValueSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double min_value = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $min_value = 0.0; + protected $min_value = 0.0; /** * Required. Inclusive maximum value of the parameter. * * Generated from protobuf field double max_value = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_value = 0.0; + protected $max_value = 0.0; /** * A default value for a `DOUBLE` parameter that is assumed to be a * relatively good starting point. Unset value signals that there is no @@ -36,7 +36,7 @@ class DoubleValueSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double default_value = 4; */ - private $default_value = null; + protected $default_value = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec/ParameterSpec/IntegerValueSpec.php b/AiPlatform/src/V1/StudySpec/ParameterSpec/IntegerValueSpec.php index 402f78cb5d3b..0a1a3510f173 100644 --- a/AiPlatform/src/V1/StudySpec/ParameterSpec/IntegerValueSpec.php +++ b/AiPlatform/src/V1/StudySpec/ParameterSpec/IntegerValueSpec.php @@ -20,13 +20,13 @@ class IntegerValueSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 min_value = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $min_value = 0; + protected $min_value = 0; /** * Required. Inclusive maximum value of the parameter. * * Generated from protobuf field int64 max_value = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_value = 0; + protected $max_value = 0; /** * A default value for an `INTEGER` parameter that is assumed to be a * relatively good starting point. Unset value signals that there is no @@ -36,7 +36,7 @@ class IntegerValueSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 default_value = 4; */ - private $default_value = null; + protected $default_value = null; /** * Constructor. diff --git a/AiPlatform/src/V1/StudySpec/StudyStoppingConfig.php b/AiPlatform/src/V1/StudySpec/StudyStoppingConfig.php index 6e09fb9dff6b..7c32cff9ecaf 100644 --- a/AiPlatform/src/V1/StudySpec/StudyStoppingConfig.php +++ b/AiPlatform/src/V1/StudySpec/StudyStoppingConfig.php @@ -25,7 +25,7 @@ class StudyStoppingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.BoolValue should_stop_asap = 1; */ - private $should_stop_asap = null; + protected $should_stop_asap = null; /** * Each "stopping rule" in this proto specifies an "if" condition. Before * Vizier would generate a new suggestion, it first checks each specified @@ -50,26 +50,26 @@ class StudyStoppingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.StudyTimeConstraint minimum_runtime_constraint = 2; */ - private $minimum_runtime_constraint = null; + protected $minimum_runtime_constraint = null; /** * If the specified time or duration has passed, stop the study. * * Generated from protobuf field .google.cloud.aiplatform.v1.StudyTimeConstraint maximum_runtime_constraint = 3; */ - private $maximum_runtime_constraint = null; + protected $maximum_runtime_constraint = null; /** * If there are fewer than this many COMPLETED trials, do not stop the * study. * * Generated from protobuf field .google.protobuf.Int32Value min_num_trials = 4; */ - private $min_num_trials = null; + protected $min_num_trials = null; /** * If there are more than this many trials, stop the study. * * Generated from protobuf field .google.protobuf.Int32Value max_num_trials = 5; */ - private $max_num_trials = null; + protected $max_num_trials = null; /** * If the objective value has not improved for this many consecutive * trials, stop the study. @@ -77,7 +77,7 @@ class StudyStoppingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Int32Value max_num_trials_no_progress = 6; */ - private $max_num_trials_no_progress = null; + protected $max_num_trials_no_progress = null; /** * If the objective value has not improved for this much time, stop the * study. @@ -85,7 +85,7 @@ class StudyStoppingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration max_duration_no_progress = 7; */ - private $max_duration_no_progress = null; + protected $max_duration_no_progress = null; /** * Constructor. @@ -179,7 +179,7 @@ public function clearShouldStopAsap() * Generated from protobuf field .google.protobuf.BoolValue should_stop_asap = 1; * @return bool|null */ - public function getShouldStopAsapValue() + public function getShouldStopAsapUnwrapped() { return $this->readWrapperValue("should_stop_asap"); } @@ -216,7 +216,7 @@ public function setShouldStopAsap($var) * @param bool|null $var * @return $this */ - public function setShouldStopAsapValue($var) + public function setShouldStopAsapUnwrapped($var) { $this->writeWrapperValue("should_stop_asap", $var); return $this;} @@ -362,7 +362,7 @@ public function clearMinNumTrials() * Generated from protobuf field .google.protobuf.Int32Value min_num_trials = 4; * @return int|null */ - public function getMinNumTrialsValue() + public function getMinNumTrialsUnwrapped() { return $this->readWrapperValue("min_num_trials"); } @@ -393,7 +393,7 @@ public function setMinNumTrials($var) * @param int|null $var * @return $this */ - public function setMinNumTrialsValue($var) + public function setMinNumTrialsUnwrapped($var) { $this->writeWrapperValue("min_num_trials", $var); return $this;} @@ -427,7 +427,7 @@ public function clearMaxNumTrials() * Generated from protobuf field .google.protobuf.Int32Value max_num_trials = 5; * @return int|null */ - public function getMaxNumTrialsValue() + public function getMaxNumTrialsUnwrapped() { return $this->readWrapperValue("max_num_trials"); } @@ -456,7 +456,7 @@ public function setMaxNumTrials($var) * @param int|null $var * @return $this */ - public function setMaxNumTrialsValue($var) + public function setMaxNumTrialsUnwrapped($var) { $this->writeWrapperValue("max_num_trials", $var); return $this;} @@ -494,7 +494,7 @@ public function clearMaxNumTrialsNoProgress() * Generated from protobuf field .google.protobuf.Int32Value max_num_trials_no_progress = 6; * @return int|null */ - public function getMaxNumTrialsNoProgressValue() + public function getMaxNumTrialsNoProgressUnwrapped() { return $this->readWrapperValue("max_num_trials_no_progress"); } @@ -527,7 +527,7 @@ public function setMaxNumTrialsNoProgress($var) * @param int|null $var * @return $this */ - public function setMaxNumTrialsNoProgressValue($var) + public function setMaxNumTrialsNoProgressUnwrapped($var) { $this->writeWrapperValue("max_num_trials_no_progress", $var); return $this;} diff --git a/AiPlatform/src/V1/SuggestTrialsMetadata.php b/AiPlatform/src/V1/SuggestTrialsMetadata.php index 1a7b900ef48a..2e785757dba1 100644 --- a/AiPlatform/src/V1/SuggestTrialsMetadata.php +++ b/AiPlatform/src/V1/SuggestTrialsMetadata.php @@ -20,7 +20,7 @@ class SuggestTrialsMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * The identifier of the client that is requesting the suggestion. * If multiple SuggestTrialsRequests have the same `client_id`, @@ -29,7 +29,7 @@ class SuggestTrialsMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string client_id = 2; */ - private $client_id = ''; + protected $client_id = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/SuggestTrialsRequest.php b/AiPlatform/src/V1/SuggestTrialsRequest.php index 55d2734110db..31432c2c063a 100644 --- a/AiPlatform/src/V1/SuggestTrialsRequest.php +++ b/AiPlatform/src/V1/SuggestTrialsRequest.php @@ -22,13 +22,13 @@ class SuggestTrialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The number of suggestions requested. It must be positive. * * Generated from protobuf field int32 suggestion_count = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $suggestion_count = 0; + protected $suggestion_count = 0; /** * Required. The identifier of the client that is requesting the suggestion. * If multiple SuggestTrialsRequests have the same `client_id`, @@ -37,7 +37,7 @@ class SuggestTrialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string client_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $client_id = ''; + protected $client_id = ''; /** * Optional. This allows you to specify the "context" for a Trial; a context * is a slice (a subspace) of the search space. diff --git a/AiPlatform/src/V1/SuggestTrialsResponse.php b/AiPlatform/src/V1/SuggestTrialsResponse.php index d6edea600307..a2922d5052dc 100644 --- a/AiPlatform/src/V1/SuggestTrialsResponse.php +++ b/AiPlatform/src/V1/SuggestTrialsResponse.php @@ -27,19 +27,19 @@ class SuggestTrialsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Study.State study_state = 2; */ - private $study_state = 0; + protected $study_state = 0; /** * The time at which the operation was started. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; */ - private $start_time = null; + protected $start_time = null; /** * The time at which operation processing completed. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; */ - private $end_time = null; + protected $end_time = null; /** * Constructor. diff --git a/AiPlatform/src/V1/SupervisedHyperParameters.php b/AiPlatform/src/V1/SupervisedHyperParameters.php index 81caf4595c0b..ed94144294f7 100644 --- a/AiPlatform/src/V1/SupervisedHyperParameters.php +++ b/AiPlatform/src/V1/SupervisedHyperParameters.php @@ -21,19 +21,19 @@ class SupervisedHyperParameters extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 epoch_count = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $epoch_count = 0; + protected $epoch_count = 0; /** * Optional. Multiplier for adjusting the default learning rate. * * Generated from protobuf field double learning_rate_multiplier = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $learning_rate_multiplier = 0.0; + protected $learning_rate_multiplier = 0.0; /** * Optional. Adapter size for tuning. * * Generated from protobuf field .google.cloud.aiplatform.v1.SupervisedHyperParameters.AdapterSize adapter_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $adapter_size = 0; + protected $adapter_size = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/SupervisedTuningDataStats.php b/AiPlatform/src/V1/SupervisedTuningDataStats.php index d7113531c2b1..ffb3538df044 100644 --- a/AiPlatform/src/V1/SupervisedTuningDataStats.php +++ b/AiPlatform/src/V1/SupervisedTuningDataStats.php @@ -20,43 +20,43 @@ class SupervisedTuningDataStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 tuning_dataset_example_count = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $tuning_dataset_example_count = 0; + protected $tuning_dataset_example_count = 0; /** * Output only. Number of tuning characters in the tuning dataset. * * Generated from protobuf field int64 total_tuning_character_count = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $total_tuning_character_count = 0; + protected $total_tuning_character_count = 0; /** * Output only. Number of billable characters in the tuning dataset. * * Generated from protobuf field int64 total_billable_character_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $total_billable_character_count = 0; + protected $total_billable_character_count = 0; /** * Output only. Number of tuning steps for this Tuning Job. * * Generated from protobuf field int64 tuning_step_count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $tuning_step_count = 0; + protected $tuning_step_count = 0; /** * Output only. Dataset distributions for the user input tokens. * * Generated from protobuf field .google.cloud.aiplatform.v1.SupervisedTuningDatasetDistribution user_input_token_distribution = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $user_input_token_distribution = null; + protected $user_input_token_distribution = null; /** * Output only. Dataset distributions for the user output tokens. * * Generated from protobuf field .google.cloud.aiplatform.v1.SupervisedTuningDatasetDistribution user_output_token_distribution = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $user_output_token_distribution = null; + protected $user_output_token_distribution = null; /** * Output only. Dataset distributions for the messages per example. * * Generated from protobuf field .google.cloud.aiplatform.v1.SupervisedTuningDatasetDistribution user_message_per_example_distribution = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $user_message_per_example_distribution = null; + protected $user_message_per_example_distribution = null; /** * Output only. Sample user messages in the training dataset uri. * diff --git a/AiPlatform/src/V1/SupervisedTuningDatasetDistribution.php b/AiPlatform/src/V1/SupervisedTuningDatasetDistribution.php index 8e10df2eaa4b..d23ca9c9f6f1 100644 --- a/AiPlatform/src/V1/SupervisedTuningDatasetDistribution.php +++ b/AiPlatform/src/V1/SupervisedTuningDatasetDistribution.php @@ -20,43 +20,43 @@ class SupervisedTuningDatasetDistribution extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field int64 sum = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $sum = 0; + protected $sum = 0; /** * Output only. The minimum of the population values. * * Generated from protobuf field double min = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $min = 0.0; + protected $min = 0.0; /** * Output only. The maximum of the population values. * * Generated from protobuf field double max = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $max = 0.0; + protected $max = 0.0; /** * Output only. The arithmetic mean of the values in the population. * * Generated from protobuf field double mean = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $mean = 0.0; + protected $mean = 0.0; /** * Output only. The median of the values in the population. * * Generated from protobuf field double median = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $median = 0.0; + protected $median = 0.0; /** * Output only. The 5th percentile of the values in the population. * * Generated from protobuf field double p5 = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $p5 = 0.0; + protected $p5 = 0.0; /** * Output only. The 95th percentile of the values in the population. * * Generated from protobuf field double p95 = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $p95 = 0.0; + protected $p95 = 0.0; /** * Output only. Defines the histogram bucket. * diff --git a/AiPlatform/src/V1/SupervisedTuningDatasetDistribution/DatasetBucket.php b/AiPlatform/src/V1/SupervisedTuningDatasetDistribution/DatasetBucket.php index ef958607e6e5..c4d05ddc2818 100644 --- a/AiPlatform/src/V1/SupervisedTuningDatasetDistribution/DatasetBucket.php +++ b/AiPlatform/src/V1/SupervisedTuningDatasetDistribution/DatasetBucket.php @@ -21,19 +21,19 @@ class DatasetBucket extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double count = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $count = 0.0; + protected $count = 0.0; /** * Output only. Left bound of the bucket. * * Generated from protobuf field double left = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $left = 0.0; + protected $left = 0.0; /** * Output only. Right bound of the bucket. * * Generated from protobuf field double right = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $right = 0.0; + protected $right = 0.0; /** * Constructor. diff --git a/AiPlatform/src/V1/SupervisedTuningSpec.php b/AiPlatform/src/V1/SupervisedTuningSpec.php index b4126db6dd11..cf73588008b6 100644 --- a/AiPlatform/src/V1/SupervisedTuningSpec.php +++ b/AiPlatform/src/V1/SupervisedTuningSpec.php @@ -21,20 +21,20 @@ class SupervisedTuningSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string training_dataset_uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $training_dataset_uri = ''; + protected $training_dataset_uri = ''; /** * Optional. Cloud Storage path to file containing validation dataset for * tuning. The dataset must be formatted as a JSONL file. * * Generated from protobuf field string validation_dataset_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $validation_dataset_uri = ''; + protected $validation_dataset_uri = ''; /** * Optional. Hyperparameters for SFT. * * Generated from protobuf field .google.cloud.aiplatform.v1.SupervisedHyperParameters hyper_parameters = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $hyper_parameters = null; + protected $hyper_parameters = null; /** * Constructor. diff --git a/AiPlatform/src/V1/SyncFeatureViewRequest.php b/AiPlatform/src/V1/SyncFeatureViewRequest.php index 19b01a90d961..f4bb0c592474 100644 --- a/AiPlatform/src/V1/SyncFeatureViewRequest.php +++ b/AiPlatform/src/V1/SyncFeatureViewRequest.php @@ -22,7 +22,7 @@ class SyncFeatureViewRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_view = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $feature_view = ''; + protected $feature_view = ''; /** * @param string $featureView Required. Format: diff --git a/AiPlatform/src/V1/SyncFeatureViewResponse.php b/AiPlatform/src/V1/SyncFeatureViewResponse.php index 23e336160455..16511782af48 100644 --- a/AiPlatform/src/V1/SyncFeatureViewResponse.php +++ b/AiPlatform/src/V1/SyncFeatureViewResponse.php @@ -22,7 +22,7 @@ class SyncFeatureViewResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string feature_view_sync = 1; */ - private $feature_view_sync = ''; + protected $feature_view_sync = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/TFRecordDestination.php b/AiPlatform/src/V1/TFRecordDestination.php index d6fd07165524..1f10164b6ed8 100644 --- a/AiPlatform/src/V1/TFRecordDestination.php +++ b/AiPlatform/src/V1/TFRecordDestination.php @@ -20,7 +20,7 @@ class TFRecordDestination extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GcsDestination gcs_destination = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $gcs_destination = null; + protected $gcs_destination = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Tensor.php b/AiPlatform/src/V1/Tensor.php index 4808fbbd0c84..bf65f0799335 100644 --- a/AiPlatform/src/V1/Tensor.php +++ b/AiPlatform/src/V1/Tensor.php @@ -20,7 +20,7 @@ class Tensor extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Tensor.DataType dtype = 1; */ - private $dtype = 0; + protected $dtype = 0; /** * Shape of the tensor. * @@ -106,7 +106,7 @@ class Tensor extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes tensor_val = 13; */ - private $tensor_val = ''; + protected $tensor_val = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/Tensorboard.php b/AiPlatform/src/V1/Tensorboard.php index 783c477d63b1..3408a7ffe291 100644 --- a/AiPlatform/src/V1/Tensorboard.php +++ b/AiPlatform/src/V1/Tensorboard.php @@ -24,19 +24,19 @@ class Tensorboard extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. User provided name of this Tensorboard. * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Description of this Tensorboard. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Customer-managed encryption key spec for a Tensorboard. If set, this * Tensorboard and all sub-resources of this Tensorboard will be secured by @@ -44,32 +44,32 @@ class Tensorboard extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 11; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Output only. Consumer project Cloud Storage path prefix used to store blob * data, which can either be a bucket or directory. Does not end with a '/'. * * Generated from protobuf field string blob_storage_path_prefix = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $blob_storage_path_prefix = ''; + protected $blob_storage_path_prefix = ''; /** * Output only. The number of Runs stored in this Tensorboard. * * Generated from protobuf field int32 run_count = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $run_count = 0; + protected $run_count = 0; /** * Output only. Timestamp when this Tensorboard was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this Tensorboard was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The labels with user-defined metadata to organize your Tensorboards. * Label keys and values can be no longer than 64 characters @@ -90,7 +90,7 @@ class Tensorboard extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 9; */ - private $etag = ''; + protected $etag = ''; /** * Used to indicate if the TensorBoard instance is the default one. * Each project & region can have at most one default TensorBoard instance. @@ -100,7 +100,7 @@ class Tensorboard extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool is_default = 12; */ - private $is_default = false; + protected $is_default = false; /** * Constructor. diff --git a/AiPlatform/src/V1/TensorboardBlob.php b/AiPlatform/src/V1/TensorboardBlob.php index 808e4b3566f2..77bbd50adf5e 100644 --- a/AiPlatform/src/V1/TensorboardBlob.php +++ b/AiPlatform/src/V1/TensorboardBlob.php @@ -21,14 +21,14 @@ class TensorboardBlob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $id = ''; + protected $id = ''; /** * Optional. The bytes of the blob is not present unless it's returned by the * ReadTensorboardBlobData endpoint. * * Generated from protobuf field bytes data = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $data = ''; + protected $data = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/TensorboardExperiment.php b/AiPlatform/src/V1/TensorboardExperiment.php index 38640a72a987..1f8f96c44777 100644 --- a/AiPlatform/src/V1/TensorboardExperiment.php +++ b/AiPlatform/src/V1/TensorboardExperiment.php @@ -23,31 +23,31 @@ class TensorboardExperiment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * User provided name of this TensorboardExperiment. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * Description of this TensorboardExperiment. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Output only. Timestamp when this TensorboardExperiment was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this TensorboardExperiment was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The labels with user-defined metadata to organize your * TensorboardExperiment. @@ -73,14 +73,14 @@ class TensorboardExperiment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 7; */ - private $etag = ''; + protected $etag = ''; /** * Immutable. Source of the TensorboardExperiment. Example: a custom training * job. * * Generated from protobuf field string source = 8 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $source = ''; + protected $source = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/TensorboardRun.php b/AiPlatform/src/V1/TensorboardRun.php index f8d8eff115d3..2a0fc77d67d0 100644 --- a/AiPlatform/src/V1/TensorboardRun.php +++ b/AiPlatform/src/V1/TensorboardRun.php @@ -23,7 +23,7 @@ class TensorboardRun extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. User provided name of this TensorboardRun. * This value must be unique among all TensorboardRuns @@ -31,25 +31,25 @@ class TensorboardRun extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Description of this TensorboardRun. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Output only. Timestamp when this TensorboardRun was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this TensorboardRun was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The labels with user-defined metadata to organize your TensorboardRuns. * This field will be used to filter and visualize Runs in the Tensorboard UI. @@ -76,7 +76,7 @@ class TensorboardRun extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 9; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/TensorboardServiceClient.php b/AiPlatform/src/V1/TensorboardServiceClient.php deleted file mode 100644 index 2ffdc04ab047..000000000000 --- a/AiPlatform/src/V1/TensorboardServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboard', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets a Tensorboard. - * @param \Google\Cloud\AIPlatform\V1\GetTensorboardRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetTensorboard(\Google\Cloud\AIPlatform\V1\GetTensorboardRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/GetTensorboard', - $argument, - ['\Google\Cloud\AIPlatform\V1\Tensorboard', 'decode'], - $metadata, $options); - } - - /** - * Returns a list of monthly active users for a given TensorBoard instance. - * @param \Google\Cloud\AIPlatform\V1\ReadTensorboardUsageRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ReadTensorboardUsage(\Google\Cloud\AIPlatform\V1\ReadTensorboardUsageRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardUsage', - $argument, - ['\Google\Cloud\AIPlatform\V1\ReadTensorboardUsageResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates a Tensorboard. - * @param \Google\Cloud\AIPlatform\V1\UpdateTensorboardRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateTensorboard(\Google\Cloud\AIPlatform\V1\UpdateTensorboardRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboard', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists Tensorboards in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListTensorboardsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListTensorboards(\Google\Cloud\AIPlatform\V1\ListTensorboardsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/ListTensorboards', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListTensorboardsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a Tensorboard. - * @param \Google\Cloud\AIPlatform\V1\DeleteTensorboardRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteTensorboard(\Google\Cloud\AIPlatform\V1\DeleteTensorboardRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboard', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a TensorboardExperiment. - * @param \Google\Cloud\AIPlatform\V1\CreateTensorboardExperimentRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateTensorboardExperiment(\Google\Cloud\AIPlatform\V1\CreateTensorboardExperimentRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardExperiment', - $argument, - ['\Google\Cloud\AIPlatform\V1\TensorboardExperiment', 'decode'], - $metadata, $options); - } - - /** - * Gets a TensorboardExperiment. - * @param \Google\Cloud\AIPlatform\V1\GetTensorboardExperimentRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetTensorboardExperiment(\Google\Cloud\AIPlatform\V1\GetTensorboardExperimentRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardExperiment', - $argument, - ['\Google\Cloud\AIPlatform\V1\TensorboardExperiment', 'decode'], - $metadata, $options); - } - - /** - * Updates a TensorboardExperiment. - * @param \Google\Cloud\AIPlatform\V1\UpdateTensorboardExperimentRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateTensorboardExperiment(\Google\Cloud\AIPlatform\V1\UpdateTensorboardExperimentRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardExperiment', - $argument, - ['\Google\Cloud\AIPlatform\V1\TensorboardExperiment', 'decode'], - $metadata, $options); - } - - /** - * Lists TensorboardExperiments in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListTensorboardExperimentsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListTensorboardExperiments(\Google\Cloud\AIPlatform\V1\ListTensorboardExperimentsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardExperiments', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListTensorboardExperimentsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a TensorboardExperiment. - * @param \Google\Cloud\AIPlatform\V1\DeleteTensorboardExperimentRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteTensorboardExperiment(\Google\Cloud\AIPlatform\V1\DeleteTensorboardExperimentRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardExperiment', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a TensorboardRun. - * @param \Google\Cloud\AIPlatform\V1\CreateTensorboardRunRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateTensorboardRun(\Google\Cloud\AIPlatform\V1\CreateTensorboardRunRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardRun', - $argument, - ['\Google\Cloud\AIPlatform\V1\TensorboardRun', 'decode'], - $metadata, $options); - } - - /** - * Batch create TensorboardRuns. - * @param \Google\Cloud\AIPlatform\V1\BatchCreateTensorboardRunsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchCreateTensorboardRuns(\Google\Cloud\AIPlatform\V1\BatchCreateTensorboardRunsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardRuns', - $argument, - ['\Google\Cloud\AIPlatform\V1\BatchCreateTensorboardRunsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets a TensorboardRun. - * @param \Google\Cloud\AIPlatform\V1\GetTensorboardRunRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetTensorboardRun(\Google\Cloud\AIPlatform\V1\GetTensorboardRunRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardRun', - $argument, - ['\Google\Cloud\AIPlatform\V1\TensorboardRun', 'decode'], - $metadata, $options); - } - - /** - * Updates a TensorboardRun. - * @param \Google\Cloud\AIPlatform\V1\UpdateTensorboardRunRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateTensorboardRun(\Google\Cloud\AIPlatform\V1\UpdateTensorboardRunRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardRun', - $argument, - ['\Google\Cloud\AIPlatform\V1\TensorboardRun', 'decode'], - $metadata, $options); - } - - /** - * Lists TensorboardRuns in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListTensorboardRunsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListTensorboardRuns(\Google\Cloud\AIPlatform\V1\ListTensorboardRunsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardRuns', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListTensorboardRunsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a TensorboardRun. - * @param \Google\Cloud\AIPlatform\V1\DeleteTensorboardRunRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteTensorboardRun(\Google\Cloud\AIPlatform\V1\DeleteTensorboardRunRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardRun', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Batch create TensorboardTimeSeries that belong to a TensorboardExperiment. - * @param \Google\Cloud\AIPlatform\V1\BatchCreateTensorboardTimeSeriesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchCreateTensorboardTimeSeries(\Google\Cloud\AIPlatform\V1\BatchCreateTensorboardTimeSeriesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardTimeSeries', - $argument, - ['\Google\Cloud\AIPlatform\V1\BatchCreateTensorboardTimeSeriesResponse', 'decode'], - $metadata, $options); - } - - /** - * Creates a TensorboardTimeSeries. - * @param \Google\Cloud\AIPlatform\V1\CreateTensorboardTimeSeriesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateTensorboardTimeSeries(\Google\Cloud\AIPlatform\V1\CreateTensorboardTimeSeriesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardTimeSeries', - $argument, - ['\Google\Cloud\AIPlatform\V1\TensorboardTimeSeries', 'decode'], - $metadata, $options); - } - - /** - * Gets a TensorboardTimeSeries. - * @param \Google\Cloud\AIPlatform\V1\GetTensorboardTimeSeriesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetTensorboardTimeSeries(\Google\Cloud\AIPlatform\V1\GetTensorboardTimeSeriesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardTimeSeries', - $argument, - ['\Google\Cloud\AIPlatform\V1\TensorboardTimeSeries', 'decode'], - $metadata, $options); - } - - /** - * Updates a TensorboardTimeSeries. - * @param \Google\Cloud\AIPlatform\V1\UpdateTensorboardTimeSeriesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateTensorboardTimeSeries(\Google\Cloud\AIPlatform\V1\UpdateTensorboardTimeSeriesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardTimeSeries', - $argument, - ['\Google\Cloud\AIPlatform\V1\TensorboardTimeSeries', 'decode'], - $metadata, $options); - } - - /** - * Lists TensorboardTimeSeries in a Location. - * @param \Google\Cloud\AIPlatform\V1\ListTensorboardTimeSeriesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListTensorboardTimeSeries(\Google\Cloud\AIPlatform\V1\ListTensorboardTimeSeriesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardTimeSeries', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListTensorboardTimeSeriesResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a TensorboardTimeSeries. - * @param \Google\Cloud\AIPlatform\V1\DeleteTensorboardTimeSeriesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteTensorboardTimeSeries(\Google\Cloud\AIPlatform\V1\DeleteTensorboardTimeSeriesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardTimeSeries', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Reads multiple TensorboardTimeSeries' data. The data point number limit is - * 1000 for scalars, 100 for tensors and blob references. If the number of - * data points stored is less than the limit, all data is returned. - * Otherwise, the number limit of data points is randomly selected from - * this time series and returned. - * @param \Google\Cloud\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchReadTensorboardTimeSeriesData(\Google\Cloud\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/BatchReadTensorboardTimeSeriesData', - $argument, - ['\Google\Cloud\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataResponse', 'decode'], - $metadata, $options); - } - - /** - * Reads a TensorboardTimeSeries' data. By default, if the number of data - * points stored is less than 1000, all data is returned. Otherwise, 1000 - * data points is randomly selected from this time series and returned. - * This value can be changed by changing max_data_points, which can't be - * greater than 10k. - * @param \Google\Cloud\AIPlatform\V1\ReadTensorboardTimeSeriesDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ReadTensorboardTimeSeriesData(\Google\Cloud\AIPlatform\V1\ReadTensorboardTimeSeriesDataRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardTimeSeriesData', - $argument, - ['\Google\Cloud\AIPlatform\V1\ReadTensorboardTimeSeriesDataResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets bytes of TensorboardBlobs. - * This is to allow reading blob data stored in consumer project's Cloud - * Storage bucket without users having to obtain Cloud Storage access - * permission. - * @param \Google\Cloud\AIPlatform\V1\ReadTensorboardBlobDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\ServerStreamingCall - */ - public function ReadTensorboardBlobData(\Google\Cloud\AIPlatform\V1\ReadTensorboardBlobDataRequest $argument, - $metadata = [], $options = []) { - return $this->_serverStreamRequest('/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardBlobData', - $argument, - ['\Google\Cloud\AIPlatform\V1\ReadTensorboardBlobDataResponse', 'decode'], - $metadata, $options); - } - - /** - * Write time series data points of multiple TensorboardTimeSeries in multiple - * TensorboardRun's. If any data fail to be ingested, an error is returned. - * @param \Google\Cloud\AIPlatform\V1\WriteTensorboardExperimentDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function WriteTensorboardExperimentData(\Google\Cloud\AIPlatform\V1\WriteTensorboardExperimentDataRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardExperimentData', - $argument, - ['\Google\Cloud\AIPlatform\V1\WriteTensorboardExperimentDataResponse', 'decode'], - $metadata, $options); - } - - /** - * Write time series data points into multiple TensorboardTimeSeries under - * a TensorboardRun. If any data fail to be ingested, an error is returned. - * @param \Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function WriteTensorboardRunData(\Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardRunData', - $argument, - ['\Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataResponse', 'decode'], - $metadata, $options); - } - - /** - * Exports a TensorboardTimeSeries' data. Data is returned in paginated - * responses. - * @param \Google\Cloud\AIPlatform\V1\ExportTensorboardTimeSeriesDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ExportTensorboardTimeSeriesData(\Google\Cloud\AIPlatform\V1\ExportTensorboardTimeSeriesDataRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.TensorboardService/ExportTensorboardTimeSeriesData', - $argument, - ['\Google\Cloud\AIPlatform\V1\ExportTensorboardTimeSeriesDataResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/TensorboardTensor.php b/AiPlatform/src/V1/TensorboardTensor.php index 0cbf66970c4f..b7bb5865e1c1 100644 --- a/AiPlatform/src/V1/TensorboardTensor.php +++ b/AiPlatform/src/V1/TensorboardTensor.php @@ -21,14 +21,14 @@ class TensorboardTensor extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes value = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $value = ''; + protected $value = ''; /** * Optional. Version number of TensorProto used to serialize * [value][google.cloud.aiplatform.v1.TensorboardTensor.value]. * * Generated from protobuf field int32 version_number = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $version_number = 0; + protected $version_number = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/TensorboardTimeSeries.php b/AiPlatform/src/V1/TensorboardTimeSeries.php index 9edfb60b8036..31f33441b714 100644 --- a/AiPlatform/src/V1/TensorboardTimeSeries.php +++ b/AiPlatform/src/V1/TensorboardTimeSeries.php @@ -20,7 +20,7 @@ class TensorboardTimeSeries extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. User provided name of this TensorboardTimeSeries. * This value should be unique among all TensorboardTimeSeries resources @@ -28,58 +28,58 @@ class TensorboardTimeSeries extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Description of this TensorboardTimeSeries. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Required. Immutable. Type of TensorboardTimeSeries value. * * Generated from protobuf field .google.cloud.aiplatform.v1.TensorboardTimeSeries.ValueType value_type = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; */ - private $value_type = 0; + protected $value_type = 0; /** * Output only. Timestamp when this TensorboardTimeSeries was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Timestamp when this TensorboardTimeSeries was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Used to perform a consistent read-modify-write updates. If not set, a blind * "overwrite" update happens. * * Generated from protobuf field string etag = 7; */ - private $etag = ''; + protected $etag = ''; /** * Immutable. Name of the plugin this time series pertain to. Such as Scalar, * Tensor, Blob * * Generated from protobuf field string plugin_name = 8 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $plugin_name = ''; + protected $plugin_name = ''; /** * Data of the current plugin, with the size limited to 65KB. * * Generated from protobuf field bytes plugin_data = 9; */ - private $plugin_data = ''; + protected $plugin_data = ''; /** * Output only. Scalar, Tensor, or Blob metadata for this * TensorboardTimeSeries. * * Generated from protobuf field .google.cloud.aiplatform.v1.TensorboardTimeSeries.Metadata metadata = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $metadata = null; + protected $metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/TensorboardTimeSeries/Metadata.php b/AiPlatform/src/V1/TensorboardTimeSeries/Metadata.php index 2164aa428d8c..557cae30bdb6 100644 --- a/AiPlatform/src/V1/TensorboardTimeSeries/Metadata.php +++ b/AiPlatform/src/V1/TensorboardTimeSeries/Metadata.php @@ -21,21 +21,21 @@ class Metadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 max_step = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $max_step = 0; + protected $max_step = 0; /** * Output only. Max wall clock timestamp of all data points within a * TensorboardTimeSeries. * * Generated from protobuf field .google.protobuf.Timestamp max_wall_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $max_wall_time = null; + protected $max_wall_time = null; /** * Output only. The largest blob sequence length (number of blobs) of all * data points in this time series, if its ValueType is BLOB_SEQUENCE. * * Generated from protobuf field int64 max_blob_sequence_length = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $max_blob_sequence_length = 0; + protected $max_blob_sequence_length = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/TimeSeriesData.php b/AiPlatform/src/V1/TimeSeriesData.php index 82cddcba4a1c..88bced5fae0e 100644 --- a/AiPlatform/src/V1/TimeSeriesData.php +++ b/AiPlatform/src/V1/TimeSeriesData.php @@ -21,14 +21,14 @@ class TimeSeriesData extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string tensorboard_time_series_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard_time_series_id = ''; + protected $tensorboard_time_series_id = ''; /** * Required. Immutable. The value type of this time series. All the values in * this time series data must match this value type. * * Generated from protobuf field .google.cloud.aiplatform.v1.TensorboardTimeSeries.ValueType value_type = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; */ - private $value_type = 0; + protected $value_type = 0; /** * Required. Data points in this time series. * diff --git a/AiPlatform/src/V1/TimeSeriesDataPoint.php b/AiPlatform/src/V1/TimeSeriesDataPoint.php index 5dbbf7990b5c..22e6cfa43ee4 100644 --- a/AiPlatform/src/V1/TimeSeriesDataPoint.php +++ b/AiPlatform/src/V1/TimeSeriesDataPoint.php @@ -20,13 +20,13 @@ class TimeSeriesDataPoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp wall_time = 1; */ - private $wall_time = null; + protected $wall_time = null; /** * Step index of this data point within the run. * * Generated from protobuf field int64 step = 2; */ - private $step = 0; + protected $step = 0; protected $value; /** diff --git a/AiPlatform/src/V1/TimestampSplit.php b/AiPlatform/src/V1/TimestampSplit.php index 2060af6b5893..a6b773b93f81 100644 --- a/AiPlatform/src/V1/TimestampSplit.php +++ b/AiPlatform/src/V1/TimestampSplit.php @@ -23,19 +23,19 @@ class TimestampSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double training_fraction = 1; */ - private $training_fraction = 0.0; + protected $training_fraction = 0.0; /** * The fraction of the input data that is to be used to validate the Model. * * Generated from protobuf field double validation_fraction = 2; */ - private $validation_fraction = 0.0; + protected $validation_fraction = 0.0; /** * The fraction of the input data that is to be used to evaluate the Model. * * Generated from protobuf field double test_fraction = 3; */ - private $test_fraction = 0.0; + protected $test_fraction = 0.0; /** * Required. The key is a name of one of the Dataset's data columns. * The values of the key (the values in the column) must be in RFC 3339 @@ -45,7 +45,7 @@ class TimestampSplit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $key = ''; + protected $key = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/Tool.php b/AiPlatform/src/V1/Tool.php index 807035a78d52..45c00a030c0a 100644 --- a/AiPlatform/src/V1/Tool.php +++ b/AiPlatform/src/V1/Tool.php @@ -41,14 +41,14 @@ class Tool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $retrieval = null; + protected $retrieval = null; /** * Optional. GoogleSearchRetrieval tool type. * Specialized retrieval tool that is powered by Google search. * * Generated from protobuf field .google.cloud.aiplatform.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $google_search_retrieval = null; + protected $google_search_retrieval = null; /** * Constructor. diff --git a/AiPlatform/src/V1/ToolConfig.php b/AiPlatform/src/V1/ToolConfig.php index 40c3fe4a2f44..8c9692f4cee4 100644 --- a/AiPlatform/src/V1/ToolConfig.php +++ b/AiPlatform/src/V1/ToolConfig.php @@ -20,7 +20,7 @@ class ToolConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FunctionCallingConfig function_calling_config = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $function_calling_config = null; + protected $function_calling_config = null; /** * Constructor. diff --git a/AiPlatform/src/V1/TrainingConfig.php b/AiPlatform/src/V1/TrainingConfig.php index 25b90683525f..adf7e0e3d1ef 100644 --- a/AiPlatform/src/V1/TrainingConfig.php +++ b/AiPlatform/src/V1/TrainingConfig.php @@ -23,7 +23,7 @@ class TrainingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 timeout_training_milli_hours = 1; */ - private $timeout_training_milli_hours = 0; + protected $timeout_training_milli_hours = 0; /** * Constructor. diff --git a/AiPlatform/src/V1/TrainingPipeline.php b/AiPlatform/src/V1/TrainingPipeline.php index 39e8f21b5374..5564360e527b 100644 --- a/AiPlatform/src/V1/TrainingPipeline.php +++ b/AiPlatform/src/V1/TrainingPipeline.php @@ -24,13 +24,13 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. The user-defined name of this TrainingPipeline. * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Specifies Vertex AI owned input data that may be used for training the * Model. The TrainingPipeline's @@ -44,7 +44,7 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.InputDataConfig input_data_config = 3; */ - private $input_data_config = null; + protected $input_data_config = null; /** * Required. A Google Cloud Storage path to the YAML file that defines the * training task which is responsible for producing the model artifact, and @@ -57,7 +57,7 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string training_task_definition = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $training_task_definition = ''; + protected $training_task_definition = ''; /** * Required. The training task's parameter(s), as specified in the * [training_task_definition][google.cloud.aiplatform.v1.TrainingPipeline.training_task_definition]'s @@ -65,7 +65,7 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value training_task_inputs = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $training_task_inputs = null; + protected $training_task_inputs = null; /** * Output only. The metadata information as specified in the * [training_task_definition][google.cloud.aiplatform.v1.TrainingPipeline.training_task_definition]'s @@ -78,7 +78,7 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value training_task_metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $training_task_metadata = null; + protected $training_task_metadata = null; /** * Describes the Model that may be uploaded (via * [ModelService.UploadModel][google.cloud.aiplatform.v1.ModelService.UploadModel]) @@ -99,7 +99,7 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Model model_to_upload = 7; */ - private $model_to_upload = null; + protected $model_to_upload = null; /** * Optional. The ID to use for the uploaded Model, which will become the final * component of the model resource name. @@ -108,7 +108,7 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model_id = 22 [(.google.api.field_behavior) = OPTIONAL]; */ - private $model_id = ''; + protected $model_id = ''; /** * Optional. When specify this field, the `model_to_upload` will not be * uploaded as a new model, instead, it will become a new version of this @@ -116,33 +116,33 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent_model = 21 [(.google.api.field_behavior) = OPTIONAL]; */ - private $parent_model = ''; + protected $parent_model = ''; /** * Output only. The detailed state of the pipeline. * * Generated from protobuf field .google.cloud.aiplatform.v1.PipelineState state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Only populated when the pipeline's state is * `PIPELINE_STATE_FAILED` or `PIPELINE_STATE_CANCELLED`. * * Generated from protobuf field .google.rpc.Status error = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Output only. Time when the TrainingPipeline was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Time when the TrainingPipeline for the first time entered the * `PIPELINE_STATE_RUNNING` state. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Time when the TrainingPipeline entered any of the following * states: `PIPELINE_STATE_SUCCEEDED`, `PIPELINE_STATE_FAILED`, @@ -150,13 +150,13 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp end_time = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Time when the TrainingPipeline was most recently updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The labels with user-defined metadata to organize TrainingPipelines. * Label keys and values can be no longer than 64 characters @@ -176,7 +176,7 @@ class TrainingPipeline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EncryptionSpec encryption_spec = 18; */ - private $encryption_spec = null; + protected $encryption_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/Trial.php b/AiPlatform/src/V1/Trial.php index 680374edf802..34063934e389 100644 --- a/AiPlatform/src/V1/Trial.php +++ b/AiPlatform/src/V1/Trial.php @@ -22,19 +22,19 @@ class Trial extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. The identifier of the Trial assigned by the service. * * Generated from protobuf field string id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $id = ''; + protected $id = ''; /** * Output only. The detailed state of the Trial. * * Generated from protobuf field .google.cloud.aiplatform.v1.Trial.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The parameters of the Trial. * @@ -46,7 +46,7 @@ class Trial extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Measurement final_measurement = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $final_measurement = null; + protected $final_measurement = null; /** * Output only. A list of measurements that are strictly lexicographically * ordered by their induced tuples (steps, elapsed_duration). @@ -60,14 +60,14 @@ class Trial extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Time when the Trial's status changed to `SUCCEEDED` or * `INFEASIBLE`. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. The identifier of the client that originally requested this * Trial. Each client is identified by a unique client_id. When a client asks @@ -80,21 +80,21 @@ class Trial extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string client_id = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $client_id = ''; + protected $client_id = ''; /** * Output only. A human readable string describing why the Trial is * infeasible. This is set only if Trial state is `INFEASIBLE`. * * Generated from protobuf field string infeasible_reason = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $infeasible_reason = ''; + protected $infeasible_reason = ''; /** * Output only. The CustomJob name linked to the Trial. * It's set for a HyperparameterTuningJob's Trial. * * Generated from protobuf field string custom_job = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $custom_job = ''; + protected $custom_job = ''; /** * Output only. URIs for accessing [interactive * shells](https://cloud.google.com/vertex-ai/docs/training/monitor-debug-interactive-shell) diff --git a/AiPlatform/src/V1/Trial/Parameter.php b/AiPlatform/src/V1/Trial/Parameter.php index 6fad55b5c1b7..adb0630f3742 100644 --- a/AiPlatform/src/V1/Trial/Parameter.php +++ b/AiPlatform/src/V1/Trial/Parameter.php @@ -22,7 +22,7 @@ class Parameter extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parameter_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $parameter_id = ''; + protected $parameter_id = ''; /** * Output only. The value of the parameter. * `number_value` will be set if a parameter defined in StudySpec is @@ -32,7 +32,7 @@ class Parameter extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Value value = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $value = null; + protected $value = null; /** * Constructor. diff --git a/AiPlatform/src/V1/TrialContext.php b/AiPlatform/src/V1/TrialContext.php index 98c7057a3a5f..24ef9182a4d0 100644 --- a/AiPlatform/src/V1/TrialContext.php +++ b/AiPlatform/src/V1/TrialContext.php @@ -21,7 +21,7 @@ class TrialContext extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string description = 1; */ - private $description = ''; + protected $description = ''; /** * If/when a Trial is generated or selected from this Context, * its Parameters will match any parameters specified here. diff --git a/AiPlatform/src/V1/TunedModel.php b/AiPlatform/src/V1/TunedModel.php index e96cfa85de86..00bd472f10b2 100644 --- a/AiPlatform/src/V1/TunedModel.php +++ b/AiPlatform/src/V1/TunedModel.php @@ -22,14 +22,14 @@ class TunedModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * Output only. A resource name of an Endpoint. Format: * `projects/{project}/locations/{location}/endpoints/{endpoint}`. * * Generated from protobuf field string endpoint = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/TuningJob.php b/AiPlatform/src/V1/TuningJob.php index c0d19270d9a2..4d1ad470468b 100644 --- a/AiPlatform/src/V1/TuningJob.php +++ b/AiPlatform/src/V1/TuningJob.php @@ -21,7 +21,7 @@ class TuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Optional. The display name of the * [TunedModel][google.cloud.aiplatform.v1.Model]. The name can be up to 128 @@ -29,27 +29,27 @@ class TuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string tuned_model_display_name = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $tuned_model_display_name = ''; + protected $tuned_model_display_name = ''; /** * Optional. The description of the * [TuningJob][google.cloud.aiplatform.v1.TuningJob]. * * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Output only. The detailed state of the job. * * Generated from protobuf field .google.cloud.aiplatform.v1.JobState state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Time when the * [TuningJob][google.cloud.aiplatform.v1.TuningJob] was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Time when the * [TuningJob][google.cloud.aiplatform.v1.TuningJob] for the first time @@ -57,7 +57,7 @@ class TuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Time when the TuningJob entered any of the following * [JobStates][google.cloud.aiplatform.v1.JobState]: `JOB_STATE_SUCCEEDED`, @@ -65,7 +65,7 @@ class TuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp end_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Time when the * [TuningJob][google.cloud.aiplatform.v1.TuningJob] was most recently @@ -73,14 +73,14 @@ class TuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. Only populated when job's state is `JOB_STATE_FAILED` or * `JOB_STATE_CANCELLED`. * * Generated from protobuf field .google.rpc.Status error = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Optional. The labels with user-defined metadata to organize * [TuningJob][google.cloud.aiplatform.v1.TuningJob] and generated resources @@ -100,21 +100,21 @@ class TuningJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string experiment = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $experiment = ''; + protected $experiment = ''; /** * Output only. The tuned model resources assiociated with this * [TuningJob][google.cloud.aiplatform.v1.TuningJob]. * * Generated from protobuf field .google.cloud.aiplatform.v1.TunedModel tuned_model = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $tuned_model = null; + protected $tuned_model = null; /** * Output only. The tuning data statistics associated with this * [TuningJob][google.cloud.aiplatform.v1.TuningJob]. * * Generated from protobuf field .google.cloud.aiplatform.v1.TuningDataStats tuning_data_stats = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $tuning_data_stats = null; + protected $tuning_data_stats = null; protected $source_model; protected $tuning_spec; diff --git a/AiPlatform/src/V1/UndeployIndexOperationMetadata.php b/AiPlatform/src/V1/UndeployIndexOperationMetadata.php index 02644e927bf5..0e7a468c4c70 100644 --- a/AiPlatform/src/V1/UndeployIndexOperationMetadata.php +++ b/AiPlatform/src/V1/UndeployIndexOperationMetadata.php @@ -21,7 +21,7 @@ class UndeployIndexOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UndeployIndexRequest.php b/AiPlatform/src/V1/UndeployIndexRequest.php index 91bec5c1ce29..7eb8447478ee 100644 --- a/AiPlatform/src/V1/UndeployIndexRequest.php +++ b/AiPlatform/src/V1/UndeployIndexRequest.php @@ -23,14 +23,14 @@ class UndeployIndexRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string index_endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $index_endpoint = ''; + protected $index_endpoint = ''; /** * Required. The ID of the DeployedIndex to be undeployed from the * IndexEndpoint. * * Generated from protobuf field string deployed_index_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployed_index_id = ''; + protected $deployed_index_id = ''; /** * @param string $indexEndpoint Required. The name of the IndexEndpoint resource from which to undeploy an diff --git a/AiPlatform/src/V1/UndeployModelOperationMetadata.php b/AiPlatform/src/V1/UndeployModelOperationMetadata.php index 5eb62608c798..df68cb650fcb 100644 --- a/AiPlatform/src/V1/UndeployModelOperationMetadata.php +++ b/AiPlatform/src/V1/UndeployModelOperationMetadata.php @@ -21,7 +21,7 @@ class UndeployModelOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UndeployModelRequest.php b/AiPlatform/src/V1/UndeployModelRequest.php index 289a8bc70a9e..6a3e4dc6f079 100644 --- a/AiPlatform/src/V1/UndeployModelRequest.php +++ b/AiPlatform/src/V1/UndeployModelRequest.php @@ -23,13 +23,13 @@ class UndeployModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $endpoint = ''; + protected $endpoint = ''; /** * Required. The ID of the DeployedModel to be undeployed from the Endpoint. * * Generated from protobuf field string deployed_model_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployed_model_id = ''; + protected $deployed_model_id = ''; /** * If this field is provided, then the Endpoint's * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] will be diff --git a/AiPlatform/src/V1/UnmanagedContainerModel.php b/AiPlatform/src/V1/UnmanagedContainerModel.php index f4b3f7868b90..5979bb7bb0dc 100644 --- a/AiPlatform/src/V1/UnmanagedContainerModel.php +++ b/AiPlatform/src/V1/UnmanagedContainerModel.php @@ -22,20 +22,20 @@ class UnmanagedContainerModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string artifact_uri = 1; */ - private $artifact_uri = ''; + protected $artifact_uri = ''; /** * Contains the schemata used in Model's predictions and explanations * * Generated from protobuf field .google.cloud.aiplatform.v1.PredictSchemata predict_schemata = 2; */ - private $predict_schemata = null; + protected $predict_schemata = null; /** * Input only. The specification of the container that is to be used when * deploying this Model. * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelContainerSpec container_spec = 3 [(.google.api.field_behavior) = INPUT_ONLY]; */ - private $container_spec = null; + protected $container_spec = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateArtifactRequest.php b/AiPlatform/src/V1/UpdateArtifactRequest.php index f2e5eb88bd80..18855d1f1bf8 100644 --- a/AiPlatform/src/V1/UpdateArtifactRequest.php +++ b/AiPlatform/src/V1/UpdateArtifactRequest.php @@ -24,13 +24,13 @@ class UpdateArtifactRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Artifact artifact = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $artifact = null; + protected $artifact = null; /** * Optional. A FieldMask indicating which fields should be updated. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $update_mask = null; + protected $update_mask = null; /** * If set to true, and the [Artifact][google.cloud.aiplatform.v1.Artifact] is * not found, a new [Artifact][google.cloud.aiplatform.v1.Artifact] is @@ -38,7 +38,7 @@ class UpdateArtifactRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 3; */ - private $allow_missing = false; + protected $allow_missing = false; /** * @param \Google\Cloud\AIPlatform\V1\Artifact $artifact Required. The Artifact containing updates. diff --git a/AiPlatform/src/V1/UpdateContextRequest.php b/AiPlatform/src/V1/UpdateContextRequest.php index 03c516f00026..8be1b17c37e8 100644 --- a/AiPlatform/src/V1/UpdateContextRequest.php +++ b/AiPlatform/src/V1/UpdateContextRequest.php @@ -24,20 +24,20 @@ class UpdateContextRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Context context = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $context = null; + protected $context = null; /** * Optional. A FieldMask indicating which fields should be updated. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $update_mask = null; + protected $update_mask = null; /** * If set to true, and the [Context][google.cloud.aiplatform.v1.Context] is * not found, a new [Context][google.cloud.aiplatform.v1.Context] is created. * * Generated from protobuf field bool allow_missing = 3; */ - private $allow_missing = false; + protected $allow_missing = false; /** * @param \Google\Cloud\AIPlatform\V1\Context $context Required. The Context containing updates. diff --git a/AiPlatform/src/V1/UpdateDatasetRequest.php b/AiPlatform/src/V1/UpdateDatasetRequest.php index 0d0c49a38207..46d4576ab1f3 100644 --- a/AiPlatform/src/V1/UpdateDatasetRequest.php +++ b/AiPlatform/src/V1/UpdateDatasetRequest.php @@ -21,7 +21,7 @@ class UpdateDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Dataset dataset = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $dataset = null; + protected $dataset = null; /** * Required. The update mask applies to the resource. * For the `FieldMask` definition, see @@ -32,7 +32,7 @@ class UpdateDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\Dataset $dataset Required. The Dataset which replaces the resource on the server. diff --git a/AiPlatform/src/V1/UpdateDatasetVersionRequest.php b/AiPlatform/src/V1/UpdateDatasetVersionRequest.php index d6f971f19f98..b49bdac761b6 100644 --- a/AiPlatform/src/V1/UpdateDatasetVersionRequest.php +++ b/AiPlatform/src/V1/UpdateDatasetVersionRequest.php @@ -21,7 +21,7 @@ class UpdateDatasetVersionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DatasetVersion dataset_version = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $dataset_version = null; + protected $dataset_version = null; /** * Required. The update mask applies to the resource. * For the `FieldMask` definition, see @@ -30,7 +30,7 @@ class UpdateDatasetVersionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\DatasetVersion $datasetVersion Required. The DatasetVersion which replaces the resource on the server. diff --git a/AiPlatform/src/V1/UpdateDeploymentResourcePoolOperationMetadata.php b/AiPlatform/src/V1/UpdateDeploymentResourcePoolOperationMetadata.php index 9e04bd54895b..df5bff1bdeb0 100644 --- a/AiPlatform/src/V1/UpdateDeploymentResourcePoolOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateDeploymentResourcePoolOperationMetadata.php @@ -20,7 +20,7 @@ class UpdateDeploymentResourcePoolOperationMetadata extends \Google\Protobuf\Int * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateEndpointRequest.php b/AiPlatform/src/V1/UpdateEndpointRequest.php index a6c30c84a81d..cf13c3301717 100644 --- a/AiPlatform/src/V1/UpdateEndpointRequest.php +++ b/AiPlatform/src/V1/UpdateEndpointRequest.php @@ -21,14 +21,14 @@ class UpdateEndpointRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Endpoint endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $endpoint = null; + protected $endpoint = null; /** * Required. The update mask applies to the resource. See * [google.protobuf.FieldMask][google.protobuf.FieldMask]. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\Endpoint $endpoint Required. The Endpoint which replaces the resource on the server. diff --git a/AiPlatform/src/V1/UpdateEntityTypeRequest.php b/AiPlatform/src/V1/UpdateEntityTypeRequest.php index 2778fd54ba69..f27af5d78b33 100644 --- a/AiPlatform/src/V1/UpdateEntityTypeRequest.php +++ b/AiPlatform/src/V1/UpdateEntityTypeRequest.php @@ -23,7 +23,7 @@ class UpdateEntityTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.EntityType entity_type = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $entity_type = null; + protected $entity_type = null; /** * Field mask is used to specify the fields to be overwritten in the * EntityType resource by the update. @@ -46,7 +46,7 @@ class UpdateEntityTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\EntityType $entityType Required. The EntityType's `name` field is used to identify the EntityType diff --git a/AiPlatform/src/V1/UpdateExecutionRequest.php b/AiPlatform/src/V1/UpdateExecutionRequest.php index 8fc514b04b44..0619ab61b705 100644 --- a/AiPlatform/src/V1/UpdateExecutionRequest.php +++ b/AiPlatform/src/V1/UpdateExecutionRequest.php @@ -24,13 +24,13 @@ class UpdateExecutionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Execution execution = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $execution = null; + protected $execution = null; /** * Optional. A FieldMask indicating which fields should be updated. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $update_mask = null; + protected $update_mask = null; /** * If set to true, and the [Execution][google.cloud.aiplatform.v1.Execution] * is not found, a new [Execution][google.cloud.aiplatform.v1.Execution] is @@ -38,7 +38,7 @@ class UpdateExecutionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 3; */ - private $allow_missing = false; + protected $allow_missing = false; /** * @param \Google\Cloud\AIPlatform\V1\Execution $execution Required. The Execution containing updates. diff --git a/AiPlatform/src/V1/UpdateExplanationDatasetOperationMetadata.php b/AiPlatform/src/V1/UpdateExplanationDatasetOperationMetadata.php index 00ede2b06c38..3e0db6c897fe 100644 --- a/AiPlatform/src/V1/UpdateExplanationDatasetOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateExplanationDatasetOperationMetadata.php @@ -21,7 +21,7 @@ class UpdateExplanationDatasetOperationMetadata extends \Google\Protobuf\Interna * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateExplanationDatasetRequest.php b/AiPlatform/src/V1/UpdateExplanationDatasetRequest.php index f81ef7afb096..5802f79b97b7 100644 --- a/AiPlatform/src/V1/UpdateExplanationDatasetRequest.php +++ b/AiPlatform/src/V1/UpdateExplanationDatasetRequest.php @@ -22,13 +22,13 @@ class UpdateExplanationDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * The example config containing the location of the dataset. * * Generated from protobuf field .google.cloud.aiplatform.v1.Examples examples = 2; */ - private $examples = null; + protected $examples = null; /** * @param string $model Required. The resource name of the Model to update. diff --git a/AiPlatform/src/V1/UpdateFeatureGroupOperationMetadata.php b/AiPlatform/src/V1/UpdateFeatureGroupOperationMetadata.php index e74c98a20283..cde219acc27c 100644 --- a/AiPlatform/src/V1/UpdateFeatureGroupOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateFeatureGroupOperationMetadata.php @@ -20,7 +20,7 @@ class UpdateFeatureGroupOperationMetadata extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateFeatureGroupRequest.php b/AiPlatform/src/V1/UpdateFeatureGroupRequest.php index b4cafc2bba3c..f35043a6db47 100644 --- a/AiPlatform/src/V1/UpdateFeatureGroupRequest.php +++ b/AiPlatform/src/V1/UpdateFeatureGroupRequest.php @@ -23,7 +23,7 @@ class UpdateFeatureGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureGroup feature_group = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_group = null; + protected $feature_group = null; /** * Field mask is used to specify the fields to be overwritten in the * FeatureGroup resource by the update. @@ -37,7 +37,7 @@ class UpdateFeatureGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\FeatureGroup $featureGroup Required. The FeatureGroup's `name` field is used to identify the diff --git a/AiPlatform/src/V1/UpdateFeatureOnlineStoreOperationMetadata.php b/AiPlatform/src/V1/UpdateFeatureOnlineStoreOperationMetadata.php index 381f5553ffd6..470e7b56be7b 100644 --- a/AiPlatform/src/V1/UpdateFeatureOnlineStoreOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateFeatureOnlineStoreOperationMetadata.php @@ -20,7 +20,7 @@ class UpdateFeatureOnlineStoreOperationMetadata extends \Google\Protobuf\Interna * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateFeatureOnlineStoreRequest.php b/AiPlatform/src/V1/UpdateFeatureOnlineStoreRequest.php index 3761802094f4..5603df68aca6 100644 --- a/AiPlatform/src/V1/UpdateFeatureOnlineStoreRequest.php +++ b/AiPlatform/src/V1/UpdateFeatureOnlineStoreRequest.php @@ -23,7 +23,7 @@ class UpdateFeatureOnlineStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureOnlineStore feature_online_store = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_online_store = null; + protected $feature_online_store = null; /** * Field mask is used to specify the fields to be overwritten in the * FeatureOnlineStore resource by the update. @@ -40,7 +40,7 @@ class UpdateFeatureOnlineStoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\FeatureOnlineStore $featureOnlineStore Required. The FeatureOnlineStore's `name` field is used to identify the diff --git a/AiPlatform/src/V1/UpdateFeatureOperationMetadata.php b/AiPlatform/src/V1/UpdateFeatureOperationMetadata.php index 05559b062e28..5cafd18f122d 100644 --- a/AiPlatform/src/V1/UpdateFeatureOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateFeatureOperationMetadata.php @@ -20,7 +20,7 @@ class UpdateFeatureOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateFeatureRequest.php b/AiPlatform/src/V1/UpdateFeatureRequest.php index fd7a30ad8969..6a4fd909e868 100644 --- a/AiPlatform/src/V1/UpdateFeatureRequest.php +++ b/AiPlatform/src/V1/UpdateFeatureRequest.php @@ -27,7 +27,7 @@ class UpdateFeatureRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Feature feature = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature = null; + protected $feature = null; /** * Field mask is used to specify the fields to be overwritten in the * Features resource by the update. @@ -43,7 +43,7 @@ class UpdateFeatureRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\Feature $feature Required. The Feature's `name` field is used to identify the Feature to be diff --git a/AiPlatform/src/V1/UpdateFeatureViewOperationMetadata.php b/AiPlatform/src/V1/UpdateFeatureViewOperationMetadata.php index ba0d2b12d3d0..aba40ee40138 100644 --- a/AiPlatform/src/V1/UpdateFeatureViewOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateFeatureViewOperationMetadata.php @@ -20,7 +20,7 @@ class UpdateFeatureViewOperationMetadata extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateFeatureViewRequest.php b/AiPlatform/src/V1/UpdateFeatureViewRequest.php index 761ba08ca67e..b23313f79682 100644 --- a/AiPlatform/src/V1/UpdateFeatureViewRequest.php +++ b/AiPlatform/src/V1/UpdateFeatureViewRequest.php @@ -23,7 +23,7 @@ class UpdateFeatureViewRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.FeatureView feature_view = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature_view = null; + protected $feature_view = null; /** * Field mask is used to specify the fields to be overwritten in the * FeatureView resource by the update. @@ -38,7 +38,7 @@ class UpdateFeatureViewRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\FeatureView $featureView Required. The FeatureView's `name` field is used to identify the diff --git a/AiPlatform/src/V1/UpdateFeaturestoreOperationMetadata.php b/AiPlatform/src/V1/UpdateFeaturestoreOperationMetadata.php index a0ae8b87d2a5..e28ad331cc20 100644 --- a/AiPlatform/src/V1/UpdateFeaturestoreOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateFeaturestoreOperationMetadata.php @@ -20,7 +20,7 @@ class UpdateFeaturestoreOperationMetadata extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateFeaturestoreRequest.php b/AiPlatform/src/V1/UpdateFeaturestoreRequest.php index 16e73829bd05..75712ca8651f 100644 --- a/AiPlatform/src/V1/UpdateFeaturestoreRequest.php +++ b/AiPlatform/src/V1/UpdateFeaturestoreRequest.php @@ -23,7 +23,7 @@ class UpdateFeaturestoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Featurestore featurestore = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $featurestore = null; + protected $featurestore = null; /** * Field mask is used to specify the fields to be overwritten in the * Featurestore resource by the update. @@ -40,7 +40,7 @@ class UpdateFeaturestoreRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\Featurestore $featurestore Required. The Featurestore's `name` field is used to identify the diff --git a/AiPlatform/src/V1/UpdateIndexEndpointRequest.php b/AiPlatform/src/V1/UpdateIndexEndpointRequest.php index 50e17ace00e8..ce8da1331e74 100644 --- a/AiPlatform/src/V1/UpdateIndexEndpointRequest.php +++ b/AiPlatform/src/V1/UpdateIndexEndpointRequest.php @@ -21,14 +21,14 @@ class UpdateIndexEndpointRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.IndexEndpoint index_endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $index_endpoint = null; + protected $index_endpoint = null; /** * Required. The update mask applies to the resource. See * [google.protobuf.FieldMask][google.protobuf.FieldMask]. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\IndexEndpoint $indexEndpoint Required. The IndexEndpoint which replaces the resource on the server. diff --git a/AiPlatform/src/V1/UpdateIndexOperationMetadata.php b/AiPlatform/src/V1/UpdateIndexOperationMetadata.php index ea8b51449860..e849d182effb 100644 --- a/AiPlatform/src/V1/UpdateIndexOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateIndexOperationMetadata.php @@ -21,13 +21,13 @@ class UpdateIndexOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * The operation metadata with regard to Matching Engine Index operation. * * Generated from protobuf field .google.cloud.aiplatform.v1.NearestNeighborSearchOperationMetadata nearest_neighbor_search_operation_metadata = 2; */ - private $nearest_neighbor_search_operation_metadata = null; + protected $nearest_neighbor_search_operation_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateIndexRequest.php b/AiPlatform/src/V1/UpdateIndexRequest.php index ddfaca5fed5c..5bac41030df1 100644 --- a/AiPlatform/src/V1/UpdateIndexRequest.php +++ b/AiPlatform/src/V1/UpdateIndexRequest.php @@ -21,7 +21,7 @@ class UpdateIndexRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Index index = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $index = null; + protected $index = null; /** * The update mask applies to the resource. * For the `FieldMask` definition, see @@ -29,7 +29,7 @@ class UpdateIndexRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\Index $index Required. The Index which updates the resource on the server. diff --git a/AiPlatform/src/V1/UpdateModelDeploymentMonitoringJobOperationMetadata.php b/AiPlatform/src/V1/UpdateModelDeploymentMonitoringJobOperationMetadata.php index 711291725583..3d0fc95854ce 100644 --- a/AiPlatform/src/V1/UpdateModelDeploymentMonitoringJobOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateModelDeploymentMonitoringJobOperationMetadata.php @@ -21,7 +21,7 @@ class UpdateModelDeploymentMonitoringJobOperationMetadata extends \Google\Protob * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateModelDeploymentMonitoringJobRequest.php b/AiPlatform/src/V1/UpdateModelDeploymentMonitoringJobRequest.php index b79d2fccda62..9c23d08874e2 100644 --- a/AiPlatform/src/V1/UpdateModelDeploymentMonitoringJobRequest.php +++ b/AiPlatform/src/V1/UpdateModelDeploymentMonitoringJobRequest.php @@ -22,7 +22,7 @@ class UpdateModelDeploymentMonitoringJobRequest extends \Google\Protobuf\Interna * * Generated from protobuf field .google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob model_deployment_monitoring_job = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $model_deployment_monitoring_job = null; + protected $model_deployment_monitoring_job = null; /** * Required. The update mask is used to specify the fields to be overwritten * in the ModelDeploymentMonitoringJob resource by the update. The fields @@ -51,7 +51,7 @@ class UpdateModelDeploymentMonitoringJobRequest extends \Google\Protobuf\Interna * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob $modelDeploymentMonitoringJob Required. The model monitoring configuration which replaces the resource on diff --git a/AiPlatform/src/V1/UpdateModelRequest.php b/AiPlatform/src/V1/UpdateModelRequest.php index baf2609c9654..3945ac5f6e7e 100644 --- a/AiPlatform/src/V1/UpdateModelRequest.php +++ b/AiPlatform/src/V1/UpdateModelRequest.php @@ -38,7 +38,7 @@ class UpdateModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Model model = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $model = null; + protected $model = null; /** * Required. The update mask applies to the resource. * For the `FieldMask` definition, see @@ -46,7 +46,7 @@ class UpdateModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\Model $model Required. The Model which replaces the resource on the server. diff --git a/AiPlatform/src/V1/UpdateNotebookRuntimeTemplateRequest.php b/AiPlatform/src/V1/UpdateNotebookRuntimeTemplateRequest.php index f09f04db4631..512191eab074 100644 --- a/AiPlatform/src/V1/UpdateNotebookRuntimeTemplateRequest.php +++ b/AiPlatform/src/V1/UpdateNotebookRuntimeTemplateRequest.php @@ -21,7 +21,7 @@ class UpdateNotebookRuntimeTemplateRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.aiplatform.v1.NotebookRuntimeTemplate notebook_runtime_template = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $notebook_runtime_template = null; + protected $notebook_runtime_template = null; /** * Required. The update mask applies to the resource. * For the `FieldMask` definition, see @@ -31,7 +31,7 @@ class UpdateNotebookRuntimeTemplateRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\NotebookRuntimeTemplate $notebookRuntimeTemplate Required. The NotebookRuntimeTemplate to update. diff --git a/AiPlatform/src/V1/UpdatePersistentResourceOperationMetadata.php b/AiPlatform/src/V1/UpdatePersistentResourceOperationMetadata.php index bc3dd13eaf1f..b1dd3ee768f6 100644 --- a/AiPlatform/src/V1/UpdatePersistentResourceOperationMetadata.php +++ b/AiPlatform/src/V1/UpdatePersistentResourceOperationMetadata.php @@ -20,13 +20,13 @@ class UpdatePersistentResourceOperationMetadata extends \Google\Protobuf\Interna * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Progress Message for Update LRO * * Generated from protobuf field string progress_message = 2; */ - private $progress_message = ''; + protected $progress_message = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdatePersistentResourceRequest.php b/AiPlatform/src/V1/UpdatePersistentResourceRequest.php index 8da87c571779..1bab652a757f 100644 --- a/AiPlatform/src/V1/UpdatePersistentResourceRequest.php +++ b/AiPlatform/src/V1/UpdatePersistentResourceRequest.php @@ -23,14 +23,14 @@ class UpdatePersistentResourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.PersistentResource persistent_resource = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $persistent_resource = null; + protected $persistent_resource = null; /** * Required. Specify the fields to be overwritten in the PersistentResource by * the update method. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\PersistentResource $persistentResource Required. The PersistentResource to update. diff --git a/AiPlatform/src/V1/UpdateScheduleRequest.php b/AiPlatform/src/V1/UpdateScheduleRequest.php index d324cb71cc6a..6194c0c97b54 100644 --- a/AiPlatform/src/V1/UpdateScheduleRequest.php +++ b/AiPlatform/src/V1/UpdateScheduleRequest.php @@ -25,14 +25,14 @@ class UpdateScheduleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Schedule schedule = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $schedule = null; + protected $schedule = null; /** * Required. The update mask applies to the resource. See * [google.protobuf.FieldMask][google.protobuf.FieldMask]. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\Schedule $schedule Required. The Schedule which replaces the resource on the server. diff --git a/AiPlatform/src/V1/UpdateSpecialistPoolOperationMetadata.php b/AiPlatform/src/V1/UpdateSpecialistPoolOperationMetadata.php index b772b989ab16..9e645333a7e3 100644 --- a/AiPlatform/src/V1/UpdateSpecialistPoolOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateSpecialistPoolOperationMetadata.php @@ -23,13 +23,13 @@ class UpdateSpecialistPoolOperationMetadata extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string specialist_pool = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $specialist_pool = ''; + protected $specialist_pool = ''; /** * The operation generic information. * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 2; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateSpecialistPoolRequest.php b/AiPlatform/src/V1/UpdateSpecialistPoolRequest.php index 28085aa69968..2d9a847c6940 100644 --- a/AiPlatform/src/V1/UpdateSpecialistPoolRequest.php +++ b/AiPlatform/src/V1/UpdateSpecialistPoolRequest.php @@ -21,13 +21,13 @@ class UpdateSpecialistPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.SpecialistPool specialist_pool = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $specialist_pool = null; + protected $specialist_pool = null; /** * Required. The update mask applies to the resource. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\AIPlatform\V1\SpecialistPool $specialistPool Required. The SpecialistPool which replaces the resource on the server. diff --git a/AiPlatform/src/V1/UpdateTensorboardExperimentRequest.php b/AiPlatform/src/V1/UpdateTensorboardExperimentRequest.php index 1798e41de4a5..caea902e4747 100644 --- a/AiPlatform/src/V1/UpdateTensorboardExperimentRequest.php +++ b/AiPlatform/src/V1/UpdateTensorboardExperimentRequest.php @@ -26,7 +26,7 @@ class UpdateTensorboardExperimentRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The TensorboardExperiment's `name` field is used to identify the * TensorboardExperiment to be updated. Format: @@ -34,7 +34,7 @@ class UpdateTensorboardExperimentRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.aiplatform.v1.TensorboardExperiment tensorboard_experiment = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard_experiment = null; + protected $tensorboard_experiment = null; /** * @param \Google\Cloud\AIPlatform\V1\TensorboardExperiment $tensorboardExperiment Required. The TensorboardExperiment's `name` field is used to identify the diff --git a/AiPlatform/src/V1/UpdateTensorboardOperationMetadata.php b/AiPlatform/src/V1/UpdateTensorboardOperationMetadata.php index b40468584cd0..c0a6ec8108c9 100644 --- a/AiPlatform/src/V1/UpdateTensorboardOperationMetadata.php +++ b/AiPlatform/src/V1/UpdateTensorboardOperationMetadata.php @@ -20,7 +20,7 @@ class UpdateTensorboardOperationMetadata extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UpdateTensorboardRequest.php b/AiPlatform/src/V1/UpdateTensorboardRequest.php index abf5d3a06bc2..0e92dfc199a8 100644 --- a/AiPlatform/src/V1/UpdateTensorboardRequest.php +++ b/AiPlatform/src/V1/UpdateTensorboardRequest.php @@ -26,7 +26,7 @@ class UpdateTensorboardRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The Tensorboard's `name` field is used to identify the * Tensorboard to be updated. Format: @@ -34,7 +34,7 @@ class UpdateTensorboardRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.Tensorboard tensorboard = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard = null; + protected $tensorboard = null; /** * @param \Google\Cloud\AIPlatform\V1\Tensorboard $tensorboard Required. The Tensorboard's `name` field is used to identify the diff --git a/AiPlatform/src/V1/UpdateTensorboardRunRequest.php b/AiPlatform/src/V1/UpdateTensorboardRunRequest.php index 2e4a998fdd62..2f0a0bac0536 100644 --- a/AiPlatform/src/V1/UpdateTensorboardRunRequest.php +++ b/AiPlatform/src/V1/UpdateTensorboardRunRequest.php @@ -26,7 +26,7 @@ class UpdateTensorboardRunRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The TensorboardRun's `name` field is used to identify the * TensorboardRun to be updated. Format: @@ -34,7 +34,7 @@ class UpdateTensorboardRunRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.TensorboardRun tensorboard_run = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard_run = null; + protected $tensorboard_run = null; /** * @param \Google\Cloud\AIPlatform\V1\TensorboardRun $tensorboardRun Required. The TensorboardRun's `name` field is used to identify the diff --git a/AiPlatform/src/V1/UpdateTensorboardTimeSeriesRequest.php b/AiPlatform/src/V1/UpdateTensorboardTimeSeriesRequest.php index 91b844b81ed0..537c8d8e03ec 100644 --- a/AiPlatform/src/V1/UpdateTensorboardTimeSeriesRequest.php +++ b/AiPlatform/src/V1/UpdateTensorboardTimeSeriesRequest.php @@ -26,7 +26,7 @@ class UpdateTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The TensorboardTimeSeries' `name` field is used to identify the * TensorboardTimeSeries to be updated. @@ -35,7 +35,7 @@ class UpdateTensorboardTimeSeriesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.aiplatform.v1.TensorboardTimeSeries tensorboard_time_series = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $tensorboard_time_series = null; + protected $tensorboard_time_series = null; /** * @param \Google\Cloud\AIPlatform\V1\TensorboardTimeSeries $tensorboardTimeSeries Required. The TensorboardTimeSeries' `name` field is used to identify the diff --git a/AiPlatform/src/V1/UpgradeNotebookRuntimeOperationMetadata.php b/AiPlatform/src/V1/UpgradeNotebookRuntimeOperationMetadata.php index 79aef9cbfdcd..358eb463a38b 100644 --- a/AiPlatform/src/V1/UpgradeNotebookRuntimeOperationMetadata.php +++ b/AiPlatform/src/V1/UpgradeNotebookRuntimeOperationMetadata.php @@ -21,14 +21,14 @@ class UpgradeNotebookRuntimeOperationMetadata extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * A human-readable message that shows the intermediate progress details of * NotebookRuntime. * * Generated from protobuf field string progress_message = 2; */ - private $progress_message = ''; + protected $progress_message = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/UpgradeNotebookRuntimeRequest.php b/AiPlatform/src/V1/UpgradeNotebookRuntimeRequest.php index 9ed6b370b2cb..6ce9eb6ae5f1 100644 --- a/AiPlatform/src/V1/UpgradeNotebookRuntimeRequest.php +++ b/AiPlatform/src/V1/UpgradeNotebookRuntimeRequest.php @@ -24,7 +24,7 @@ class UpgradeNotebookRuntimeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the NotebookRuntime resource to be upgrade. diff --git a/AiPlatform/src/V1/UploadModelOperationMetadata.php b/AiPlatform/src/V1/UploadModelOperationMetadata.php index 22b4cd30be6b..d70bfb3ab8a6 100644 --- a/AiPlatform/src/V1/UploadModelOperationMetadata.php +++ b/AiPlatform/src/V1/UploadModelOperationMetadata.php @@ -22,7 +22,7 @@ class UploadModelOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.GenericOperationMetadata generic_metadata = 1; */ - private $generic_metadata = null; + protected $generic_metadata = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UploadModelRequest.php b/AiPlatform/src/V1/UploadModelRequest.php index 75e1f5079c13..69501a951a39 100644 --- a/AiPlatform/src/V1/UploadModelRequest.php +++ b/AiPlatform/src/V1/UploadModelRequest.php @@ -22,14 +22,14 @@ class UploadModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The resource name of the model into which to upload the version. * Only specify this field when uploading a new version. * * Generated from protobuf field string parent_model = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $parent_model = ''; + protected $parent_model = ''; /** * Optional. The ID to use for the uploaded Model, which will become the final * component of the model resource name. @@ -38,13 +38,13 @@ class UploadModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model_id = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $model_id = ''; + protected $model_id = ''; /** * Required. The Model to create. * * Generated from protobuf field .google.cloud.aiplatform.v1.Model model = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $model = null; + protected $model = null; /** * Optional. The user-provided custom service account to use to do the model * upload. If empty, [Vertex AI Service @@ -56,7 +56,7 @@ class UploadModelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $service_account = ''; + protected $service_account = ''; /** * @param string $parent Required. The resource name of the Location into which to upload the Model. diff --git a/AiPlatform/src/V1/UploadModelResponse.php b/AiPlatform/src/V1/UploadModelResponse.php index f7d6f9fa34ee..c23e9cb588b0 100644 --- a/AiPlatform/src/V1/UploadModelResponse.php +++ b/AiPlatform/src/V1/UploadModelResponse.php @@ -23,13 +23,13 @@ class UploadModelResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model = 1 [(.google.api.resource_reference) = { */ - private $model = ''; + protected $model = ''; /** * Output only. The version ID of the model that is uploaded. * * Generated from protobuf field string model_version_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $model_version_id = ''; + protected $model_version_id = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/UpsertDatapointsRequest.php b/AiPlatform/src/V1/UpsertDatapointsRequest.php index 4a94240bca6e..483d4b8da232 100644 --- a/AiPlatform/src/V1/UpsertDatapointsRequest.php +++ b/AiPlatform/src/V1/UpsertDatapointsRequest.php @@ -23,7 +23,7 @@ class UpsertDatapointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string index = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $index = ''; + protected $index = ''; /** * A list of datapoints to be created/updated. * @@ -39,7 +39,7 @@ class UpsertDatapointsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $update_mask = null; + protected $update_mask = null; /** * Constructor. diff --git a/AiPlatform/src/V1/UserActionReference.php b/AiPlatform/src/V1/UserActionReference.php index b60a9fab6a72..0f20b8fd1531 100644 --- a/AiPlatform/src/V1/UserActionReference.php +++ b/AiPlatform/src/V1/UserActionReference.php @@ -22,7 +22,7 @@ class UserActionReference extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string method = 3; */ - private $method = ''; + protected $method = ''; protected $reference; /** diff --git a/AiPlatform/src/V1/VertexAISearch.php b/AiPlatform/src/V1/VertexAISearch.php index cdf98c4910d7..9c1e78170308 100644 --- a/AiPlatform/src/V1/VertexAISearch.php +++ b/AiPlatform/src/V1/VertexAISearch.php @@ -23,7 +23,7 @@ class VertexAISearch extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $datastore = ''; + protected $datastore = ''; /** * Constructor. diff --git a/AiPlatform/src/V1/VideoMetadata.php b/AiPlatform/src/V1/VideoMetadata.php index 960e74b28dae..f59bf9eae70e 100644 --- a/AiPlatform/src/V1/VideoMetadata.php +++ b/AiPlatform/src/V1/VideoMetadata.php @@ -20,13 +20,13 @@ class VideoMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration start_offset = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $start_offset = null; + protected $start_offset = null; /** * Optional. The end offset of the video. * * Generated from protobuf field .google.protobuf.Duration end_offset = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $end_offset = null; + protected $end_offset = null; /** * Constructor. diff --git a/AiPlatform/src/V1/VizierServiceClient.php b/AiPlatform/src/V1/VizierServiceClient.php deleted file mode 100644 index fb24f047ec6b..000000000000 --- a/AiPlatform/src/V1/VizierServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.aiplatform.v1.VizierService/CreateStudy', - $argument, - ['\Google\Cloud\AIPlatform\V1\Study', 'decode'], - $metadata, $options); - } - - /** - * Gets a Study by name. - * @param \Google\Cloud\AIPlatform\V1\GetStudyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetStudy(\Google\Cloud\AIPlatform\V1\GetStudyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/GetStudy', - $argument, - ['\Google\Cloud\AIPlatform\V1\Study', 'decode'], - $metadata, $options); - } - - /** - * Lists all the studies in a region for an associated project. - * @param \Google\Cloud\AIPlatform\V1\ListStudiesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListStudies(\Google\Cloud\AIPlatform\V1\ListStudiesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/ListStudies', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListStudiesResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a Study. - * @param \Google\Cloud\AIPlatform\V1\DeleteStudyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteStudy(\Google\Cloud\AIPlatform\V1\DeleteStudyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/DeleteStudy', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Looks a study up using the user-defined display_name field instead of the - * fully qualified resource name. - * @param \Google\Cloud\AIPlatform\V1\LookupStudyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function LookupStudy(\Google\Cloud\AIPlatform\V1\LookupStudyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/LookupStudy', - $argument, - ['\Google\Cloud\AIPlatform\V1\Study', 'decode'], - $metadata, $options); - } - - /** - * Adds one or more Trials to a Study, with parameter values - * suggested by Vertex AI Vizier. Returns a long-running - * operation associated with the generation of Trial suggestions. - * When this long-running operation succeeds, it will contain - * a [SuggestTrialsResponse][google.cloud.ml.v1.SuggestTrialsResponse]. - * @param \Google\Cloud\AIPlatform\V1\SuggestTrialsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SuggestTrials(\Google\Cloud\AIPlatform\V1\SuggestTrialsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/SuggestTrials', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Adds a user provided Trial to a Study. - * @param \Google\Cloud\AIPlatform\V1\CreateTrialRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateTrial(\Google\Cloud\AIPlatform\V1\CreateTrialRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/CreateTrial', - $argument, - ['\Google\Cloud\AIPlatform\V1\Trial', 'decode'], - $metadata, $options); - } - - /** - * Gets a Trial. - * @param \Google\Cloud\AIPlatform\V1\GetTrialRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetTrial(\Google\Cloud\AIPlatform\V1\GetTrialRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/GetTrial', - $argument, - ['\Google\Cloud\AIPlatform\V1\Trial', 'decode'], - $metadata, $options); - } - - /** - * Lists the Trials associated with a Study. - * @param \Google\Cloud\AIPlatform\V1\ListTrialsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListTrials(\Google\Cloud\AIPlatform\V1\ListTrialsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/ListTrials', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListTrialsResponse', 'decode'], - $metadata, $options); - } - - /** - * Adds a measurement of the objective metrics to a Trial. This measurement - * is assumed to have been taken before the Trial is complete. - * @param \Google\Cloud\AIPlatform\V1\AddTrialMeasurementRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function AddTrialMeasurement(\Google\Cloud\AIPlatform\V1\AddTrialMeasurementRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/AddTrialMeasurement', - $argument, - ['\Google\Cloud\AIPlatform\V1\Trial', 'decode'], - $metadata, $options); - } - - /** - * Marks a Trial as complete. - * @param \Google\Cloud\AIPlatform\V1\CompleteTrialRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CompleteTrial(\Google\Cloud\AIPlatform\V1\CompleteTrialRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/CompleteTrial', - $argument, - ['\Google\Cloud\AIPlatform\V1\Trial', 'decode'], - $metadata, $options); - } - - /** - * Deletes a Trial. - * @param \Google\Cloud\AIPlatform\V1\DeleteTrialRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteTrial(\Google\Cloud\AIPlatform\V1\DeleteTrialRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/DeleteTrial', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Checks whether a Trial should stop or not. Returns a - * long-running operation. When the operation is successful, - * it will contain a - * [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse]. - * @param \Google\Cloud\AIPlatform\V1\CheckTrialEarlyStoppingStateRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CheckTrialEarlyStoppingState(\Google\Cloud\AIPlatform\V1\CheckTrialEarlyStoppingStateRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/CheckTrialEarlyStoppingState', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Stops a Trial. - * @param \Google\Cloud\AIPlatform\V1\StopTrialRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function StopTrial(\Google\Cloud\AIPlatform\V1\StopTrialRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/StopTrial', - $argument, - ['\Google\Cloud\AIPlatform\V1\Trial', 'decode'], - $metadata, $options); - } - - /** - * Lists the pareto-optimal Trials for multi-objective Study or the - * optimal Trials for single-objective Study. The definition of - * pareto-optimal can be checked in wiki page. - * https://en.wikipedia.org/wiki/Pareto_efficiency - * @param \Google\Cloud\AIPlatform\V1\ListOptimalTrialsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListOptimalTrials(\Google\Cloud\AIPlatform\V1\ListOptimalTrialsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.aiplatform.v1.VizierService/ListOptimalTrials', - $argument, - ['\Google\Cloud\AIPlatform\V1\ListOptimalTrialsResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/AiPlatform/src/V1/WorkerPoolSpec.php b/AiPlatform/src/V1/WorkerPoolSpec.php index 9285f136b42f..7187edeeb7e5 100644 --- a/AiPlatform/src/V1/WorkerPoolSpec.php +++ b/AiPlatform/src/V1/WorkerPoolSpec.php @@ -20,13 +20,13 @@ class WorkerPoolSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.MachineSpec machine_spec = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = IMMUTABLE]; */ - private $machine_spec = null; + protected $machine_spec = null; /** * Optional. The number of worker replicas to use for this worker pool. * * Generated from protobuf field int64 replica_count = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $replica_count = 0; + protected $replica_count = 0; /** * Optional. List of NFS mount spec. * @@ -38,7 +38,7 @@ class WorkerPoolSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.DiskSpec disk_spec = 5; */ - private $disk_spec = null; + protected $disk_spec = null; protected $task; /** diff --git a/AiPlatform/src/V1/WriteFeatureValuesPayload.php b/AiPlatform/src/V1/WriteFeatureValuesPayload.php index bf8e92379307..97cb1a18d92d 100644 --- a/AiPlatform/src/V1/WriteFeatureValuesPayload.php +++ b/AiPlatform/src/V1/WriteFeatureValuesPayload.php @@ -20,7 +20,7 @@ class WriteFeatureValuesPayload extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $entity_id = ''; + protected $entity_id = ''; /** * Required. Feature values to be written, mapping from Feature ID to value. * Up to 100,000 `feature_values` entries may be written across all payloads. diff --git a/AiPlatform/src/V1/WriteFeatureValuesRequest.php b/AiPlatform/src/V1/WriteFeatureValuesRequest.php index 7965ea6a4369..eca5d3ecd97e 100644 --- a/AiPlatform/src/V1/WriteFeatureValuesRequest.php +++ b/AiPlatform/src/V1/WriteFeatureValuesRequest.php @@ -26,7 +26,7 @@ class WriteFeatureValuesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entity_type = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $entity_type = ''; + protected $entity_type = ''; /** * Required. The entities to be written. Up to 100,000 feature values can be * written across all `payloads`. diff --git a/AiPlatform/src/V1/WriteTensorboardExperimentDataRequest.php b/AiPlatform/src/V1/WriteTensorboardExperimentDataRequest.php index e63777f25b80..884f4b0e7ebb 100644 --- a/AiPlatform/src/V1/WriteTensorboardExperimentDataRequest.php +++ b/AiPlatform/src/V1/WriteTensorboardExperimentDataRequest.php @@ -23,7 +23,7 @@ class WriteTensorboardExperimentDataRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string tensorboard_experiment = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $tensorboard_experiment = ''; + protected $tensorboard_experiment = ''; /** * Required. Requests containing per-run TensorboardTimeSeries data to write. * diff --git a/AiPlatform/src/V1/WriteTensorboardRunDataRequest.php b/AiPlatform/src/V1/WriteTensorboardRunDataRequest.php index 0e5837b9f67c..8506fce8fcce 100644 --- a/AiPlatform/src/V1/WriteTensorboardRunDataRequest.php +++ b/AiPlatform/src/V1/WriteTensorboardRunDataRequest.php @@ -23,7 +23,7 @@ class WriteTensorboardRunDataRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string tensorboard_run = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $tensorboard_run = ''; + protected $tensorboard_run = ''; /** * Required. The TensorboardTimeSeries data to write. * Values with in a time series are indexed by their step value. diff --git a/AiPlatform/src/V1/XraiAttribution.php b/AiPlatform/src/V1/XraiAttribution.php index c9970d191faf..bac942e9f60f 100644 --- a/AiPlatform/src/V1/XraiAttribution.php +++ b/AiPlatform/src/V1/XraiAttribution.php @@ -27,7 +27,7 @@ class XraiAttribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 step_count = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $step_count = 0; + protected $step_count = 0; /** * Config for SmoothGrad approximation of gradients. * When enabled, the gradients are approximated by averaging the gradients @@ -37,7 +37,7 @@ class XraiAttribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.SmoothGradConfig smooth_grad_config = 2; */ - private $smooth_grad_config = null; + protected $smooth_grad_config = null; /** * Config for XRAI with blur baseline. * When enabled, a linear path from the maximally blurred image to the input @@ -47,7 +47,7 @@ class XraiAttribution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.aiplatform.v1.BlurBaselineConfig blur_baseline_config = 3; */ - private $blur_baseline_config = null; + protected $blur_baseline_config = null; /** * Constructor. diff --git a/AiPlatform/tests/Unit/V1/Client/DatasetServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/DatasetServiceClientTest.php index 0bb9789072b3..be5519ca77be 100644 --- a/AiPlatform/tests/Unit/V1/Client/DatasetServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/DatasetServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return DatasetServiceClient */ @@ -163,9 +165,7 @@ public function createDatasetTest() $dataset->setMetadataSchemaUri($datasetMetadataSchemaUri); $datasetMetadata = new Value(); $dataset->setMetadata($datasetMetadata); - $request = (new CreateDatasetRequest()) - ->setParent($formattedParent) - ->setDataset($dataset); + $request = (new CreateDatasetRequest())->setParent($formattedParent)->setDataset($dataset); $response = $gapicClient->createDataset($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -223,12 +223,15 @@ public function createDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -239,9 +242,7 @@ public function createDatasetExceptionTest() $dataset->setMetadataSchemaUri($datasetMetadataSchemaUri); $datasetMetadata = new Value(); $dataset->setMetadata($datasetMetadata); - $request = (new CreateDatasetRequest()) - ->setParent($formattedParent) - ->setDataset($dataset); + $request = (new CreateDatasetRequest())->setParent($formattedParent)->setDataset($dataset); $response = $gapicClient->createDataset($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -308,9 +309,7 @@ public function createDatasetVersionTest() $datasetVersion = new DatasetVersion(); $datasetVersionMetadata = new Value(); $datasetVersion->setMetadata($datasetVersionMetadata); - $request = (new CreateDatasetVersionRequest()) - ->setParent($formattedParent) - ->setDatasetVersion($datasetVersion); + $request = (new CreateDatasetVersionRequest())->setParent($formattedParent)->setDatasetVersion($datasetVersion); $response = $gapicClient->createDatasetVersion($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -368,21 +367,22 @@ public function createDatasetVersionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); $datasetVersion = new DatasetVersion(); $datasetVersionMetadata = new Value(); $datasetVersion->setMetadata($datasetVersionMetadata); - $request = (new CreateDatasetVersionRequest()) - ->setParent($formattedParent) - ->setDatasetVersion($datasetVersion); + $request = (new CreateDatasetVersionRequest())->setParent($formattedParent)->setDatasetVersion($datasetVersion); $response = $gapicClient->createDatasetVersion($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -436,8 +436,7 @@ public function deleteDatasetTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new DeleteDatasetRequest()) - ->setName($formattedName); + $request = (new DeleteDatasetRequest())->setName($formattedName); $response = $gapicClient->deleteDataset($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -493,17 +492,19 @@ public function deleteDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new DeleteDatasetRequest()) - ->setName($formattedName); + $request = (new DeleteDatasetRequest())->setName($formattedName); $response = $gapicClient->deleteDataset($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -557,8 +558,7 @@ public function deleteDatasetVersionTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $request = (new DeleteDatasetVersionRequest()) - ->setName($formattedName); + $request = (new DeleteDatasetVersionRequest())->setName($formattedName); $response = $gapicClient->deleteDatasetVersion($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -614,17 +614,19 @@ public function deleteDatasetVersionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $request = (new DeleteDatasetVersionRequest()) - ->setName($formattedName); + $request = (new DeleteDatasetVersionRequest())->setName($formattedName); $response = $gapicClient->deleteDatasetVersion($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -678,8 +680,7 @@ public function deleteSavedQueryTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->savedQueryName('[PROJECT]', '[LOCATION]', '[DATASET]', '[SAVED_QUERY]'); - $request = (new DeleteSavedQueryRequest()) - ->setName($formattedName); + $request = (new DeleteSavedQueryRequest())->setName($formattedName); $response = $gapicClient->deleteSavedQuery($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -735,17 +736,19 @@ public function deleteSavedQueryExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->savedQueryName('[PROJECT]', '[LOCATION]', '[DATASET]', '[SAVED_QUERY]'); - $request = (new DeleteSavedQueryRequest()) - ->setName($formattedName); + $request = (new DeleteSavedQueryRequest())->setName($formattedName); $response = $gapicClient->deleteSavedQuery($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -800,9 +803,7 @@ public function exportDataTest() // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); $exportConfig = new ExportDataConfig(); - $request = (new ExportDataRequest()) - ->setName($formattedName) - ->setExportConfig($exportConfig); + $request = (new ExportDataRequest())->setName($formattedName)->setExportConfig($exportConfig); $response = $gapicClient->exportData($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -860,19 +861,20 @@ public function exportDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); $exportConfig = new ExportDataConfig(); - $request = (new ExportDataRequest()) - ->setName($formattedName) - ->setExportConfig($exportConfig); + $request = (new ExportDataRequest())->setName($formattedName)->setExportConfig($exportConfig); $response = $gapicClient->exportData($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -914,8 +916,7 @@ public function getAnnotationSpecTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->annotationSpecName('[PROJECT]', '[LOCATION]', '[DATASET]', '[ANNOTATION_SPEC]'); - $request = (new GetAnnotationSpecRequest()) - ->setName($formattedName); + $request = (new GetAnnotationSpecRequest())->setName($formattedName); $response = $gapicClient->getAnnotationSpec($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -939,17 +940,19 @@ public function getAnnotationSpecExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->annotationSpecName('[PROJECT]', '[LOCATION]', '[DATASET]', '[ANNOTATION_SPEC]'); - $request = (new GetAnnotationSpecRequest()) - ->setName($formattedName); + $request = (new GetAnnotationSpecRequest())->setName($formattedName); try { $gapicClient->getAnnotationSpec($request); // If the $gapicClient method call did not throw, fail the test @@ -992,8 +995,7 @@ public function getDatasetTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new GetDatasetRequest()) - ->setName($formattedName); + $request = (new GetDatasetRequest())->setName($formattedName); $response = $gapicClient->getDataset($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1017,17 +1019,19 @@ public function getDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new GetDatasetRequest()) - ->setName($formattedName); + $request = (new GetDatasetRequest())->setName($formattedName); try { $gapicClient->getDataset($request); // If the $gapicClient method call did not throw, fail the test @@ -1064,8 +1068,7 @@ public function getDatasetVersionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $request = (new GetDatasetVersionRequest()) - ->setName($formattedName); + $request = (new GetDatasetVersionRequest())->setName($formattedName); $response = $gapicClient->getDatasetVersion($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1089,17 +1092,19 @@ public function getDatasetVersionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $request = (new GetDatasetVersionRequest()) - ->setName($formattedName); + $request = (new GetDatasetVersionRequest())->setName($formattedName); try { $gapicClient->getDatasetVersion($request); // If the $gapicClient method call did not throw, fail the test @@ -1145,9 +1150,7 @@ public function importDataTest() // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); $importConfigs = []; - $request = (new ImportDataRequest()) - ->setName($formattedName) - ->setImportConfigs($importConfigs); + $request = (new ImportDataRequest())->setName($formattedName)->setImportConfigs($importConfigs); $response = $gapicClient->importData($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1205,19 +1208,20 @@ public function importDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); $importConfigs = []; - $request = (new ImportDataRequest()) - ->setName($formattedName) - ->setImportConfigs($importConfigs); + $request = (new ImportDataRequest())->setName($formattedName)->setImportConfigs($importConfigs); $response = $gapicClient->importData($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1251,17 +1255,14 @@ public function listAnnotationsTest() // Mock response $nextPageToken = ''; $annotationsElement = new Annotation(); - $annotations = [ - $annotationsElement, - ]; + $annotations = [$annotationsElement]; $expectedResponse = new ListAnnotationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAnnotations($annotations); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->dataItemName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATA_ITEM]'); - $request = (new ListAnnotationsRequest()) - ->setParent($formattedParent); + $request = (new ListAnnotationsRequest())->setParent($formattedParent); $response = $gapicClient->listAnnotations($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1288,17 +1289,19 @@ public function listAnnotationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->dataItemName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATA_ITEM]'); - $request = (new ListAnnotationsRequest()) - ->setParent($formattedParent); + $request = (new ListAnnotationsRequest())->setParent($formattedParent); try { $gapicClient->listAnnotations($request); // If the $gapicClient method call did not throw, fail the test @@ -1323,17 +1326,14 @@ public function listDataItemsTest() // Mock response $nextPageToken = ''; $dataItemsElement = new DataItem(); - $dataItems = [ - $dataItemsElement, - ]; + $dataItems = [$dataItemsElement]; $expectedResponse = new ListDataItemsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDataItems($dataItems); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new ListDataItemsRequest()) - ->setParent($formattedParent); + $request = (new ListDataItemsRequest())->setParent($formattedParent); $response = $gapicClient->listDataItems($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1360,17 +1360,19 @@ public function listDataItemsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new ListDataItemsRequest()) - ->setParent($formattedParent); + $request = (new ListDataItemsRequest())->setParent($formattedParent); try { $gapicClient->listDataItems($request); // If the $gapicClient method call did not throw, fail the test @@ -1395,17 +1397,14 @@ public function listDatasetVersionsTest() // Mock response $nextPageToken = ''; $datasetVersionsElement = new DatasetVersion(); - $datasetVersions = [ - $datasetVersionsElement, - ]; + $datasetVersions = [$datasetVersionsElement]; $expectedResponse = new ListDatasetVersionsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDatasetVersions($datasetVersions); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new ListDatasetVersionsRequest()) - ->setParent($formattedParent); + $request = (new ListDatasetVersionsRequest())->setParent($formattedParent); $response = $gapicClient->listDatasetVersions($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1432,17 +1431,19 @@ public function listDatasetVersionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new ListDatasetVersionsRequest()) - ->setParent($formattedParent); + $request = (new ListDatasetVersionsRequest())->setParent($formattedParent); try { $gapicClient->listDatasetVersions($request); // If the $gapicClient method call did not throw, fail the test @@ -1467,17 +1468,14 @@ public function listDatasetsTest() // Mock response $nextPageToken = ''; $datasetsElement = new Dataset(); - $datasets = [ - $datasetsElement, - ]; + $datasets = [$datasetsElement]; $expectedResponse = new ListDatasetsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDatasets($datasets); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListDatasetsRequest()) - ->setParent($formattedParent); + $request = (new ListDatasetsRequest())->setParent($formattedParent); $response = $gapicClient->listDatasets($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1504,17 +1502,19 @@ public function listDatasetsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListDatasetsRequest()) - ->setParent($formattedParent); + $request = (new ListDatasetsRequest())->setParent($formattedParent); try { $gapicClient->listDatasets($request); // If the $gapicClient method call did not throw, fail the test @@ -1539,17 +1539,14 @@ public function listSavedQueriesTest() // Mock response $nextPageToken = ''; $savedQueriesElement = new SavedQuery(); - $savedQueries = [ - $savedQueriesElement, - ]; + $savedQueries = [$savedQueriesElement]; $expectedResponse = new ListSavedQueriesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setSavedQueries($savedQueries); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new ListSavedQueriesRequest()) - ->setParent($formattedParent); + $request = (new ListSavedQueriesRequest())->setParent($formattedParent); $response = $gapicClient->listSavedQueries($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1576,17 +1573,19 @@ public function listSavedQueriesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new ListSavedQueriesRequest()) - ->setParent($formattedParent); + $request = (new ListSavedQueriesRequest())->setParent($formattedParent); try { $gapicClient->listSavedQueries($request); // If the $gapicClient method call did not throw, fail the test @@ -1641,8 +1640,7 @@ public function restoreDatasetVersionTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $request = (new RestoreDatasetVersionRequest()) - ->setName($formattedName); + $request = (new RestoreDatasetVersionRequest())->setName($formattedName); $response = $gapicClient->restoreDatasetVersion($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1698,17 +1696,19 @@ public function restoreDatasetVersionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $request = (new RestoreDatasetVersionRequest()) - ->setName($formattedName); + $request = (new RestoreDatasetVersionRequest())->setName($formattedName); $response = $gapicClient->restoreDatasetVersion($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1742,17 +1742,14 @@ public function searchDataItemsTest() // Mock response $nextPageToken = ''; $dataItemViewsElement = new DataItemView(); - $dataItemViews = [ - $dataItemViewsElement, - ]; + $dataItemViews = [$dataItemViewsElement]; $expectedResponse = new SearchDataItemsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDataItemViews($dataItemViews); $transport->addResponse($expectedResponse); // Mock request $formattedDataset = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new SearchDataItemsRequest()) - ->setDataset($formattedDataset); + $request = (new SearchDataItemsRequest())->setDataset($formattedDataset); $response = $gapicClient->searchDataItems($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1779,17 +1776,19 @@ public function searchDataItemsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedDataset = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $request = (new SearchDataItemsRequest()) - ->setDataset($formattedDataset); + $request = (new SearchDataItemsRequest())->setDataset($formattedDataset); try { $gapicClient->searchDataItems($request); // If the $gapicClient method call did not throw, fail the test @@ -1839,9 +1838,7 @@ public function updateDatasetTest() $datasetMetadata = new Value(); $dataset->setMetadata($datasetMetadata); $updateMask = new FieldMask(); - $request = (new UpdateDatasetRequest()) - ->setDataset($dataset) - ->setUpdateMask($updateMask); + $request = (new UpdateDatasetRequest())->setDataset($dataset)->setUpdateMask($updateMask); $response = $gapicClient->updateDataset($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1867,12 +1864,15 @@ public function updateDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $dataset = new Dataset(); @@ -1883,9 +1883,7 @@ public function updateDatasetExceptionTest() $datasetMetadata = new Value(); $dataset->setMetadata($datasetMetadata); $updateMask = new FieldMask(); - $request = (new UpdateDatasetRequest()) - ->setDataset($dataset) - ->setUpdateMask($updateMask); + $request = (new UpdateDatasetRequest())->setDataset($dataset)->setUpdateMask($updateMask); try { $gapicClient->updateDataset($request); // If the $gapicClient method call did not throw, fail the test @@ -1925,9 +1923,7 @@ public function updateDatasetVersionTest() $datasetVersionMetadata = new Value(); $datasetVersion->setMetadata($datasetVersionMetadata); $updateMask = new FieldMask(); - $request = (new UpdateDatasetVersionRequest()) - ->setDatasetVersion($datasetVersion) - ->setUpdateMask($updateMask); + $request = (new UpdateDatasetVersionRequest())->setDatasetVersion($datasetVersion)->setUpdateMask($updateMask); $response = $gapicClient->updateDatasetVersion($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1953,21 +1949,22 @@ public function updateDatasetVersionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $datasetVersion = new DatasetVersion(); $datasetVersionMetadata = new Value(); $datasetVersion->setMetadata($datasetVersionMetadata); $updateMask = new FieldMask(); - $request = (new UpdateDatasetVersionRequest()) - ->setDatasetVersion($datasetVersion) - ->setUpdateMask($updateMask); + $request = (new UpdateDatasetVersionRequest())->setDatasetVersion($datasetVersion)->setUpdateMask($updateMask); try { $gapicClient->updateDatasetVersion($request); // If the $gapicClient method call did not throw, fail the test @@ -2020,12 +2017,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -2052,9 +2052,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -2084,12 +2082,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -2122,8 +2123,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2147,17 +2147,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -2189,9 +2191,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2217,19 +2217,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -2257,9 +2258,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2285,19 +2284,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -2365,9 +2365,7 @@ public function createDatasetAsyncTest() $dataset->setMetadataSchemaUri($datasetMetadataSchemaUri); $datasetMetadata = new Value(); $dataset->setMetadata($datasetMetadata); - $request = (new CreateDatasetRequest()) - ->setParent($formattedParent) - ->setDataset($dataset); + $request = (new CreateDatasetRequest())->setParent($formattedParent)->setDataset($dataset); $response = $gapicClient->createDatasetAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/AiPlatform/tests/Unit/V1/Client/DeploymentResourcePoolServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/DeploymentResourcePoolServiceClientTest.php index 6ea1a032740a..aef6679cf8df 100644 --- a/AiPlatform/tests/Unit/V1/Client/DeploymentResourcePoolServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/DeploymentResourcePoolServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return DeploymentResourcePoolServiceClient */ @@ -141,7 +143,10 @@ public function createDeploymentResourcePoolTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/CreateDeploymentResourcePool', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.DeploymentResourcePoolService/CreateDeploymentResourcePool', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getDeploymentResourcePool(); @@ -191,12 +196,15 @@ public function createDeploymentResourcePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -264,9 +272,12 @@ public function deleteDeploymentResourcePoolTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - $request = (new DeleteDeploymentResourcePoolRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->deploymentResourcePoolName( + '[PROJECT]', + '[LOCATION]', + '[DEPLOYMENT_RESOURCE_POOL]' + ); + $request = (new DeleteDeploymentResourcePoolRequest())->setName($formattedName); $response = $gapicClient->deleteDeploymentResourcePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -276,7 +287,10 @@ public function deleteDeploymentResourcePoolTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/DeleteDeploymentResourcePool', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.DeploymentResourcePoolService/DeleteDeploymentResourcePool', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -322,17 +336,23 @@ public function deleteDeploymentResourcePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - $request = (new DeleteDeploymentResourcePoolRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->deploymentResourcePoolName( + '[PROJECT]', + '[LOCATION]', + '[DEPLOYMENT_RESOURCE_POOL]' + ); + $request = (new DeleteDeploymentResourcePoolRequest())->setName($formattedName); $response = $gapicClient->deleteDeploymentResourcePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -373,16 +393,22 @@ public function getDeploymentResourcePoolTest() $expectedResponse->setDisableContainerLogging($disableContainerLogging); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - $request = (new GetDeploymentResourcePoolRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->deploymentResourcePoolName( + '[PROJECT]', + '[LOCATION]', + '[DEPLOYMENT_RESOURCE_POOL]' + ); + $request = (new GetDeploymentResourcePoolRequest())->setName($formattedName); $response = $gapicClient->getDeploymentResourcePool($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/GetDeploymentResourcePool', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.DeploymentResourcePoolService/GetDeploymentResourcePool', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -399,17 +425,23 @@ public function getDeploymentResourcePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - $request = (new GetDeploymentResourcePoolRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->deploymentResourcePoolName( + '[PROJECT]', + '[LOCATION]', + '[DEPLOYMENT_RESOURCE_POOL]' + ); + $request = (new GetDeploymentResourcePoolRequest())->setName($formattedName); try { $gapicClient->getDeploymentResourcePool($request); // If the $gapicClient method call did not throw, fail the test @@ -434,17 +466,14 @@ public function listDeploymentResourcePoolsTest() // Mock response $nextPageToken = ''; $deploymentResourcePoolsElement = new DeploymentResourcePool(); - $deploymentResourcePools = [ - $deploymentResourcePoolsElement, - ]; + $deploymentResourcePools = [$deploymentResourcePoolsElement]; $expectedResponse = new ListDeploymentResourcePoolsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDeploymentResourcePools($deploymentResourcePools); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListDeploymentResourcePoolsRequest()) - ->setParent($formattedParent); + $request = (new ListDeploymentResourcePoolsRequest())->setParent($formattedParent); $response = $gapicClient->listDeploymentResourcePools($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -454,7 +483,10 @@ public function listDeploymentResourcePoolsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/ListDeploymentResourcePools', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.DeploymentResourcePoolService/ListDeploymentResourcePools', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -471,17 +503,19 @@ public function listDeploymentResourcePoolsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListDeploymentResourcePoolsRequest()) - ->setParent($formattedParent); + $request = (new ListDeploymentResourcePoolsRequest())->setParent($formattedParent); try { $gapicClient->listDeploymentResourcePools($request); // If the $gapicClient method call did not throw, fail the test @@ -508,9 +542,7 @@ public function queryDeployedModelsTest() $totalDeployedModelCount = 591684507; $totalEndpointCount = 61124672; $deployedModelsElement = new DeployedModel(); - $deployedModels = [ - $deployedModelsElement, - ]; + $deployedModels = [$deployedModelsElement]; $expectedResponse = new QueryDeployedModelsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTotalDeployedModelCount($totalDeployedModelCount); @@ -519,8 +551,7 @@ public function queryDeployedModelsTest() $transport->addResponse($expectedResponse); // Mock request $deploymentResourcePool = 'deploymentResourcePool-1160399437'; - $request = (new QueryDeployedModelsRequest()) - ->setDeploymentResourcePool($deploymentResourcePool); + $request = (new QueryDeployedModelsRequest())->setDeploymentResourcePool($deploymentResourcePool); $response = $gapicClient->queryDeployedModels($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -530,7 +561,10 @@ public function queryDeployedModelsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/QueryDeployedModels', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.DeploymentResourcePoolService/QueryDeployedModels', + $actualFuncCall + ); $actualValue = $actualRequestObject->getDeploymentResourcePool(); $this->assertProtobufEquals($deploymentResourcePool, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -547,17 +581,19 @@ public function queryDeployedModelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $deploymentResourcePool = 'deploymentResourcePool-1160399437'; - $request = (new QueryDeployedModelsRequest()) - ->setDeploymentResourcePool($deploymentResourcePool); + $request = (new QueryDeployedModelsRequest())->setDeploymentResourcePool($deploymentResourcePool); try { $gapicClient->queryDeployedModels($request); // If the $gapicClient method call did not throw, fail the test @@ -610,12 +646,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -642,9 +681,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -674,12 +711,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -712,8 +752,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -737,17 +776,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -779,9 +820,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -807,19 +846,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -847,9 +887,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -875,19 +913,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -959,7 +998,10 @@ public function createDeploymentResourcePoolAsyncTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/CreateDeploymentResourcePool', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.DeploymentResourcePoolService/CreateDeploymentResourcePool', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getDeploymentResourcePool(); diff --git a/AiPlatform/tests/Unit/V1/Client/EndpointServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/EndpointServiceClientTest.php index 13dc011c7c3a..b523ec2af791 100644 --- a/AiPlatform/tests/Unit/V1/Client/EndpointServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/EndpointServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return EndpointServiceClient */ @@ -135,9 +137,7 @@ public function createEndpointTest() $endpoint = new Endpoint(); $endpointDisplayName = 'endpointDisplayName697270680'; $endpoint->setDisplayName($endpointDisplayName); - $request = (new CreateEndpointRequest()) - ->setParent($formattedParent) - ->setEndpoint($endpoint); + $request = (new CreateEndpointRequest())->setParent($formattedParent)->setEndpoint($endpoint); $response = $gapicClient->createEndpoint($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -195,21 +195,22 @@ public function createEndpointExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $endpoint = new Endpoint(); $endpointDisplayName = 'endpointDisplayName697270680'; $endpoint->setDisplayName($endpointDisplayName); - $request = (new CreateEndpointRequest()) - ->setParent($formattedParent) - ->setEndpoint($endpoint); + $request = (new CreateEndpointRequest())->setParent($formattedParent)->setEndpoint($endpoint); $response = $gapicClient->createEndpoint($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -263,8 +264,7 @@ public function deleteEndpointTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new DeleteEndpointRequest()) - ->setName($formattedName); + $request = (new DeleteEndpointRequest())->setName($formattedName); $response = $gapicClient->deleteEndpoint($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -320,17 +320,19 @@ public function deleteEndpointExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new DeleteEndpointRequest()) - ->setName($formattedName); + $request = (new DeleteEndpointRequest())->setName($formattedName); $response = $gapicClient->deleteEndpoint($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -387,9 +389,7 @@ public function deployModelTest() $deployedModel = new DeployedModel(); $deployedModelModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); $deployedModel->setModel($deployedModelModel); - $request = (new DeployModelRequest()) - ->setEndpoint($formattedEndpoint) - ->setDeployedModel($deployedModel); + $request = (new DeployModelRequest())->setEndpoint($formattedEndpoint)->setDeployedModel($deployedModel); $response = $gapicClient->deployModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -447,21 +447,22 @@ public function deployModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $deployedModel = new DeployedModel(); $deployedModelModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); $deployedModel->setModel($deployedModelModel); - $request = (new DeployModelRequest()) - ->setEndpoint($formattedEndpoint) - ->setDeployedModel($deployedModel); + $request = (new DeployModelRequest())->setEndpoint($formattedEndpoint)->setDeployedModel($deployedModel); $response = $gapicClient->deployModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -511,8 +512,7 @@ public function getEndpointTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new GetEndpointRequest()) - ->setName($formattedName); + $request = (new GetEndpointRequest())->setName($formattedName); $response = $gapicClient->getEndpoint($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -536,17 +536,19 @@ public function getEndpointExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new GetEndpointRequest()) - ->setName($formattedName); + $request = (new GetEndpointRequest())->setName($formattedName); try { $gapicClient->getEndpoint($request); // If the $gapicClient method call did not throw, fail the test @@ -571,17 +573,14 @@ public function listEndpointsTest() // Mock response $nextPageToken = ''; $endpointsElement = new Endpoint(); - $endpoints = [ - $endpointsElement, - ]; + $endpoints = [$endpointsElement]; $expectedResponse = new ListEndpointsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setEndpoints($endpoints); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListEndpointsRequest()) - ->setParent($formattedParent); + $request = (new ListEndpointsRequest())->setParent($formattedParent); $response = $gapicClient->listEndpoints($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -608,17 +607,19 @@ public function listEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListEndpointsRequest()) - ->setParent($formattedParent); + $request = (new ListEndpointsRequest())->setParent($formattedParent); try { $gapicClient->listEndpoints($request); // If the $gapicClient method call did not throw, fail the test @@ -730,12 +731,15 @@ public function mutateDeployedModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); @@ -801,9 +805,7 @@ public function undeployModelTest() // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $deployedModelId = 'deployedModelId866642506'; - $request = (new UndeployModelRequest()) - ->setEndpoint($formattedEndpoint) - ->setDeployedModelId($deployedModelId); + $request = (new UndeployModelRequest())->setEndpoint($formattedEndpoint)->setDeployedModelId($deployedModelId); $response = $gapicClient->undeployModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -861,19 +863,20 @@ public function undeployModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $deployedModelId = 'deployedModelId866642506'; - $request = (new UndeployModelRequest()) - ->setEndpoint($formattedEndpoint) - ->setDeployedModelId($deployedModelId); + $request = (new UndeployModelRequest())->setEndpoint($formattedEndpoint)->setDeployedModelId($deployedModelId); $response = $gapicClient->undeployModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -926,9 +929,7 @@ public function updateEndpointTest() $endpointDisplayName = 'endpointDisplayName697270680'; $endpoint->setDisplayName($endpointDisplayName); $updateMask = new FieldMask(); - $request = (new UpdateEndpointRequest()) - ->setEndpoint($endpoint) - ->setUpdateMask($updateMask); + $request = (new UpdateEndpointRequest())->setEndpoint($endpoint)->setUpdateMask($updateMask); $response = $gapicClient->updateEndpoint($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -954,21 +955,22 @@ public function updateEndpointExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $endpoint = new Endpoint(); $endpointDisplayName = 'endpointDisplayName697270680'; $endpoint->setDisplayName($endpointDisplayName); $updateMask = new FieldMask(); - $request = (new UpdateEndpointRequest()) - ->setEndpoint($endpoint) - ->setUpdateMask($updateMask); + $request = (new UpdateEndpointRequest())->setEndpoint($endpoint)->setUpdateMask($updateMask); try { $gapicClient->updateEndpoint($request); // If the $gapicClient method call did not throw, fail the test @@ -1021,12 +1023,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1053,9 +1058,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1085,12 +1088,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1123,8 +1129,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1148,17 +1153,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1190,9 +1197,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1218,19 +1223,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1258,9 +1264,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1286,19 +1290,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1360,9 +1365,7 @@ public function createEndpointAsyncTest() $endpoint = new Endpoint(); $endpointDisplayName = 'endpointDisplayName697270680'; $endpoint->setDisplayName($endpointDisplayName); - $request = (new CreateEndpointRequest()) - ->setParent($formattedParent) - ->setEndpoint($endpoint); + $request = (new CreateEndpointRequest())->setParent($formattedParent)->setEndpoint($endpoint); $response = $gapicClient->createEndpointAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/AiPlatform/tests/Unit/V1/Client/FeatureOnlineStoreAdminServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/FeatureOnlineStoreAdminServiceClientTest.php index 79f1b8535a4d..5deaef9daef6 100644 --- a/AiPlatform/tests/Unit/V1/Client/FeatureOnlineStoreAdminServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/FeatureOnlineStoreAdminServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return FeatureOnlineStoreAdminServiceClient */ @@ -142,7 +144,10 @@ public function createFeatureOnlineStoreTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureOnlineStore', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureOnlineStore', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getFeatureOnlineStore(); @@ -192,12 +197,15 @@ public function createFeatureOnlineStoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -279,7 +287,10 @@ public function createFeatureViewTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureView', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureView', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getFeatureView(); @@ -329,12 +340,15 @@ public function createFeatureViewExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); @@ -397,8 +411,7 @@ public function deleteFeatureOnlineStoreTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $request = (new DeleteFeatureOnlineStoreRequest()) - ->setName($formattedName); + $request = (new DeleteFeatureOnlineStoreRequest())->setName($formattedName); $response = $gapicClient->deleteFeatureOnlineStore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -408,7 +421,10 @@ public function deleteFeatureOnlineStoreTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureOnlineStore', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureOnlineStore', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -454,17 +470,19 @@ public function deleteFeatureOnlineStoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $request = (new DeleteFeatureOnlineStoreRequest()) - ->setName($formattedName); + $request = (new DeleteFeatureOnlineStoreRequest())->setName($formattedName); $response = $gapicClient->deleteFeatureOnlineStore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -517,9 +535,13 @@ public function deleteFeatureViewTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new DeleteFeatureViewRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new DeleteFeatureViewRequest())->setName($formattedName); $response = $gapicClient->deleteFeatureView($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -529,7 +551,10 @@ public function deleteFeatureViewTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureView', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureView', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -575,17 +600,24 @@ public function deleteFeatureViewExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new DeleteFeatureViewRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new DeleteFeatureViewRequest())->setName($formattedName); $response = $gapicClient->deleteFeatureView($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -625,15 +657,17 @@ public function getFeatureOnlineStoreTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $request = (new GetFeatureOnlineStoreRequest()) - ->setName($formattedName); + $request = (new GetFeatureOnlineStoreRequest())->setName($formattedName); $response = $gapicClient->getFeatureOnlineStore($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureOnlineStore', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureOnlineStore', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -650,17 +684,19 @@ public function getFeatureOnlineStoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $request = (new GetFeatureOnlineStoreRequest()) - ->setName($formattedName); + $request = (new GetFeatureOnlineStoreRequest())->setName($formattedName); try { $gapicClient->getFeatureOnlineStore($request); // If the $gapicClient method call did not throw, fail the test @@ -690,9 +726,13 @@ public function getFeatureViewTest() $expectedResponse->setEtag($etag); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new GetFeatureViewRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new GetFeatureViewRequest())->setName($formattedName); $response = $gapicClient->getFeatureView($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -716,17 +756,24 @@ public function getFeatureViewExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new GetFeatureViewRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new GetFeatureViewRequest())->setName($formattedName); try { $gapicClient->getFeatureView($request); // If the $gapicClient method call did not throw, fail the test @@ -754,16 +801,23 @@ public function getFeatureViewSyncTest() $expectedResponse->setName($name2); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->featureViewSyncName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new GetFeatureViewSyncRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureViewSyncName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new GetFeatureViewSyncRequest())->setName($formattedName); $response = $gapicClient->getFeatureViewSync($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureViewSync', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureViewSync', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -780,17 +834,24 @@ public function getFeatureViewSyncExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->featureViewSyncName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new GetFeatureViewSyncRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureViewSyncName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new GetFeatureViewSyncRequest())->setName($formattedName); try { $gapicClient->getFeatureViewSync($request); // If the $gapicClient method call did not throw, fail the test @@ -815,17 +876,14 @@ public function listFeatureOnlineStoresTest() // Mock response $nextPageToken = ''; $featureOnlineStoresElement = new FeatureOnlineStore(); - $featureOnlineStores = [ - $featureOnlineStoresElement, - ]; + $featureOnlineStores = [$featureOnlineStoresElement]; $expectedResponse = new ListFeatureOnlineStoresResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setFeatureOnlineStores($featureOnlineStores); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListFeatureOnlineStoresRequest()) - ->setParent($formattedParent); + $request = (new ListFeatureOnlineStoresRequest())->setParent($formattedParent); $response = $gapicClient->listFeatureOnlineStores($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -835,7 +893,10 @@ public function listFeatureOnlineStoresTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureOnlineStores', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureOnlineStores', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -852,17 +913,19 @@ public function listFeatureOnlineStoresExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListFeatureOnlineStoresRequest()) - ->setParent($formattedParent); + $request = (new ListFeatureOnlineStoresRequest())->setParent($formattedParent); try { $gapicClient->listFeatureOnlineStores($request); // If the $gapicClient method call did not throw, fail the test @@ -887,17 +950,19 @@ public function listFeatureViewSyncsTest() // Mock response $nextPageToken = ''; $featureViewSyncsElement = new FeatureViewSync(); - $featureViewSyncs = [ - $featureViewSyncsElement, - ]; + $featureViewSyncs = [$featureViewSyncsElement]; $expectedResponse = new ListFeatureViewSyncsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setFeatureViewSyncs($featureViewSyncs); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new ListFeatureViewSyncsRequest()) - ->setParent($formattedParent); + $formattedParent = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new ListFeatureViewSyncsRequest())->setParent($formattedParent); $response = $gapicClient->listFeatureViewSyncs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -907,7 +972,10 @@ public function listFeatureViewSyncsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViewSyncs', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViewSyncs', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -924,17 +992,24 @@ public function listFeatureViewSyncsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new ListFeatureViewSyncsRequest()) - ->setParent($formattedParent); + $formattedParent = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new ListFeatureViewSyncsRequest())->setParent($formattedParent); try { $gapicClient->listFeatureViewSyncs($request); // If the $gapicClient method call did not throw, fail the test @@ -959,17 +1034,14 @@ public function listFeatureViewsTest() // Mock response $nextPageToken = ''; $featureViewsElement = new FeatureView(); - $featureViews = [ - $featureViewsElement, - ]; + $featureViews = [$featureViewsElement]; $expectedResponse = new ListFeatureViewsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setFeatureViews($featureViews); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $request = (new ListFeatureViewsRequest()) - ->setParent($formattedParent); + $request = (new ListFeatureViewsRequest())->setParent($formattedParent); $response = $gapicClient->listFeatureViews($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -979,7 +1051,10 @@ public function listFeatureViewsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViews', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViews', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -996,17 +1071,19 @@ public function listFeatureViewsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $request = (new ListFeatureViewsRequest()) - ->setParent($formattedParent); + $request = (new ListFeatureViewsRequest())->setParent($formattedParent); try { $gapicClient->listFeatureViews($request); // If the $gapicClient method call did not throw, fail the test @@ -1034,16 +1111,23 @@ public function syncFeatureViewTest() $expectedResponse->setFeatureViewSync($featureViewSync); $transport->addResponse($expectedResponse); // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new SyncFeatureViewRequest()) - ->setFeatureView($formattedFeatureView); + $formattedFeatureView = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new SyncFeatureViewRequest())->setFeatureView($formattedFeatureView); $response = $gapicClient->syncFeatureView($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/SyncFeatureView', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/SyncFeatureView', + $actualFuncCall + ); $actualValue = $actualRequestObject->getFeatureView(); $this->assertProtobufEquals($formattedFeatureView, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -1060,17 +1144,24 @@ public function syncFeatureViewExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new SyncFeatureViewRequest()) - ->setFeatureView($formattedFeatureView); + $formattedFeatureView = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new SyncFeatureViewRequest())->setFeatureView($formattedFeatureView); try { $gapicClient->syncFeatureView($request); // If the $gapicClient method call did not throw, fail the test @@ -1119,8 +1210,7 @@ public function updateFeatureOnlineStoreTest() $operationsTransport->addResponse($completeOperation); // Mock request $featureOnlineStore = new FeatureOnlineStore(); - $request = (new UpdateFeatureOnlineStoreRequest()) - ->setFeatureOnlineStore($featureOnlineStore); + $request = (new UpdateFeatureOnlineStoreRequest())->setFeatureOnlineStore($featureOnlineStore); $response = $gapicClient->updateFeatureOnlineStore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1130,7 +1220,10 @@ public function updateFeatureOnlineStoreTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureOnlineStore', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureOnlineStore', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getFeatureOnlineStore(); $this->assertProtobufEquals($featureOnlineStore, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -1176,17 +1269,19 @@ public function updateFeatureOnlineStoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $featureOnlineStore = new FeatureOnlineStore(); - $request = (new UpdateFeatureOnlineStoreRequest()) - ->setFeatureOnlineStore($featureOnlineStore); + $request = (new UpdateFeatureOnlineStoreRequest())->setFeatureOnlineStore($featureOnlineStore); $response = $gapicClient->updateFeatureOnlineStore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1244,8 +1339,7 @@ public function updateFeatureViewTest() $operationsTransport->addResponse($completeOperation); // Mock request $featureView = new FeatureView(); - $request = (new UpdateFeatureViewRequest()) - ->setFeatureView($featureView); + $request = (new UpdateFeatureViewRequest())->setFeatureView($featureView); $response = $gapicClient->updateFeatureView($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1255,7 +1349,10 @@ public function updateFeatureViewTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureView', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureView', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getFeatureView(); $this->assertProtobufEquals($featureView, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -1301,17 +1398,19 @@ public function updateFeatureViewExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $featureView = new FeatureView(); - $request = (new UpdateFeatureViewRequest()) - ->setFeatureView($featureView); + $request = (new UpdateFeatureViewRequest())->setFeatureView($featureView); $response = $gapicClient->updateFeatureView($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1373,12 +1472,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1405,9 +1507,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1437,12 +1537,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1475,8 +1578,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1500,17 +1602,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1542,9 +1646,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1570,19 +1672,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1610,9 +1713,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1638,19 +1739,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1714,7 +1816,10 @@ public function createFeatureOnlineStoreAsyncTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureOnlineStore', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureOnlineStore', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getFeatureOnlineStore(); diff --git a/AiPlatform/tests/Unit/V1/Client/FeatureOnlineStoreServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/FeatureOnlineStoreServiceClientTest.php index 466b19079c5a..bdfe7d0f5efa 100644 --- a/AiPlatform/tests/Unit/V1/Client/FeatureOnlineStoreServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/FeatureOnlineStoreServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return FeatureOnlineStoreServiceClient */ @@ -84,9 +86,13 @@ public function fetchFeatureValuesTest() $expectedResponse = new FetchFeatureValuesResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new FetchFeatureValuesRequest()) - ->setFeatureView($formattedFeatureView); + $formattedFeatureView = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new FetchFeatureValuesRequest())->setFeatureView($formattedFeatureView); $response = $gapicClient->fetchFeatureValues($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -110,17 +116,24 @@ public function fetchFeatureValuesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new FetchFeatureValuesRequest()) - ->setFeatureView($formattedFeatureView); + $formattedFeatureView = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new FetchFeatureValuesRequest())->setFeatureView($formattedFeatureView); try { $gapicClient->fetchFeatureValues($request); // If the $gapicClient method call did not throw, fail the test @@ -146,18 +159,24 @@ public function searchNearestEntitiesTest() $expectedResponse = new SearchNearestEntitiesResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); + $formattedFeatureView = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); $query = new NearestNeighborQuery(); - $request = (new SearchNearestEntitiesRequest()) - ->setFeatureView($formattedFeatureView) - ->setQuery($query); + $request = (new SearchNearestEntitiesRequest())->setFeatureView($formattedFeatureView)->setQuery($query); $response = $gapicClient->searchNearestEntities($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreService/SearchNearestEntities', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeatureOnlineStoreService/SearchNearestEntities', + $actualFuncCall + ); $actualValue = $actualRequestObject->getFeatureView(); $this->assertProtobufEquals($formattedFeatureView, $actualValue); $actualValue = $actualRequestObject->getQuery(); @@ -176,19 +195,25 @@ public function searchNearestEntitiesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); + $formattedFeatureView = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); $query = new NearestNeighborQuery(); - $request = (new SearchNearestEntitiesRequest()) - ->setFeatureView($formattedFeatureView) - ->setQuery($query); + $request = (new SearchNearestEntitiesRequest())->setFeatureView($formattedFeatureView)->setQuery($query); try { $gapicClient->searchNearestEntities($request); // If the $gapicClient method call did not throw, fail the test @@ -241,12 +266,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -273,9 +301,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -305,12 +331,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -343,8 +372,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -368,17 +396,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -410,9 +440,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -438,19 +466,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -478,9 +507,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -506,19 +533,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -544,9 +572,13 @@ public function fetchFeatureValuesAsyncTest() $expectedResponse = new FetchFeatureValuesResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $request = (new FetchFeatureValuesRequest()) - ->setFeatureView($formattedFeatureView); + $formattedFeatureView = $gapicClient->featureViewName( + '[PROJECT]', + '[LOCATION]', + '[FEATURE_ONLINE_STORE]', + '[FEATURE_VIEW]' + ); + $request = (new FetchFeatureValuesRequest())->setFeatureView($formattedFeatureView); $response = $gapicClient->fetchFeatureValuesAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/AiPlatform/tests/Unit/V1/Client/FeatureRegistryServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/FeatureRegistryServiceClientTest.php index 78d73317efd1..78a1713fd026 100644 --- a/AiPlatform/tests/Unit/V1/Client/FeatureRegistryServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/FeatureRegistryServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return FeatureRegistryServiceClient */ @@ -194,12 +196,15 @@ public function createFeatureExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); @@ -333,12 +338,15 @@ public function createFeatureGroupExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -400,9 +408,14 @@ public function deleteFeatureTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $request = (new DeleteFeatureRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]', + '[FEATURE]' + ); + $request = (new DeleteFeatureRequest())->setName($formattedName); $response = $gapicClient->deleteFeature($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -458,17 +471,25 @@ public function deleteFeatureExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $request = (new DeleteFeatureRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]', + '[FEATURE]' + ); + $request = (new DeleteFeatureRequest())->setName($formattedName); $response = $gapicClient->deleteFeature($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -522,8 +543,7 @@ public function deleteFeatureGroupTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - $request = (new DeleteFeatureGroupRequest()) - ->setName($formattedName); + $request = (new DeleteFeatureGroupRequest())->setName($formattedName); $response = $gapicClient->deleteFeatureGroup($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -579,17 +599,19 @@ public function deleteFeatureGroupExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - $request = (new DeleteFeatureGroupRequest()) - ->setName($formattedName); + $request = (new DeleteFeatureGroupRequest())->setName($formattedName); $response = $gapicClient->deleteFeatureGroup($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -636,9 +658,14 @@ public function getFeatureTest() $expectedResponse->setPointOfContact($pointOfContact); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $request = (new GetFeatureRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]', + '[FEATURE]' + ); + $request = (new GetFeatureRequest())->setName($formattedName); $response = $gapicClient->getFeature($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -662,17 +689,25 @@ public function getFeatureExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $request = (new GetFeatureRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]', + '[FEATURE]' + ); + $request = (new GetFeatureRequest())->setName($formattedName); try { $gapicClient->getFeature($request); // If the $gapicClient method call did not throw, fail the test @@ -705,8 +740,7 @@ public function getFeatureGroupTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - $request = (new GetFeatureGroupRequest()) - ->setName($formattedName); + $request = (new GetFeatureGroupRequest())->setName($formattedName); $response = $gapicClient->getFeatureGroup($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -730,17 +764,19 @@ public function getFeatureGroupExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - $request = (new GetFeatureGroupRequest()) - ->setName($formattedName); + $request = (new GetFeatureGroupRequest())->setName($formattedName); try { $gapicClient->getFeatureGroup($request); // If the $gapicClient method call did not throw, fail the test @@ -765,17 +801,14 @@ public function listFeatureGroupsTest() // Mock response $nextPageToken = ''; $featureGroupsElement = new FeatureGroup(); - $featureGroups = [ - $featureGroupsElement, - ]; + $featureGroups = [$featureGroupsElement]; $expectedResponse = new ListFeatureGroupsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setFeatureGroups($featureGroups); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListFeatureGroupsRequest()) - ->setParent($formattedParent); + $request = (new ListFeatureGroupsRequest())->setParent($formattedParent); $response = $gapicClient->listFeatureGroups($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -802,17 +835,19 @@ public function listFeatureGroupsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListFeatureGroupsRequest()) - ->setParent($formattedParent); + $request = (new ListFeatureGroupsRequest())->setParent($formattedParent); try { $gapicClient->listFeatureGroups($request); // If the $gapicClient method call did not throw, fail the test @@ -837,17 +872,14 @@ public function listFeaturesTest() // Mock response $nextPageToken = ''; $featuresElement = new Feature(); - $features = [ - $featuresElement, - ]; + $features = [$featuresElement]; $expectedResponse = new ListFeaturesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setFeatures($features); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new ListFeaturesRequest()) - ->setParent($formattedParent); + $request = (new ListFeaturesRequest())->setParent($formattedParent); $response = $gapicClient->listFeatures($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -874,17 +906,19 @@ public function listFeaturesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new ListFeaturesRequest()) - ->setParent($formattedParent); + $request = (new ListFeaturesRequest())->setParent($formattedParent); try { $gapicClient->listFeatures($request); // If the $gapicClient method call did not throw, fail the test @@ -941,8 +975,7 @@ public function updateFeatureTest() $operationsTransport->addResponse($completeOperation); // Mock request $feature = new Feature(); - $request = (new UpdateFeatureRequest()) - ->setFeature($feature); + $request = (new UpdateFeatureRequest())->setFeature($feature); $response = $gapicClient->updateFeature($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -998,17 +1031,19 @@ public function updateFeatureExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $feature = new Feature(); - $request = (new UpdateFeatureRequest()) - ->setFeature($feature); + $request = (new UpdateFeatureRequest())->setFeature($feature); $response = $gapicClient->updateFeature($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1068,8 +1103,7 @@ public function updateFeatureGroupTest() $operationsTransport->addResponse($completeOperation); // Mock request $featureGroup = new FeatureGroup(); - $request = (new UpdateFeatureGroupRequest()) - ->setFeatureGroup($featureGroup); + $request = (new UpdateFeatureGroupRequest())->setFeatureGroup($featureGroup); $response = $gapicClient->updateFeatureGroup($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1125,17 +1159,19 @@ public function updateFeatureGroupExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $featureGroup = new FeatureGroup(); - $request = (new UpdateFeatureGroupRequest()) - ->setFeatureGroup($featureGroup); + $request = (new UpdateFeatureGroupRequest())->setFeatureGroup($featureGroup); $response = $gapicClient->updateFeatureGroup($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1197,12 +1233,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1229,9 +1268,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1261,12 +1298,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1299,8 +1339,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1324,17 +1363,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1366,9 +1407,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1394,19 +1433,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1434,9 +1474,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1462,19 +1500,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test diff --git a/AiPlatform/tests/Unit/V1/Client/FeaturestoreOnlineServingServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/FeaturestoreOnlineServingServiceClientTest.php index e692463bd351..f2a4e7e404cf 100644 --- a/AiPlatform/tests/Unit/V1/Client/FeaturestoreOnlineServingServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/FeaturestoreOnlineServingServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return FeaturestoreOnlineServingServiceClient */ @@ -87,7 +89,12 @@ public function readFeatureValuesTest() $expectedResponse = new ReadFeatureValuesResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $entityId = 'entityId-740565257'; $featureSelector = new FeatureSelector(); $featureSelectorIdMatcher = new IdMatcher(); @@ -104,7 +111,10 @@ public function readFeatureValuesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/ReadFeatureValues', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/ReadFeatureValues', + $actualFuncCall + ); $actualValue = $actualRequestObject->getEntityType(); $this->assertProtobufEquals($formattedEntityType, $actualValue); $actualValue = $actualRequestObject->getEntityId(); @@ -125,15 +135,23 @@ public function readFeatureValuesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $entityId = 'entityId-740565257'; $featureSelector = new FeatureSelector(); $featureSelectorIdMatcher = new IdMatcher(); @@ -173,7 +191,12 @@ public function streamingReadFeatureValuesTest() $expectedResponse3 = new ReadFeatureValuesResponse(); $transport->addResponse($expectedResponse3); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $entityIds = []; $featureSelector = new FeatureSelector(); $featureSelectorIdMatcher = new IdMatcher(); @@ -196,7 +219,10 @@ public function streamingReadFeatureValuesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/StreamingReadFeatureValues', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/StreamingReadFeatureValues', + $actualFuncCall + ); $actualValue = $actualRequestObject->getEntityType(); $this->assertProtobufEquals($formattedEntityType, $actualValue); $actualValue = $actualRequestObject->getEntityIds(); @@ -216,16 +242,24 @@ public function streamingReadFeatureValuesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $entityIds = []; $featureSelector = new FeatureSelector(); $featureSelectorIdMatcher = new IdMatcher(); @@ -263,18 +297,24 @@ public function writeFeatureValuesTest() $expectedResponse = new WriteFeatureValuesResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $payloads = []; - $request = (new WriteFeatureValuesRequest()) - ->setEntityType($formattedEntityType) - ->setPayloads($payloads); + $request = (new WriteFeatureValuesRequest())->setEntityType($formattedEntityType)->setPayloads($payloads); $response = $gapicClient->writeFeatureValues($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/WriteFeatureValues', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/WriteFeatureValues', + $actualFuncCall + ); $actualValue = $actualRequestObject->getEntityType(); $this->assertProtobufEquals($formattedEntityType, $actualValue); $actualValue = $actualRequestObject->getPayloads(); @@ -293,19 +333,25 @@ public function writeFeatureValuesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $payloads = []; - $request = (new WriteFeatureValuesRequest()) - ->setEntityType($formattedEntityType) - ->setPayloads($payloads); + $request = (new WriteFeatureValuesRequest())->setEntityType($formattedEntityType)->setPayloads($payloads); try { $gapicClient->writeFeatureValues($request); // If the $gapicClient method call did not throw, fail the test @@ -358,12 +404,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -390,9 +439,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -422,12 +469,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -460,8 +510,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -485,17 +534,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -527,9 +578,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -555,19 +604,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -595,9 +645,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -623,19 +671,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -661,7 +710,12 @@ public function readFeatureValuesAsyncTest() $expectedResponse = new ReadFeatureValuesResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $entityId = 'entityId-740565257'; $featureSelector = new FeatureSelector(); $featureSelectorIdMatcher = new IdMatcher(); @@ -678,7 +732,10 @@ public function readFeatureValuesAsyncTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/ReadFeatureValues', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/ReadFeatureValues', + $actualFuncCall + ); $actualValue = $actualRequestObject->getEntityType(); $this->assertProtobufEquals($formattedEntityType, $actualValue); $actualValue = $actualRequestObject->getEntityId(); diff --git a/AiPlatform/tests/Unit/V1/Client/FeaturestoreServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/FeaturestoreServiceClientTest.php index 15c7ff76bc9f..fd2890037761 100644 --- a/AiPlatform/tests/Unit/V1/Client/FeaturestoreServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/FeaturestoreServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return FeaturestoreServiceClient */ @@ -140,9 +142,7 @@ public function batchCreateFeaturesTest() // Mock request $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); $requests = []; - $request = (new BatchCreateFeaturesRequest()) - ->setParent($formattedParent) - ->setRequests($requests); + $request = (new BatchCreateFeaturesRequest())->setParent($formattedParent)->setRequests($requests); $response = $gapicClient->batchCreateFeatures($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -200,19 +200,20 @@ public function batchCreateFeaturesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); $requests = []; - $request = (new BatchCreateFeaturesRequest()) - ->setParent($formattedParent) - ->setRequests($requests); + $request = (new BatchCreateFeaturesRequest())->setParent($formattedParent)->setRequests($requests); $response = $gapicClient->batchCreateFeatures($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -331,12 +332,15 @@ public function batchReadFeatureValuesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedFeaturestore = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); @@ -408,9 +412,7 @@ public function createEntityTypeTest() // Mock request $formattedParent = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); $entityTypeId = 'entityTypeId1181734884'; - $request = (new CreateEntityTypeRequest()) - ->setParent($formattedParent) - ->setEntityTypeId($entityTypeId); + $request = (new CreateEntityTypeRequest())->setParent($formattedParent)->setEntityTypeId($entityTypeId); $response = $gapicClient->createEntityType($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -468,19 +470,20 @@ public function createEntityTypeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); $entityTypeId = 'entityTypeId1181734884'; - $request = (new CreateEntityTypeRequest()) - ->setParent($formattedParent) - ->setEntityTypeId($entityTypeId); + $request = (new CreateEntityTypeRequest())->setParent($formattedParent)->setEntityTypeId($entityTypeId); $response = $gapicClient->createEntityType($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -611,12 +614,15 @@ public function createFeatureExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); @@ -750,12 +756,15 @@ public function createFeaturestoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -818,8 +827,7 @@ public function deleteEntityTypeTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new DeleteEntityTypeRequest()) - ->setName($formattedName); + $request = (new DeleteEntityTypeRequest())->setName($formattedName); $response = $gapicClient->deleteEntityType($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -875,17 +883,19 @@ public function deleteEntityTypeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new DeleteEntityTypeRequest()) - ->setName($formattedName); + $request = (new DeleteEntityTypeRequest())->setName($formattedName); $response = $gapicClient->deleteEntityType($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -938,9 +948,14 @@ public function deleteFeatureTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $request = (new DeleteFeatureRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]', + '[FEATURE]' + ); + $request = (new DeleteFeatureRequest())->setName($formattedName); $response = $gapicClient->deleteFeature($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -996,17 +1011,25 @@ public function deleteFeatureExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $request = (new DeleteFeatureRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]', + '[FEATURE]' + ); + $request = (new DeleteFeatureRequest())->setName($formattedName); $response = $gapicClient->deleteFeature($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1059,9 +1082,13 @@ public function deleteFeatureValuesTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new DeleteFeatureValuesRequest()) - ->setEntityType($formattedEntityType); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); + $request = (new DeleteFeatureValuesRequest())->setEntityType($formattedEntityType); $response = $gapicClient->deleteFeatureValues($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1117,17 +1144,24 @@ public function deleteFeatureValuesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new DeleteFeatureValuesRequest()) - ->setEntityType($formattedEntityType); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); + $request = (new DeleteFeatureValuesRequest())->setEntityType($formattedEntityType); $response = $gapicClient->deleteFeatureValues($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1181,8 +1215,7 @@ public function deleteFeaturestoreTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $request = (new DeleteFeaturestoreRequest()) - ->setName($formattedName); + $request = (new DeleteFeaturestoreRequest())->setName($formattedName); $response = $gapicClient->deleteFeaturestore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1238,17 +1271,19 @@ public function deleteFeaturestoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $request = (new DeleteFeaturestoreRequest()) - ->setName($formattedName); + $request = (new DeleteFeaturestoreRequest())->setName($formattedName); $response = $gapicClient->deleteFeaturestore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1301,7 +1336,12 @@ public function exportFeatureValuesTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $destination = new FeatureValueDestination(); $featureSelector = new FeatureSelector(); $featureSelectorIdMatcher = new IdMatcher(); @@ -1371,15 +1411,23 @@ public function exportFeatureValuesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $destination = new FeatureValueDestination(); $featureSelector = new FeatureSelector(); $featureSelectorIdMatcher = new IdMatcher(); @@ -1433,8 +1481,7 @@ public function getEntityTypeTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new GetEntityTypeRequest()) - ->setName($formattedName); + $request = (new GetEntityTypeRequest())->setName($formattedName); $response = $gapicClient->getEntityType($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1458,17 +1505,19 @@ public function getEntityTypeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new GetEntityTypeRequest()) - ->setName($formattedName); + $request = (new GetEntityTypeRequest())->setName($formattedName); try { $gapicClient->getEntityType($request); // If the $gapicClient method call did not throw, fail the test @@ -1506,9 +1555,14 @@ public function getFeatureTest() $expectedResponse->setPointOfContact($pointOfContact); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $request = (new GetFeatureRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]', + '[FEATURE]' + ); + $request = (new GetFeatureRequest())->setName($formattedName); $response = $gapicClient->getFeature($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1532,17 +1586,25 @@ public function getFeatureExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $request = (new GetFeatureRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->featureName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]', + '[FEATURE]' + ); + $request = (new GetFeatureRequest())->setName($formattedName); try { $gapicClient->getFeature($request); // If the $gapicClient method call did not throw, fail the test @@ -1575,8 +1637,7 @@ public function getFeaturestoreTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $request = (new GetFeaturestoreRequest()) - ->setName($formattedName); + $request = (new GetFeaturestoreRequest())->setName($formattedName); $response = $gapicClient->getFeaturestore($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1600,17 +1661,19 @@ public function getFeaturestoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $request = (new GetFeaturestoreRequest()) - ->setName($formattedName); + $request = (new GetFeaturestoreRequest())->setName($formattedName); try { $gapicClient->getFeaturestore($request); // If the $gapicClient method call did not throw, fail the test @@ -1662,7 +1725,12 @@ public function importFeatureValuesTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $featureSpecs = []; $request = (new ImportFeatureValuesRequest()) ->setEntityType($formattedEntityType) @@ -1724,15 +1792,23 @@ public function importFeatureValuesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); + $formattedEntityType = $gapicClient->entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[FEATURESTORE]', + '[ENTITY_TYPE]' + ); $featureSpecs = []; $request = (new ImportFeatureValuesRequest()) ->setEntityType($formattedEntityType) @@ -1770,17 +1846,14 @@ public function listEntityTypesTest() // Mock response $nextPageToken = ''; $entityTypesElement = new EntityType(); - $entityTypes = [ - $entityTypesElement, - ]; + $entityTypes = [$entityTypesElement]; $expectedResponse = new ListEntityTypesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setEntityTypes($entityTypes); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $request = (new ListEntityTypesRequest()) - ->setParent($formattedParent); + $request = (new ListEntityTypesRequest())->setParent($formattedParent); $response = $gapicClient->listEntityTypes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1807,17 +1880,19 @@ public function listEntityTypesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $request = (new ListEntityTypesRequest()) - ->setParent($formattedParent); + $request = (new ListEntityTypesRequest())->setParent($formattedParent); try { $gapicClient->listEntityTypes($request); // If the $gapicClient method call did not throw, fail the test @@ -1842,17 +1917,14 @@ public function listFeaturesTest() // Mock response $nextPageToken = ''; $featuresElement = new Feature(); - $features = [ - $featuresElement, - ]; + $features = [$featuresElement]; $expectedResponse = new ListFeaturesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setFeatures($features); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new ListFeaturesRequest()) - ->setParent($formattedParent); + $request = (new ListFeaturesRequest())->setParent($formattedParent); $response = $gapicClient->listFeatures($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1879,17 +1951,19 @@ public function listFeaturesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $request = (new ListFeaturesRequest()) - ->setParent($formattedParent); + $request = (new ListFeaturesRequest())->setParent($formattedParent); try { $gapicClient->listFeatures($request); // If the $gapicClient method call did not throw, fail the test @@ -1914,17 +1988,14 @@ public function listFeaturestoresTest() // Mock response $nextPageToken = ''; $featurestoresElement = new Featurestore(); - $featurestores = [ - $featurestoresElement, - ]; + $featurestores = [$featurestoresElement]; $expectedResponse = new ListFeaturestoresResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setFeaturestores($featurestores); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListFeaturestoresRequest()) - ->setParent($formattedParent); + $request = (new ListFeaturestoresRequest())->setParent($formattedParent); $response = $gapicClient->listFeaturestores($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1951,17 +2022,19 @@ public function listFeaturestoresExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListFeaturestoresRequest()) - ->setParent($formattedParent); + $request = (new ListFeaturestoresRequest())->setParent($formattedParent); try { $gapicClient->listFeaturestores($request); // If the $gapicClient method call did not throw, fail the test @@ -1986,17 +2059,14 @@ public function searchFeaturesTest() // Mock response $nextPageToken = ''; $featuresElement = new Feature(); - $features = [ - $featuresElement, - ]; + $features = [$featuresElement]; $expectedResponse = new SearchFeaturesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setFeatures($features); $transport->addResponse($expectedResponse); // Mock request $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new SearchFeaturesRequest()) - ->setLocation($formattedLocation); + $request = (new SearchFeaturesRequest())->setLocation($formattedLocation); $response = $gapicClient->searchFeatures($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2023,17 +2093,19 @@ public function searchFeaturesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new SearchFeaturesRequest()) - ->setLocation($formattedLocation); + $request = (new SearchFeaturesRequest())->setLocation($formattedLocation); try { $gapicClient->searchFeatures($request); // If the $gapicClient method call did not throw, fail the test @@ -2068,8 +2140,7 @@ public function updateEntityTypeTest() $transport->addResponse($expectedResponse); // Mock request $entityType = new EntityType(); - $request = (new UpdateEntityTypeRequest()) - ->setEntityType($entityType); + $request = (new UpdateEntityTypeRequest())->setEntityType($entityType); $response = $gapicClient->updateEntityType($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2093,17 +2164,19 @@ public function updateEntityTypeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $entityType = new EntityType(); - $request = (new UpdateEntityTypeRequest()) - ->setEntityType($entityType); + $request = (new UpdateEntityTypeRequest())->setEntityType($entityType); try { $gapicClient->updateEntityType($request); // If the $gapicClient method call did not throw, fail the test @@ -2142,8 +2215,7 @@ public function updateFeatureTest() $transport->addResponse($expectedResponse); // Mock request $feature = new Feature(); - $request = (new UpdateFeatureRequest()) - ->setFeature($feature); + $request = (new UpdateFeatureRequest())->setFeature($feature); $response = $gapicClient->updateFeature($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2167,17 +2239,19 @@ public function updateFeatureExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $feature = new Feature(); - $request = (new UpdateFeatureRequest()) - ->setFeature($feature); + $request = (new UpdateFeatureRequest())->setFeature($feature); try { $gapicClient->updateFeature($request); // If the $gapicClient method call did not throw, fail the test @@ -2228,8 +2302,7 @@ public function updateFeaturestoreTest() $operationsTransport->addResponse($completeOperation); // Mock request $featurestore = new Featurestore(); - $request = (new UpdateFeaturestoreRequest()) - ->setFeaturestore($featurestore); + $request = (new UpdateFeaturestoreRequest())->setFeaturestore($featurestore); $response = $gapicClient->updateFeaturestore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2285,17 +2358,19 @@ public function updateFeaturestoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $featurestore = new Featurestore(); - $request = (new UpdateFeaturestoreRequest()) - ->setFeaturestore($featurestore); + $request = (new UpdateFeaturestoreRequest())->setFeaturestore($featurestore); $response = $gapicClient->updateFeaturestore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2357,12 +2432,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -2389,9 +2467,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -2421,12 +2497,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -2459,8 +2538,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2484,17 +2562,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -2526,9 +2606,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2554,19 +2632,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -2594,9 +2673,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2622,19 +2699,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -2680,9 +2758,7 @@ public function batchCreateFeaturesAsyncTest() // Mock request $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); $requests = []; - $request = (new BatchCreateFeaturesRequest()) - ->setParent($formattedParent) - ->setRequests($requests); + $request = (new BatchCreateFeaturesRequest())->setParent($formattedParent)->setRequests($requests); $response = $gapicClient->batchCreateFeaturesAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/AiPlatform/tests/Unit/V1/Client/GenAiTuningServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/GenAiTuningServiceClientTest.php index ef3c0534fa23..172464f55bc5 100644 --- a/AiPlatform/tests/Unit/V1/Client/GenAiTuningServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/GenAiTuningServiceClientTest.php @@ -62,7 +62,9 @@ private function createTransport($deserialize = null) /** @return CredentialsWrapper */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return GenAiTuningServiceClient */ @@ -87,8 +89,7 @@ public function cancelTuningJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - $request = (new CancelTuningJobRequest()) - ->setName($formattedName); + $request = (new CancelTuningJobRequest())->setName($formattedName); $gapicClient->cancelTuningJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -111,17 +112,19 @@ public function cancelTuningJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - $request = (new CancelTuningJobRequest()) - ->setName($formattedName); + $request = (new CancelTuningJobRequest())->setName($formattedName); try { $gapicClient->cancelTuningJob($request); // If the $gapicClient method call did not throw, fail the test @@ -159,9 +162,7 @@ public function createTuningJobTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $tuningJob = new TuningJob(); - $request = (new CreateTuningJobRequest()) - ->setParent($formattedParent) - ->setTuningJob($tuningJob); + $request = (new CreateTuningJobRequest())->setParent($formattedParent)->setTuningJob($tuningJob); $response = $gapicClient->createTuningJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -187,19 +188,20 @@ public function createTuningJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $tuningJob = new TuningJob(); - $request = (new CreateTuningJobRequest()) - ->setParent($formattedParent) - ->setTuningJob($tuningJob); + $request = (new CreateTuningJobRequest())->setParent($formattedParent)->setTuningJob($tuningJob); try { $gapicClient->createTuningJob($request); // If the $gapicClient method call did not throw, fail the test @@ -236,8 +238,7 @@ public function getTuningJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - $request = (new GetTuningJobRequest()) - ->setName($formattedName); + $request = (new GetTuningJobRequest())->setName($formattedName); $response = $gapicClient->getTuningJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -261,17 +262,19 @@ public function getTuningJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - $request = (new GetTuningJobRequest()) - ->setName($formattedName); + $request = (new GetTuningJobRequest())->setName($formattedName); try { $gapicClient->getTuningJob($request); // If the $gapicClient method call did not throw, fail the test @@ -296,17 +299,14 @@ public function listTuningJobsTest() // Mock response $nextPageToken = ''; $tuningJobsElement = new TuningJob(); - $tuningJobs = [ - $tuningJobsElement, - ]; + $tuningJobs = [$tuningJobsElement]; $expectedResponse = new ListTuningJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTuningJobs($tuningJobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListTuningJobsRequest()) - ->setParent($formattedParent); + $request = (new ListTuningJobsRequest())->setParent($formattedParent); $response = $gapicClient->listTuningJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -333,17 +333,19 @@ public function listTuningJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListTuningJobsRequest()) - ->setParent($formattedParent); + $request = (new ListTuningJobsRequest())->setParent($formattedParent); try { $gapicClient->listTuningJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -396,12 +398,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -428,9 +433,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -460,12 +463,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -498,8 +504,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -523,17 +528,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -565,9 +572,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -593,19 +598,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -633,9 +639,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -661,19 +665,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -700,8 +705,7 @@ public function cancelTuningJobAsyncTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - $request = (new CancelTuningJobRequest()) - ->setName($formattedName); + $request = (new CancelTuningJobRequest())->setName($formattedName); $gapicClient->cancelTuningJobAsync($request)->wait(); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); diff --git a/AiPlatform/tests/Unit/V1/Client/IndexEndpointServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/IndexEndpointServiceClientTest.php index 3f7d2996bee2..f27a08ad11a7 100644 --- a/AiPlatform/tests/Unit/V1/Client/IndexEndpointServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/IndexEndpointServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return IndexEndpointServiceClient */ @@ -137,9 +139,7 @@ public function createIndexEndpointTest() $indexEndpoint = new IndexEndpoint(); $indexEndpointDisplayName = 'indexEndpointDisplayName-894895258'; $indexEndpoint->setDisplayName($indexEndpointDisplayName); - $request = (new CreateIndexEndpointRequest()) - ->setParent($formattedParent) - ->setIndexEndpoint($indexEndpoint); + $request = (new CreateIndexEndpointRequest())->setParent($formattedParent)->setIndexEndpoint($indexEndpoint); $response = $gapicClient->createIndexEndpoint($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -197,21 +197,22 @@ public function createIndexEndpointExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $indexEndpoint = new IndexEndpoint(); $indexEndpointDisplayName = 'indexEndpointDisplayName-894895258'; $indexEndpoint->setDisplayName($indexEndpointDisplayName); - $request = (new CreateIndexEndpointRequest()) - ->setParent($formattedParent) - ->setIndexEndpoint($indexEndpoint); + $request = (new CreateIndexEndpointRequest())->setParent($formattedParent)->setIndexEndpoint($indexEndpoint); $response = $gapicClient->createIndexEndpoint($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -265,8 +266,7 @@ public function deleteIndexEndpointTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $request = (new DeleteIndexEndpointRequest()) - ->setName($formattedName); + $request = (new DeleteIndexEndpointRequest())->setName($formattedName); $response = $gapicClient->deleteIndexEndpoint($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -322,17 +322,19 @@ public function deleteIndexEndpointExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $request = (new DeleteIndexEndpointRequest()) - ->setName($formattedName); + $request = (new DeleteIndexEndpointRequest())->setName($formattedName); $response = $gapicClient->deleteIndexEndpoint($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -451,12 +453,15 @@ public function deployIndexExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); @@ -519,8 +524,7 @@ public function getIndexEndpointTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $request = (new GetIndexEndpointRequest()) - ->setName($formattedName); + $request = (new GetIndexEndpointRequest())->setName($formattedName); $response = $gapicClient->getIndexEndpoint($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -544,17 +548,19 @@ public function getIndexEndpointExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $request = (new GetIndexEndpointRequest()) - ->setName($formattedName); + $request = (new GetIndexEndpointRequest())->setName($formattedName); try { $gapicClient->getIndexEndpoint($request); // If the $gapicClient method call did not throw, fail the test @@ -579,17 +585,14 @@ public function listIndexEndpointsTest() // Mock response $nextPageToken = ''; $indexEndpointsElement = new IndexEndpoint(); - $indexEndpoints = [ - $indexEndpointsElement, - ]; + $indexEndpoints = [$indexEndpointsElement]; $expectedResponse = new ListIndexEndpointsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setIndexEndpoints($indexEndpoints); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListIndexEndpointsRequest()) - ->setParent($formattedParent); + $request = (new ListIndexEndpointsRequest())->setParent($formattedParent); $response = $gapicClient->listIndexEndpoints($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -616,17 +619,19 @@ public function listIndexEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListIndexEndpointsRequest()) - ->setParent($formattedParent); + $request = (new ListIndexEndpointsRequest())->setParent($formattedParent); try { $gapicClient->listIndexEndpoints($request); // If the $gapicClient method call did not throw, fail the test @@ -736,12 +741,15 @@ public function mutateDeployedIndexExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); @@ -867,12 +875,15 @@ public function undeployIndexExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); @@ -934,9 +945,7 @@ public function updateIndexEndpointTest() $indexEndpointDisplayName = 'indexEndpointDisplayName-894895258'; $indexEndpoint->setDisplayName($indexEndpointDisplayName); $updateMask = new FieldMask(); - $request = (new UpdateIndexEndpointRequest()) - ->setIndexEndpoint($indexEndpoint) - ->setUpdateMask($updateMask); + $request = (new UpdateIndexEndpointRequest())->setIndexEndpoint($indexEndpoint)->setUpdateMask($updateMask); $response = $gapicClient->updateIndexEndpoint($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -962,21 +971,22 @@ public function updateIndexEndpointExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $indexEndpoint = new IndexEndpoint(); $indexEndpointDisplayName = 'indexEndpointDisplayName-894895258'; $indexEndpoint->setDisplayName($indexEndpointDisplayName); $updateMask = new FieldMask(); - $request = (new UpdateIndexEndpointRequest()) - ->setIndexEndpoint($indexEndpoint) - ->setUpdateMask($updateMask); + $request = (new UpdateIndexEndpointRequest())->setIndexEndpoint($indexEndpoint)->setUpdateMask($updateMask); try { $gapicClient->updateIndexEndpoint($request); // If the $gapicClient method call did not throw, fail the test @@ -1029,12 +1039,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1061,9 +1074,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1093,12 +1104,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1131,8 +1145,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1156,17 +1169,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1198,9 +1213,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1226,19 +1239,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1266,9 +1280,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1294,19 +1306,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1370,9 +1383,7 @@ public function createIndexEndpointAsyncTest() $indexEndpoint = new IndexEndpoint(); $indexEndpointDisplayName = 'indexEndpointDisplayName-894895258'; $indexEndpoint->setDisplayName($indexEndpointDisplayName); - $request = (new CreateIndexEndpointRequest()) - ->setParent($formattedParent) - ->setIndexEndpoint($indexEndpoint); + $request = (new CreateIndexEndpointRequest())->setParent($formattedParent)->setIndexEndpoint($indexEndpoint); $response = $gapicClient->createIndexEndpointAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/AiPlatform/tests/Unit/V1/Client/IndexServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/IndexServiceClientTest.php index b04bc31eba84..78e2cc63b21b 100644 --- a/AiPlatform/tests/Unit/V1/Client/IndexServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/IndexServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return IndexServiceClient */ @@ -127,9 +129,7 @@ public function createIndexTest() $index = new Index(); $indexDisplayName = 'indexDisplayName-632619461'; $index->setDisplayName($indexDisplayName); - $request = (new CreateIndexRequest()) - ->setParent($formattedParent) - ->setIndex($index); + $request = (new CreateIndexRequest())->setParent($formattedParent)->setIndex($index); $response = $gapicClient->createIndex($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -187,21 +187,22 @@ public function createIndexExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $index = new Index(); $indexDisplayName = 'indexDisplayName-632619461'; $index->setDisplayName($indexDisplayName); - $request = (new CreateIndexRequest()) - ->setParent($formattedParent) - ->setIndex($index); + $request = (new CreateIndexRequest())->setParent($formattedParent)->setIndex($index); $response = $gapicClient->createIndex($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -255,8 +256,7 @@ public function deleteIndexTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $request = (new DeleteIndexRequest()) - ->setName($formattedName); + $request = (new DeleteIndexRequest())->setName($formattedName); $response = $gapicClient->deleteIndex($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -312,17 +312,19 @@ public function deleteIndexExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $request = (new DeleteIndexRequest()) - ->setName($formattedName); + $request = (new DeleteIndexRequest())->setName($formattedName); $response = $gapicClient->deleteIndex($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -368,8 +370,7 @@ public function getIndexTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $request = (new GetIndexRequest()) - ->setName($formattedName); + $request = (new GetIndexRequest())->setName($formattedName); $response = $gapicClient->getIndex($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -393,17 +394,19 @@ public function getIndexExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $request = (new GetIndexRequest()) - ->setName($formattedName); + $request = (new GetIndexRequest())->setName($formattedName); try { $gapicClient->getIndex($request); // If the $gapicClient method call did not throw, fail the test @@ -428,17 +431,14 @@ public function listIndexesTest() // Mock response $nextPageToken = ''; $indexesElement = new Index(); - $indexes = [ - $indexesElement, - ]; + $indexes = [$indexesElement]; $expectedResponse = new ListIndexesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setIndexes($indexes); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListIndexesRequest()) - ->setParent($formattedParent); + $request = (new ListIndexesRequest())->setParent($formattedParent); $response = $gapicClient->listIndexes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -465,17 +465,19 @@ public function listIndexesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListIndexesRequest()) - ->setParent($formattedParent); + $request = (new ListIndexesRequest())->setParent($formattedParent); try { $gapicClient->listIndexes($request); // If the $gapicClient method call did not throw, fail the test @@ -502,8 +504,7 @@ public function removeDatapointsTest() $transport->addResponse($expectedResponse); // Mock request $formattedIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $request = (new RemoveDatapointsRequest()) - ->setIndex($formattedIndex); + $request = (new RemoveDatapointsRequest())->setIndex($formattedIndex); $response = $gapicClient->removeDatapoints($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -527,17 +528,19 @@ public function removeDatapointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $request = (new RemoveDatapointsRequest()) - ->setIndex($formattedIndex); + $request = (new RemoveDatapointsRequest())->setIndex($formattedIndex); try { $gapicClient->removeDatapoints($request); // If the $gapicClient method call did not throw, fail the test @@ -594,8 +597,7 @@ public function updateIndexTest() $index = new Index(); $indexDisplayName = 'indexDisplayName-632619461'; $index->setDisplayName($indexDisplayName); - $request = (new UpdateIndexRequest()) - ->setIndex($index); + $request = (new UpdateIndexRequest())->setIndex($index); $response = $gapicClient->updateIndex($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -651,19 +653,21 @@ public function updateIndexExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $index = new Index(); $indexDisplayName = 'indexDisplayName-632619461'; $index->setDisplayName($indexDisplayName); - $request = (new UpdateIndexRequest()) - ->setIndex($index); + $request = (new UpdateIndexRequest())->setIndex($index); $response = $gapicClient->updateIndex($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -699,8 +703,7 @@ public function upsertDatapointsTest() $transport->addResponse($expectedResponse); // Mock request $formattedIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $request = (new UpsertDatapointsRequest()) - ->setIndex($formattedIndex); + $request = (new UpsertDatapointsRequest())->setIndex($formattedIndex); $response = $gapicClient->upsertDatapoints($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -724,17 +727,19 @@ public function upsertDatapointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $request = (new UpsertDatapointsRequest()) - ->setIndex($formattedIndex); + $request = (new UpsertDatapointsRequest())->setIndex($formattedIndex); try { $gapicClient->upsertDatapoints($request); // If the $gapicClient method call did not throw, fail the test @@ -787,12 +792,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -819,9 +827,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -851,12 +857,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -889,8 +898,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -914,17 +922,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -956,9 +966,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -984,19 +992,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1024,9 +1033,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1052,19 +1059,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1122,9 +1130,7 @@ public function createIndexAsyncTest() $index = new Index(); $indexDisplayName = 'indexDisplayName-632619461'; $index->setDisplayName($indexDisplayName); - $request = (new CreateIndexRequest()) - ->setParent($formattedParent) - ->setIndex($index); + $request = (new CreateIndexRequest())->setParent($formattedParent)->setIndex($index); $response = $gapicClient->createIndexAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/AiPlatform/tests/Unit/V1/Client/JobServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/JobServiceClientTest.php index 5456bd0ce888..4a3fdcd081c2 100644 --- a/AiPlatform/tests/Unit/V1/Client/JobServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/JobServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return JobServiceClient */ @@ -146,8 +148,7 @@ public function cancelBatchPredictionJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $request = (new CancelBatchPredictionJobRequest()) - ->setName($formattedName); + $request = (new CancelBatchPredictionJobRequest())->setName($formattedName); $gapicClient->cancelBatchPredictionJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -170,17 +171,19 @@ public function cancelBatchPredictionJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $request = (new CancelBatchPredictionJobRequest()) - ->setName($formattedName); + $request = (new CancelBatchPredictionJobRequest())->setName($formattedName); try { $gapicClient->cancelBatchPredictionJob($request); // If the $gapicClient method call did not throw, fail the test @@ -207,8 +210,7 @@ public function cancelCustomJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $request = (new CancelCustomJobRequest()) - ->setName($formattedName); + $request = (new CancelCustomJobRequest())->setName($formattedName); $gapicClient->cancelCustomJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -231,17 +233,19 @@ public function cancelCustomJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $request = (new CancelCustomJobRequest()) - ->setName($formattedName); + $request = (new CancelCustomJobRequest())->setName($formattedName); try { $gapicClient->cancelCustomJob($request); // If the $gapicClient method call did not throw, fail the test @@ -268,8 +272,7 @@ public function cancelDataLabelingJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $request = (new CancelDataLabelingJobRequest()) - ->setName($formattedName); + $request = (new CancelDataLabelingJobRequest())->setName($formattedName); $gapicClient->cancelDataLabelingJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -292,17 +295,19 @@ public function cancelDataLabelingJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $request = (new CancelDataLabelingJobRequest()) - ->setName($formattedName); + $request = (new CancelDataLabelingJobRequest())->setName($formattedName); try { $gapicClient->cancelDataLabelingJob($request); // If the $gapicClient method call did not throw, fail the test @@ -328,9 +333,12 @@ public function cancelHyperparameterTuningJobTest() $expectedResponse = new GPBEmpty(); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $request = (new CancelHyperparameterTuningJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->hyperparameterTuningJobName( + '[PROJECT]', + '[LOCATION]', + '[HYPERPARAMETER_TUNING_JOB]' + ); + $request = (new CancelHyperparameterTuningJobRequest())->setName($formattedName); $gapicClient->cancelHyperparameterTuningJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -353,17 +361,23 @@ public function cancelHyperparameterTuningJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $request = (new CancelHyperparameterTuningJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->hyperparameterTuningJobName( + '[PROJECT]', + '[LOCATION]', + '[HYPERPARAMETER_TUNING_JOB]' + ); + $request = (new CancelHyperparameterTuningJobRequest())->setName($formattedName); try { $gapicClient->cancelHyperparameterTuningJob($request); // If the $gapicClient method call did not throw, fail the test @@ -390,8 +404,7 @@ public function cancelNasJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $request = (new CancelNasJobRequest()) - ->setName($formattedName); + $request = (new CancelNasJobRequest())->setName($formattedName); $gapicClient->cancelNasJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -414,17 +427,19 @@ public function cancelNasJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $request = (new CancelNasJobRequest()) - ->setName($formattedName); + $request = (new CancelNasJobRequest())->setName($formattedName); try { $gapicClient->cancelNasJob($request); // If the $gapicClient method call did not throw, fail the test @@ -504,12 +519,15 @@ public function createBatchPredictionJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -564,9 +582,7 @@ public function createCustomJobTest() $jobSpecWorkerPoolSpecs = []; $customJobJobSpec->setWorkerPoolSpecs($jobSpecWorkerPoolSpecs); $customJob->setJobSpec($customJobJobSpec); - $request = (new CreateCustomJobRequest()) - ->setParent($formattedParent) - ->setCustomJob($customJob); + $request = (new CreateCustomJobRequest())->setParent($formattedParent)->setCustomJob($customJob); $response = $gapicClient->createCustomJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -592,12 +608,15 @@ public function createCustomJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -608,9 +627,7 @@ public function createCustomJobExceptionTest() $jobSpecWorkerPoolSpecs = []; $customJobJobSpec->setWorkerPoolSpecs($jobSpecWorkerPoolSpecs); $customJob->setJobSpec($customJobJobSpec); - $request = (new CreateCustomJobRequest()) - ->setParent($formattedParent) - ->setCustomJob($customJob); + $request = (new CreateCustomJobRequest())->setParent($formattedParent)->setCustomJob($customJob); try { $gapicClient->createCustomJob($request); // If the $gapicClient method call did not throw, fail the test @@ -652,9 +669,7 @@ public function createDataLabelingJobTest() $dataLabelingJob = new DataLabelingJob(); $dataLabelingJobDisplayName = 'dataLabelingJobDisplayName708178632'; $dataLabelingJob->setDisplayName($dataLabelingJobDisplayName); - $dataLabelingJobDatasets = [ - $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'), - ]; + $dataLabelingJobDatasets = [$gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]')]; $dataLabelingJob->setDatasets($dataLabelingJobDatasets); $dataLabelingJobLabelerCount = 500093453; $dataLabelingJob->setLabelerCount($dataLabelingJobLabelerCount); @@ -692,21 +707,22 @@ public function createDataLabelingJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $dataLabelingJob = new DataLabelingJob(); $dataLabelingJobDisplayName = 'dataLabelingJobDisplayName708178632'; $dataLabelingJob->setDisplayName($dataLabelingJobDisplayName); - $dataLabelingJobDatasets = [ - $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'), - ]; + $dataLabelingJobDatasets = [$gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]')]; $dataLabelingJob->setDatasets($dataLabelingJobDatasets); $dataLabelingJobLabelerCount = 500093453; $dataLabelingJob->setLabelerCount($dataLabelingJobLabelerCount); @@ -800,12 +816,15 @@ public function createHyperparameterTuningJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -873,11 +892,17 @@ public function createModelDeploymentMonitoringJobTest() $modelDeploymentMonitoringJobEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $modelDeploymentMonitoringJob->setEndpoint($modelDeploymentMonitoringJobEndpoint); $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = []; - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs($modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs); + $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs( + $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs + ); $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = new ModelDeploymentMonitoringScheduleConfig(); $modelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration(); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval($modelDeploymentMonitoringScheduleConfigMonitorInterval); - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig($modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig); + $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval( + $modelDeploymentMonitoringScheduleConfigMonitorInterval + ); + $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig( + $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig + ); $modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy(); $modelDeploymentMonitoringJob->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy); $request = (new CreateModelDeploymentMonitoringJobRequest()) @@ -908,12 +933,15 @@ public function createModelDeploymentMonitoringJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -923,11 +951,17 @@ public function createModelDeploymentMonitoringJobExceptionTest() $modelDeploymentMonitoringJobEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $modelDeploymentMonitoringJob->setEndpoint($modelDeploymentMonitoringJobEndpoint); $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = []; - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs($modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs); + $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs( + $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs + ); $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = new ModelDeploymentMonitoringScheduleConfig(); $modelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration(); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval($modelDeploymentMonitoringScheduleConfigMonitorInterval); - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig($modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig); + $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval( + $modelDeploymentMonitoringScheduleConfigMonitorInterval + ); + $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig( + $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig + ); $modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy(); $modelDeploymentMonitoringJob->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy); $request = (new CreateModelDeploymentMonitoringJobRequest()) @@ -970,9 +1004,7 @@ public function createNasJobTest() $nasJob->setDisplayName($nasJobDisplayName); $nasJobNasJobSpec = new NasJobSpec(); $nasJob->setNasJobSpec($nasJobNasJobSpec); - $request = (new CreateNasJobRequest()) - ->setParent($formattedParent) - ->setNasJob($nasJob); + $request = (new CreateNasJobRequest())->setParent($formattedParent)->setNasJob($nasJob); $response = $gapicClient->createNasJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -998,12 +1030,15 @@ public function createNasJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -1012,9 +1047,7 @@ public function createNasJobExceptionTest() $nasJob->setDisplayName($nasJobDisplayName); $nasJobNasJobSpec = new NasJobSpec(); $nasJob->setNasJobSpec($nasJobNasJobSpec); - $request = (new CreateNasJobRequest()) - ->setParent($formattedParent) - ->setNasJob($nasJob); + $request = (new CreateNasJobRequest())->setParent($formattedParent)->setNasJob($nasJob); try { $gapicClient->createNasJob($request); // If the $gapicClient method call did not throw, fail the test @@ -1059,8 +1092,7 @@ public function deleteBatchPredictionJobTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $request = (new DeleteBatchPredictionJobRequest()) - ->setName($formattedName); + $request = (new DeleteBatchPredictionJobRequest())->setName($formattedName); $response = $gapicClient->deleteBatchPredictionJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1116,17 +1148,19 @@ public function deleteBatchPredictionJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $request = (new DeleteBatchPredictionJobRequest()) - ->setName($formattedName); + $request = (new DeleteBatchPredictionJobRequest())->setName($formattedName); $response = $gapicClient->deleteBatchPredictionJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1180,8 +1214,7 @@ public function deleteCustomJobTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $request = (new DeleteCustomJobRequest()) - ->setName($formattedName); + $request = (new DeleteCustomJobRequest())->setName($formattedName); $response = $gapicClient->deleteCustomJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1237,17 +1270,19 @@ public function deleteCustomJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $request = (new DeleteCustomJobRequest()) - ->setName($formattedName); + $request = (new DeleteCustomJobRequest())->setName($formattedName); $response = $gapicClient->deleteCustomJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1301,8 +1336,7 @@ public function deleteDataLabelingJobTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $request = (new DeleteDataLabelingJobRequest()) - ->setName($formattedName); + $request = (new DeleteDataLabelingJobRequest())->setName($formattedName); $response = $gapicClient->deleteDataLabelingJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1358,17 +1392,19 @@ public function deleteDataLabelingJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $request = (new DeleteDataLabelingJobRequest()) - ->setName($formattedName); + $request = (new DeleteDataLabelingJobRequest())->setName($formattedName); $response = $gapicClient->deleteDataLabelingJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1421,9 +1457,12 @@ public function deleteHyperparameterTuningJobTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $request = (new DeleteHyperparameterTuningJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->hyperparameterTuningJobName( + '[PROJECT]', + '[LOCATION]', + '[HYPERPARAMETER_TUNING_JOB]' + ); + $request = (new DeleteHyperparameterTuningJobRequest())->setName($formattedName); $response = $gapicClient->deleteHyperparameterTuningJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1479,17 +1518,23 @@ public function deleteHyperparameterTuningJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $request = (new DeleteHyperparameterTuningJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->hyperparameterTuningJobName( + '[PROJECT]', + '[LOCATION]', + '[HYPERPARAMETER_TUNING_JOB]' + ); + $request = (new DeleteHyperparameterTuningJobRequest())->setName($formattedName); $response = $gapicClient->deleteHyperparameterTuningJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1542,9 +1587,12 @@ public function deleteModelDeploymentMonitoringJobTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $request = (new DeleteModelDeploymentMonitoringJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); + $request = (new DeleteModelDeploymentMonitoringJobRequest())->setName($formattedName); $response = $gapicClient->deleteModelDeploymentMonitoringJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1554,7 +1602,10 @@ public function deleteModelDeploymentMonitoringJobTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/DeleteModelDeploymentMonitoringJob', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.JobService/DeleteModelDeploymentMonitoringJob', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -1600,17 +1651,23 @@ public function deleteModelDeploymentMonitoringJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $request = (new DeleteModelDeploymentMonitoringJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); + $request = (new DeleteModelDeploymentMonitoringJobRequest())->setName($formattedName); $response = $gapicClient->deleteModelDeploymentMonitoringJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1664,8 +1721,7 @@ public function deleteNasJobTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $request = (new DeleteNasJobRequest()) - ->setName($formattedName); + $request = (new DeleteNasJobRequest())->setName($formattedName); $response = $gapicClient->deleteNasJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1721,17 +1777,19 @@ public function deleteNasJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $request = (new DeleteNasJobRequest()) - ->setName($formattedName); + $request = (new DeleteNasJobRequest())->setName($formattedName); $response = $gapicClient->deleteNasJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1781,8 +1839,7 @@ public function getBatchPredictionJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $request = (new GetBatchPredictionJobRequest()) - ->setName($formattedName); + $request = (new GetBatchPredictionJobRequest())->setName($formattedName); $response = $gapicClient->getBatchPredictionJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1806,17 +1863,19 @@ public function getBatchPredictionJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $request = (new GetBatchPredictionJobRequest()) - ->setName($formattedName); + $request = (new GetBatchPredictionJobRequest())->setName($formattedName); try { $gapicClient->getBatchPredictionJob($request); // If the $gapicClient method call did not throw, fail the test @@ -1847,8 +1906,7 @@ public function getCustomJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $request = (new GetCustomJobRequest()) - ->setName($formattedName); + $request = (new GetCustomJobRequest())->setName($formattedName); $response = $gapicClient->getCustomJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1872,17 +1930,19 @@ public function getCustomJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $request = (new GetCustomJobRequest()) - ->setName($formattedName); + $request = (new GetCustomJobRequest())->setName($formattedName); try { $gapicClient->getCustomJob($request); // If the $gapicClient method call did not throw, fail the test @@ -1921,8 +1981,7 @@ public function getDataLabelingJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $request = (new GetDataLabelingJobRequest()) - ->setName($formattedName); + $request = (new GetDataLabelingJobRequest())->setName($formattedName); $response = $gapicClient->getDataLabelingJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1946,17 +2005,19 @@ public function getDataLabelingJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $request = (new GetDataLabelingJobRequest()) - ->setName($formattedName); + $request = (new GetDataLabelingJobRequest())->setName($formattedName); try { $gapicClient->getDataLabelingJob($request); // If the $gapicClient method call did not throw, fail the test @@ -1992,9 +2053,12 @@ public function getHyperparameterTuningJobTest() $expectedResponse->setMaxFailedTrialCount($maxFailedTrialCount); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $request = (new GetHyperparameterTuningJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->hyperparameterTuningJobName( + '[PROJECT]', + '[LOCATION]', + '[HYPERPARAMETER_TUNING_JOB]' + ); + $request = (new GetHyperparameterTuningJobRequest())->setName($formattedName); $response = $gapicClient->getHyperparameterTuningJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2018,17 +2082,23 @@ public function getHyperparameterTuningJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $request = (new GetHyperparameterTuningJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->hyperparameterTuningJobName( + '[PROJECT]', + '[LOCATION]', + '[HYPERPARAMETER_TUNING_JOB]' + ); + $request = (new GetHyperparameterTuningJobRequest())->setName($formattedName); try { $gapicClient->getHyperparameterTuningJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2066,9 +2136,12 @@ public function getModelDeploymentMonitoringJobTest() $expectedResponse->setEnableMonitoringPipelineLogs($enableMonitoringPipelineLogs); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $request = (new GetModelDeploymentMonitoringJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); + $request = (new GetModelDeploymentMonitoringJobRequest())->setName($formattedName); $response = $gapicClient->getModelDeploymentMonitoringJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2092,17 +2165,23 @@ public function getModelDeploymentMonitoringJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $request = (new GetModelDeploymentMonitoringJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); + $request = (new GetModelDeploymentMonitoringJobRequest())->setName($formattedName); try { $gapicClient->getModelDeploymentMonitoringJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2135,8 +2214,7 @@ public function getNasJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $request = (new GetNasJobRequest()) - ->setName($formattedName); + $request = (new GetNasJobRequest())->setName($formattedName); $response = $gapicClient->getNasJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2160,17 +2238,19 @@ public function getNasJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $request = (new GetNasJobRequest()) - ->setName($formattedName); + $request = (new GetNasJobRequest())->setName($formattedName); try { $gapicClient->getNasJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2201,8 +2281,7 @@ public function getNasTrialDetailTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->nasTrialDetailName('[PROJECT]', '[LOCATION]', '[NAS_JOB]', '[NAS_TRIAL_DETAIL]'); - $request = (new GetNasTrialDetailRequest()) - ->setName($formattedName); + $request = (new GetNasTrialDetailRequest())->setName($formattedName); $response = $gapicClient->getNasTrialDetail($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2226,17 +2305,19 @@ public function getNasTrialDetailExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->nasTrialDetailName('[PROJECT]', '[LOCATION]', '[NAS_JOB]', '[NAS_TRIAL_DETAIL]'); - $request = (new GetNasTrialDetailRequest()) - ->setName($formattedName); + $request = (new GetNasTrialDetailRequest())->setName($formattedName); try { $gapicClient->getNasTrialDetail($request); // If the $gapicClient method call did not throw, fail the test @@ -2261,17 +2342,14 @@ public function listBatchPredictionJobsTest() // Mock response $nextPageToken = ''; $batchPredictionJobsElement = new BatchPredictionJob(); - $batchPredictionJobs = [ - $batchPredictionJobsElement, - ]; + $batchPredictionJobs = [$batchPredictionJobsElement]; $expectedResponse = new ListBatchPredictionJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setBatchPredictionJobs($batchPredictionJobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListBatchPredictionJobsRequest()) - ->setParent($formattedParent); + $request = (new ListBatchPredictionJobsRequest())->setParent($formattedParent); $response = $gapicClient->listBatchPredictionJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2298,17 +2376,19 @@ public function listBatchPredictionJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListBatchPredictionJobsRequest()) - ->setParent($formattedParent); + $request = (new ListBatchPredictionJobsRequest())->setParent($formattedParent); try { $gapicClient->listBatchPredictionJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -2333,17 +2413,14 @@ public function listCustomJobsTest() // Mock response $nextPageToken = ''; $customJobsElement = new CustomJob(); - $customJobs = [ - $customJobsElement, - ]; + $customJobs = [$customJobsElement]; $expectedResponse = new ListCustomJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setCustomJobs($customJobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListCustomJobsRequest()) - ->setParent($formattedParent); + $request = (new ListCustomJobsRequest())->setParent($formattedParent); $response = $gapicClient->listCustomJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2370,17 +2447,19 @@ public function listCustomJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListCustomJobsRequest()) - ->setParent($formattedParent); + $request = (new ListCustomJobsRequest())->setParent($formattedParent); try { $gapicClient->listCustomJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -2405,17 +2484,14 @@ public function listDataLabelingJobsTest() // Mock response $nextPageToken = ''; $dataLabelingJobsElement = new DataLabelingJob(); - $dataLabelingJobs = [ - $dataLabelingJobsElement, - ]; + $dataLabelingJobs = [$dataLabelingJobsElement]; $expectedResponse = new ListDataLabelingJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDataLabelingJobs($dataLabelingJobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListDataLabelingJobsRequest()) - ->setParent($formattedParent); + $request = (new ListDataLabelingJobsRequest())->setParent($formattedParent); $response = $gapicClient->listDataLabelingJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2442,17 +2518,19 @@ public function listDataLabelingJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListDataLabelingJobsRequest()) - ->setParent($formattedParent); + $request = (new ListDataLabelingJobsRequest())->setParent($formattedParent); try { $gapicClient->listDataLabelingJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -2477,17 +2555,14 @@ public function listHyperparameterTuningJobsTest() // Mock response $nextPageToken = ''; $hyperparameterTuningJobsElement = new HyperparameterTuningJob(); - $hyperparameterTuningJobs = [ - $hyperparameterTuningJobsElement, - ]; + $hyperparameterTuningJobs = [$hyperparameterTuningJobsElement]; $expectedResponse = new ListHyperparameterTuningJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setHyperparameterTuningJobs($hyperparameterTuningJobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListHyperparameterTuningJobsRequest()) - ->setParent($formattedParent); + $request = (new ListHyperparameterTuningJobsRequest())->setParent($formattedParent); $response = $gapicClient->listHyperparameterTuningJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2514,17 +2589,19 @@ public function listHyperparameterTuningJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListHyperparameterTuningJobsRequest()) - ->setParent($formattedParent); + $request = (new ListHyperparameterTuningJobsRequest())->setParent($formattedParent); try { $gapicClient->listHyperparameterTuningJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -2549,17 +2626,14 @@ public function listModelDeploymentMonitoringJobsTest() // Mock response $nextPageToken = ''; $modelDeploymentMonitoringJobsElement = new ModelDeploymentMonitoringJob(); - $modelDeploymentMonitoringJobs = [ - $modelDeploymentMonitoringJobsElement, - ]; + $modelDeploymentMonitoringJobs = [$modelDeploymentMonitoringJobsElement]; $expectedResponse = new ListModelDeploymentMonitoringJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setModelDeploymentMonitoringJobs($modelDeploymentMonitoringJobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListModelDeploymentMonitoringJobsRequest()) - ->setParent($formattedParent); + $request = (new ListModelDeploymentMonitoringJobsRequest())->setParent($formattedParent); $response = $gapicClient->listModelDeploymentMonitoringJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2586,17 +2660,19 @@ public function listModelDeploymentMonitoringJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListModelDeploymentMonitoringJobsRequest()) - ->setParent($formattedParent); + $request = (new ListModelDeploymentMonitoringJobsRequest())->setParent($formattedParent); try { $gapicClient->listModelDeploymentMonitoringJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -2621,17 +2697,14 @@ public function listNasJobsTest() // Mock response $nextPageToken = ''; $nasJobsElement = new NasJob(); - $nasJobs = [ - $nasJobsElement, - ]; + $nasJobs = [$nasJobsElement]; $expectedResponse = new ListNasJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setNasJobs($nasJobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNasJobsRequest()) - ->setParent($formattedParent); + $request = (new ListNasJobsRequest())->setParent($formattedParent); $response = $gapicClient->listNasJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2658,17 +2731,19 @@ public function listNasJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNasJobsRequest()) - ->setParent($formattedParent); + $request = (new ListNasJobsRequest())->setParent($formattedParent); try { $gapicClient->listNasJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -2693,17 +2768,14 @@ public function listNasTrialDetailsTest() // Mock response $nextPageToken = ''; $nasTrialDetailsElement = new NasTrialDetail(); - $nasTrialDetails = [ - $nasTrialDetailsElement, - ]; + $nasTrialDetails = [$nasTrialDetailsElement]; $expectedResponse = new ListNasTrialDetailsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setNasTrialDetails($nasTrialDetails); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $request = (new ListNasTrialDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListNasTrialDetailsRequest())->setParent($formattedParent); $response = $gapicClient->listNasTrialDetails($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2730,17 +2802,19 @@ public function listNasTrialDetailsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $request = (new ListNasTrialDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListNasTrialDetailsRequest())->setParent($formattedParent); try { $gapicClient->listNasTrialDetails($request); // If the $gapicClient method call did not throw, fail the test @@ -2766,9 +2840,12 @@ public function pauseModelDeploymentMonitoringJobTest() $expectedResponse = new GPBEmpty(); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $request = (new PauseModelDeploymentMonitoringJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); + $request = (new PauseModelDeploymentMonitoringJobRequest())->setName($formattedName); $gapicClient->pauseModelDeploymentMonitoringJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -2791,17 +2868,23 @@ public function pauseModelDeploymentMonitoringJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $request = (new PauseModelDeploymentMonitoringJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); + $request = (new PauseModelDeploymentMonitoringJobRequest())->setName($formattedName); try { $gapicClient->pauseModelDeploymentMonitoringJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2827,9 +2910,12 @@ public function resumeModelDeploymentMonitoringJobTest() $expectedResponse = new GPBEmpty(); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $request = (new ResumeModelDeploymentMonitoringJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); + $request = (new ResumeModelDeploymentMonitoringJobRequest())->setName($formattedName); $gapicClient->resumeModelDeploymentMonitoringJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -2852,17 +2938,23 @@ public function resumeModelDeploymentMonitoringJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $request = (new ResumeModelDeploymentMonitoringJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); + $request = (new ResumeModelDeploymentMonitoringJobRequest())->setName($formattedName); try { $gapicClient->resumeModelDeploymentMonitoringJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2887,15 +2979,17 @@ public function searchModelDeploymentMonitoringStatsAnomaliesTest() // Mock response $nextPageToken = ''; $monitoringStatsElement = new ModelMonitoringStatsAnomalies(); - $monitoringStats = [ - $monitoringStatsElement, - ]; + $monitoringStats = [$monitoringStatsElement]; $expectedResponse = new SearchModelDeploymentMonitoringStatsAnomaliesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setMonitoringStats($monitoringStats); $transport->addResponse($expectedResponse); // Mock request - $formattedModelDeploymentMonitoringJob = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); + $formattedModelDeploymentMonitoringJob = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); $deployedModelId = 'deployedModelId866642506'; $objectives = []; $request = (new SearchModelDeploymentMonitoringStatsAnomaliesRequest()) @@ -2911,7 +3005,10 @@ public function searchModelDeploymentMonitoringStatsAnomaliesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/SearchModelDeploymentMonitoringStatsAnomalies', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.JobService/SearchModelDeploymentMonitoringStatsAnomalies', + $actualFuncCall + ); $actualValue = $actualRequestObject->getModelDeploymentMonitoringJob(); $this->assertProtobufEquals($formattedModelDeploymentMonitoringJob, $actualValue); $actualValue = $actualRequestObject->getDeployedModelId(); @@ -2932,15 +3029,22 @@ public function searchModelDeploymentMonitoringStatsAnomaliesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedModelDeploymentMonitoringJob = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); + $formattedModelDeploymentMonitoringJob = $gapicClient->modelDeploymentMonitoringJobName( + '[PROJECT]', + '[LOCATION]', + '[MODEL_DEPLOYMENT_MONITORING_JOB]' + ); $deployedModelId = 'deployedModelId866642506'; $objectives = []; $request = (new SearchModelDeploymentMonitoringStatsAnomaliesRequest()) @@ -3008,11 +3112,17 @@ public function updateModelDeploymentMonitoringJobTest() $modelDeploymentMonitoringJobEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $modelDeploymentMonitoringJob->setEndpoint($modelDeploymentMonitoringJobEndpoint); $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = []; - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs($modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs); + $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs( + $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs + ); $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = new ModelDeploymentMonitoringScheduleConfig(); $modelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration(); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval($modelDeploymentMonitoringScheduleConfigMonitorInterval); - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig($modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig); + $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval( + $modelDeploymentMonitoringScheduleConfigMonitorInterval + ); + $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig( + $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig + ); $modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy(); $modelDeploymentMonitoringJob->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy); $updateMask = new FieldMask(); @@ -3028,7 +3138,10 @@ public function updateModelDeploymentMonitoringJobTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/UpdateModelDeploymentMonitoringJob', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.JobService/UpdateModelDeploymentMonitoringJob', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getModelDeploymentMonitoringJob(); $this->assertProtobufEquals($modelDeploymentMonitoringJob, $actualValue); $actualValue = $actualApiRequestObject->getUpdateMask(); @@ -3076,12 +3189,15 @@ public function updateModelDeploymentMonitoringJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $modelDeploymentMonitoringJob = new ModelDeploymentMonitoringJob(); @@ -3090,11 +3206,17 @@ public function updateModelDeploymentMonitoringJobExceptionTest() $modelDeploymentMonitoringJobEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $modelDeploymentMonitoringJob->setEndpoint($modelDeploymentMonitoringJobEndpoint); $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = []; - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs($modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs); + $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs( + $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs + ); $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = new ModelDeploymentMonitoringScheduleConfig(); $modelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration(); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval($modelDeploymentMonitoringScheduleConfigMonitorInterval); - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig($modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig); + $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval( + $modelDeploymentMonitoringScheduleConfigMonitorInterval + ); + $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig( + $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig + ); $modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy(); $modelDeploymentMonitoringJob->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy); $updateMask = new FieldMask(); @@ -3162,12 +3284,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -3194,9 +3319,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -3226,12 +3349,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -3264,8 +3390,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3289,17 +3414,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -3331,9 +3458,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3359,19 +3484,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -3399,9 +3525,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3427,19 +3551,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -3466,8 +3591,7 @@ public function cancelBatchPredictionJobAsyncTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $request = (new CancelBatchPredictionJobRequest()) - ->setName($formattedName); + $request = (new CancelBatchPredictionJobRequest())->setName($formattedName); $gapicClient->cancelBatchPredictionJobAsync($request)->wait(); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); diff --git a/AiPlatform/tests/Unit/V1/Client/LlmUtilityServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/LlmUtilityServiceClientTest.php index dbae1163398d..26e8ed46af9c 100644 --- a/AiPlatform/tests/Unit/V1/Client/LlmUtilityServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/LlmUtilityServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return LlmUtilityServiceClient */ @@ -85,9 +87,7 @@ public function computeTokensTest() // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $instances = []; - $request = (new ComputeTokensRequest()) - ->setEndpoint($formattedEndpoint) - ->setInstances($instances); + $request = (new ComputeTokensRequest())->setEndpoint($formattedEndpoint)->setInstances($instances); $response = $gapicClient->computeTokens($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -113,19 +113,20 @@ public function computeTokensExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $instances = []; - $request = (new ComputeTokensRequest()) - ->setEndpoint($formattedEndpoint) - ->setInstances($instances); + $request = (new ComputeTokensRequest())->setEndpoint($formattedEndpoint)->setInstances($instances); try { $gapicClient->computeTokens($request); // If the $gapicClient method call did not throw, fail the test @@ -193,12 +194,15 @@ public function countTokensExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); @@ -262,12 +266,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -294,9 +301,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -326,12 +331,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -364,8 +372,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -389,17 +396,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -431,9 +440,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -459,19 +466,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -499,9 +507,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -527,19 +533,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -567,9 +574,7 @@ public function computeTokensAsyncTest() // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $instances = []; - $request = (new ComputeTokensRequest()) - ->setEndpoint($formattedEndpoint) - ->setInstances($instances); + $request = (new ComputeTokensRequest())->setEndpoint($formattedEndpoint)->setInstances($instances); $response = $gapicClient->computeTokensAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/AiPlatform/tests/Unit/V1/Client/MatchServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/MatchServiceClientTest.php index 9fb91d59ad84..bde5187350e7 100644 --- a/AiPlatform/tests/Unit/V1/Client/MatchServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/MatchServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return MatchServiceClient */ @@ -84,8 +86,7 @@ public function findNeighborsTest() $transport->addResponse($expectedResponse); // Mock request $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $request = (new FindNeighborsRequest()) - ->setIndexEndpoint($formattedIndexEndpoint); + $request = (new FindNeighborsRequest())->setIndexEndpoint($formattedIndexEndpoint); $response = $gapicClient->findNeighbors($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -109,17 +110,19 @@ public function findNeighborsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $request = (new FindNeighborsRequest()) - ->setIndexEndpoint($formattedIndexEndpoint); + $request = (new FindNeighborsRequest())->setIndexEndpoint($formattedIndexEndpoint); try { $gapicClient->findNeighbors($request); // If the $gapicClient method call did not throw, fail the test @@ -146,8 +149,7 @@ public function readIndexDatapointsTest() $transport->addResponse($expectedResponse); // Mock request $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $request = (new ReadIndexDatapointsRequest()) - ->setIndexEndpoint($formattedIndexEndpoint); + $request = (new ReadIndexDatapointsRequest())->setIndexEndpoint($formattedIndexEndpoint); $response = $gapicClient->readIndexDatapoints($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -171,17 +173,19 @@ public function readIndexDatapointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $request = (new ReadIndexDatapointsRequest()) - ->setIndexEndpoint($formattedIndexEndpoint); + $request = (new ReadIndexDatapointsRequest())->setIndexEndpoint($formattedIndexEndpoint); try { $gapicClient->readIndexDatapoints($request); // If the $gapicClient method call did not throw, fail the test @@ -234,12 +238,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -266,9 +273,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -298,12 +303,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -336,8 +344,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -361,17 +368,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -403,9 +412,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -431,19 +438,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -471,9 +479,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -499,19 +505,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -538,8 +545,7 @@ public function findNeighborsAsyncTest() $transport->addResponse($expectedResponse); // Mock request $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $request = (new FindNeighborsRequest()) - ->setIndexEndpoint($formattedIndexEndpoint); + $request = (new FindNeighborsRequest())->setIndexEndpoint($formattedIndexEndpoint); $response = $gapicClient->findNeighborsAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/AiPlatform/tests/Unit/V1/Client/MetadataServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/MetadataServiceClientTest.php index 71c07963bd86..932f3063741e 100644 --- a/AiPlatform/tests/Unit/V1/Client/MetadataServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/MetadataServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return MetadataServiceClient */ @@ -135,15 +137,17 @@ public function addContextArtifactsAndExecutionsTest() $transport->addResponse($expectedResponse); // Mock request $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new AddContextArtifactsAndExecutionsRequest()) - ->setContext($formattedContext); + $request = (new AddContextArtifactsAndExecutionsRequest())->setContext($formattedContext); $response = $gapicClient->addContextArtifactsAndExecutions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/AddContextArtifactsAndExecutions', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.MetadataService/AddContextArtifactsAndExecutions', + $actualFuncCall + ); $actualValue = $actualRequestObject->getContext(); $this->assertProtobufEquals($formattedContext, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -160,17 +164,19 @@ public function addContextArtifactsAndExecutionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new AddContextArtifactsAndExecutionsRequest()) - ->setContext($formattedContext); + $request = (new AddContextArtifactsAndExecutionsRequest())->setContext($formattedContext); try { $gapicClient->addContextArtifactsAndExecutions($request); // If the $gapicClient method call did not throw, fail the test @@ -197,8 +203,7 @@ public function addContextChildrenTest() $transport->addResponse($expectedResponse); // Mock request $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new AddContextChildrenRequest()) - ->setContext($formattedContext); + $request = (new AddContextChildrenRequest())->setContext($formattedContext); $response = $gapicClient->addContextChildren($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -222,17 +227,19 @@ public function addContextChildrenExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new AddContextChildrenRequest()) - ->setContext($formattedContext); + $request = (new AddContextChildrenRequest())->setContext($formattedContext); try { $gapicClient->addContextChildren($request); // If the $gapicClient method call did not throw, fail the test @@ -259,8 +266,7 @@ public function addExecutionEventsTest() $transport->addResponse($expectedResponse); // Mock request $formattedExecution = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $request = (new AddExecutionEventsRequest()) - ->setExecution($formattedExecution); + $request = (new AddExecutionEventsRequest())->setExecution($formattedExecution); $response = $gapicClient->addExecutionEvents($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -284,17 +290,19 @@ public function addExecutionEventsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedExecution = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $request = (new AddExecutionEventsRequest()) - ->setExecution($formattedExecution); + $request = (new AddExecutionEventsRequest())->setExecution($formattedExecution); try { $gapicClient->addExecutionEvents($request); // If the $gapicClient method call did not throw, fail the test @@ -336,9 +344,7 @@ public function createArtifactTest() // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $artifact = new Artifact(); - $request = (new CreateArtifactRequest()) - ->setParent($formattedParent) - ->setArtifact($artifact); + $request = (new CreateArtifactRequest())->setParent($formattedParent)->setArtifact($artifact); $response = $gapicClient->createArtifact($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -364,19 +370,20 @@ public function createArtifactExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $artifact = new Artifact(); - $request = (new CreateArtifactRequest()) - ->setParent($formattedParent) - ->setArtifact($artifact); + $request = (new CreateArtifactRequest())->setParent($formattedParent)->setArtifact($artifact); try { $gapicClient->createArtifact($request); // If the $gapicClient method call did not throw, fail the test @@ -416,9 +423,7 @@ public function createContextTest() // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $context = new Context(); - $request = (new CreateContextRequest()) - ->setParent($formattedParent) - ->setContext($context); + $request = (new CreateContextRequest())->setParent($formattedParent)->setContext($context); $response = $gapicClient->createContext($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -444,19 +449,20 @@ public function createContextExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $context = new Context(); - $request = (new CreateContextRequest()) - ->setParent($formattedParent) - ->setContext($context); + $request = (new CreateContextRequest())->setParent($formattedParent)->setContext($context); try { $gapicClient->createContext($request); // If the $gapicClient method call did not throw, fail the test @@ -496,9 +502,7 @@ public function createExecutionTest() // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $execution = new Execution(); - $request = (new CreateExecutionRequest()) - ->setParent($formattedParent) - ->setExecution($execution); + $request = (new CreateExecutionRequest())->setParent($formattedParent)->setExecution($execution); $response = $gapicClient->createExecution($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -524,19 +528,20 @@ public function createExecutionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $execution = new Execution(); - $request = (new CreateExecutionRequest()) - ->setParent($formattedParent) - ->setExecution($execution); + $request = (new CreateExecutionRequest())->setParent($formattedParent)->setExecution($execution); try { $gapicClient->createExecution($request); // If the $gapicClient method call did not throw, fail the test @@ -574,9 +579,7 @@ public function createMetadataSchemaTest() $metadataSchema = new MetadataSchema(); $metadataSchemaSchema = 'metadataSchemaSchema-249734287'; $metadataSchema->setSchema($metadataSchemaSchema); - $request = (new CreateMetadataSchemaRequest()) - ->setParent($formattedParent) - ->setMetadataSchema($metadataSchema); + $request = (new CreateMetadataSchemaRequest())->setParent($formattedParent)->setMetadataSchema($metadataSchema); $response = $gapicClient->createMetadataSchema($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -602,21 +605,22 @@ public function createMetadataSchemaExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $metadataSchema = new MetadataSchema(); $metadataSchemaSchema = 'metadataSchemaSchema-249734287'; $metadataSchema->setSchema($metadataSchemaSchema); - $request = (new CreateMetadataSchemaRequest()) - ->setParent($formattedParent) - ->setMetadataSchema($metadataSchema); + $request = (new CreateMetadataSchemaRequest())->setParent($formattedParent)->setMetadataSchema($metadataSchema); try { $gapicClient->createMetadataSchema($request); // If the $gapicClient method call did not throw, fail the test @@ -666,9 +670,7 @@ public function createMetadataStoreTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $metadataStore = new MetadataStore(); - $request = (new CreateMetadataStoreRequest()) - ->setParent($formattedParent) - ->setMetadataStore($metadataStore); + $request = (new CreateMetadataStoreRequest())->setParent($formattedParent)->setMetadataStore($metadataStore); $response = $gapicClient->createMetadataStore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -726,19 +728,20 @@ public function createMetadataStoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $metadataStore = new MetadataStore(); - $request = (new CreateMetadataStoreRequest()) - ->setParent($formattedParent) - ->setMetadataStore($metadataStore); + $request = (new CreateMetadataStoreRequest())->setParent($formattedParent)->setMetadataStore($metadataStore); $response = $gapicClient->createMetadataStore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -792,8 +795,7 @@ public function deleteArtifactTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $request = (new DeleteArtifactRequest()) - ->setName($formattedName); + $request = (new DeleteArtifactRequest())->setName($formattedName); $response = $gapicClient->deleteArtifact($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -849,17 +851,19 @@ public function deleteArtifactExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $request = (new DeleteArtifactRequest()) - ->setName($formattedName); + $request = (new DeleteArtifactRequest())->setName($formattedName); $response = $gapicClient->deleteArtifact($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -913,8 +917,7 @@ public function deleteContextTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new DeleteContextRequest()) - ->setName($formattedName); + $request = (new DeleteContextRequest())->setName($formattedName); $response = $gapicClient->deleteContext($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -970,17 +973,19 @@ public function deleteContextExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new DeleteContextRequest()) - ->setName($formattedName); + $request = (new DeleteContextRequest())->setName($formattedName); $response = $gapicClient->deleteContext($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1034,8 +1039,7 @@ public function deleteExecutionTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $request = (new DeleteExecutionRequest()) - ->setName($formattedName); + $request = (new DeleteExecutionRequest())->setName($formattedName); $response = $gapicClient->deleteExecution($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1091,17 +1095,19 @@ public function deleteExecutionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $request = (new DeleteExecutionRequest()) - ->setName($formattedName); + $request = (new DeleteExecutionRequest())->setName($formattedName); $response = $gapicClient->deleteExecution($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1155,8 +1161,7 @@ public function deleteMetadataStoreTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new DeleteMetadataStoreRequest()) - ->setName($formattedName); + $request = (new DeleteMetadataStoreRequest())->setName($formattedName); $response = $gapicClient->deleteMetadataStore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1212,17 +1217,19 @@ public function deleteMetadataStoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new DeleteMetadataStoreRequest()) - ->setName($formattedName); + $request = (new DeleteMetadataStoreRequest())->setName($formattedName); $response = $gapicClient->deleteMetadataStore($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1272,8 +1279,7 @@ public function getArtifactTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $request = (new GetArtifactRequest()) - ->setName($formattedName); + $request = (new GetArtifactRequest())->setName($formattedName); $response = $gapicClient->getArtifact($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1297,17 +1303,19 @@ public function getArtifactExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $request = (new GetArtifactRequest()) - ->setName($formattedName); + $request = (new GetArtifactRequest())->setName($formattedName); try { $gapicClient->getArtifact($request); // If the $gapicClient method call did not throw, fail the test @@ -1346,8 +1354,7 @@ public function getContextTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new GetContextRequest()) - ->setName($formattedName); + $request = (new GetContextRequest())->setName($formattedName); $response = $gapicClient->getContext($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1371,17 +1378,19 @@ public function getContextExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new GetContextRequest()) - ->setName($formattedName); + $request = (new GetContextRequest())->setName($formattedName); try { $gapicClient->getContext($request); // If the $gapicClient method call did not throw, fail the test @@ -1420,8 +1429,7 @@ public function getExecutionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $request = (new GetExecutionRequest()) - ->setName($formattedName); + $request = (new GetExecutionRequest())->setName($formattedName); $response = $gapicClient->getExecution($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1445,17 +1453,19 @@ public function getExecutionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $request = (new GetExecutionRequest()) - ->setName($formattedName); + $request = (new GetExecutionRequest())->setName($formattedName); try { $gapicClient->getExecution($request); // If the $gapicClient method call did not throw, fail the test @@ -1489,9 +1499,13 @@ public function getMetadataSchemaTest() $expectedResponse->setDescription($description); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->metadataSchemaName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[METADATA_SCHEMA]'); - $request = (new GetMetadataSchemaRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->metadataSchemaName( + '[PROJECT]', + '[LOCATION]', + '[METADATA_STORE]', + '[METADATA_SCHEMA]' + ); + $request = (new GetMetadataSchemaRequest())->setName($formattedName); $response = $gapicClient->getMetadataSchema($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1515,17 +1529,24 @@ public function getMetadataSchemaExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->metadataSchemaName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[METADATA_SCHEMA]'); - $request = (new GetMetadataSchemaRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->metadataSchemaName( + '[PROJECT]', + '[LOCATION]', + '[METADATA_STORE]', + '[METADATA_SCHEMA]' + ); + $request = (new GetMetadataSchemaRequest())->setName($formattedName); try { $gapicClient->getMetadataSchema($request); // If the $gapicClient method call did not throw, fail the test @@ -1556,8 +1577,7 @@ public function getMetadataStoreTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new GetMetadataStoreRequest()) - ->setName($formattedName); + $request = (new GetMetadataStoreRequest())->setName($formattedName); $response = $gapicClient->getMetadataStore($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1581,17 +1601,19 @@ public function getMetadataStoreExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new GetMetadataStoreRequest()) - ->setName($formattedName); + $request = (new GetMetadataStoreRequest())->setName($formattedName); try { $gapicClient->getMetadataStore($request); // If the $gapicClient method call did not throw, fail the test @@ -1616,17 +1638,14 @@ public function listArtifactsTest() // Mock response $nextPageToken = ''; $artifactsElement = new Artifact(); - $artifacts = [ - $artifactsElement, - ]; + $artifacts = [$artifactsElement]; $expectedResponse = new ListArtifactsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setArtifacts($artifacts); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new ListArtifactsRequest()) - ->setParent($formattedParent); + $request = (new ListArtifactsRequest())->setParent($formattedParent); $response = $gapicClient->listArtifacts($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1653,17 +1672,19 @@ public function listArtifactsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new ListArtifactsRequest()) - ->setParent($formattedParent); + $request = (new ListArtifactsRequest())->setParent($formattedParent); try { $gapicClient->listArtifacts($request); // If the $gapicClient method call did not throw, fail the test @@ -1688,17 +1709,14 @@ public function listContextsTest() // Mock response $nextPageToken = ''; $contextsElement = new Context(); - $contexts = [ - $contextsElement, - ]; + $contexts = [$contextsElement]; $expectedResponse = new ListContextsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setContexts($contexts); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new ListContextsRequest()) - ->setParent($formattedParent); + $request = (new ListContextsRequest())->setParent($formattedParent); $response = $gapicClient->listContexts($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1725,17 +1743,19 @@ public function listContextsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new ListContextsRequest()) - ->setParent($formattedParent); + $request = (new ListContextsRequest())->setParent($formattedParent); try { $gapicClient->listContexts($request); // If the $gapicClient method call did not throw, fail the test @@ -1760,17 +1780,14 @@ public function listExecutionsTest() // Mock response $nextPageToken = ''; $executionsElement = new Execution(); - $executions = [ - $executionsElement, - ]; + $executions = [$executionsElement]; $expectedResponse = new ListExecutionsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setExecutions($executions); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new ListExecutionsRequest()) - ->setParent($formattedParent); + $request = (new ListExecutionsRequest())->setParent($formattedParent); $response = $gapicClient->listExecutions($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1797,17 +1814,19 @@ public function listExecutionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new ListExecutionsRequest()) - ->setParent($formattedParent); + $request = (new ListExecutionsRequest())->setParent($formattedParent); try { $gapicClient->listExecutions($request); // If the $gapicClient method call did not throw, fail the test @@ -1832,17 +1851,14 @@ public function listMetadataSchemasTest() // Mock response $nextPageToken = ''; $metadataSchemasElement = new MetadataSchema(); - $metadataSchemas = [ - $metadataSchemasElement, - ]; + $metadataSchemas = [$metadataSchemasElement]; $expectedResponse = new ListMetadataSchemasResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setMetadataSchemas($metadataSchemas); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new ListMetadataSchemasRequest()) - ->setParent($formattedParent); + $request = (new ListMetadataSchemasRequest())->setParent($formattedParent); $response = $gapicClient->listMetadataSchemas($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1869,17 +1885,19 @@ public function listMetadataSchemasExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $request = (new ListMetadataSchemasRequest()) - ->setParent($formattedParent); + $request = (new ListMetadataSchemasRequest())->setParent($formattedParent); try { $gapicClient->listMetadataSchemas($request); // If the $gapicClient method call did not throw, fail the test @@ -1904,17 +1922,14 @@ public function listMetadataStoresTest() // Mock response $nextPageToken = ''; $metadataStoresElement = new MetadataStore(); - $metadataStores = [ - $metadataStoresElement, - ]; + $metadataStores = [$metadataStoresElement]; $expectedResponse = new ListMetadataStoresResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setMetadataStores($metadataStores); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListMetadataStoresRequest()) - ->setParent($formattedParent); + $request = (new ListMetadataStoresRequest())->setParent($formattedParent); $response = $gapicClient->listMetadataStores($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1941,17 +1956,19 @@ public function listMetadataStoresExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListMetadataStoresRequest()) - ->setParent($formattedParent); + $request = (new ListMetadataStoresRequest())->setParent($formattedParent); try { $gapicClient->listMetadataStores($request); // If the $gapicClient method call did not throw, fail the test @@ -1999,9 +2016,7 @@ public function purgeArtifactsTest() // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $filter = 'filter-1274492040'; - $request = (new PurgeArtifactsRequest()) - ->setParent($formattedParent) - ->setFilter($filter); + $request = (new PurgeArtifactsRequest())->setParent($formattedParent)->setFilter($filter); $response = $gapicClient->purgeArtifacts($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2059,19 +2074,20 @@ public function purgeArtifactsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $filter = 'filter-1274492040'; - $request = (new PurgeArtifactsRequest()) - ->setParent($formattedParent) - ->setFilter($filter); + $request = (new PurgeArtifactsRequest())->setParent($formattedParent)->setFilter($filter); $response = $gapicClient->purgeArtifacts($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2128,9 +2144,7 @@ public function purgeContextsTest() // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $filter = 'filter-1274492040'; - $request = (new PurgeContextsRequest()) - ->setParent($formattedParent) - ->setFilter($filter); + $request = (new PurgeContextsRequest())->setParent($formattedParent)->setFilter($filter); $response = $gapicClient->purgeContexts($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2188,19 +2202,20 @@ public function purgeContextsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $filter = 'filter-1274492040'; - $request = (new PurgeContextsRequest()) - ->setParent($formattedParent) - ->setFilter($filter); + $request = (new PurgeContextsRequest())->setParent($formattedParent)->setFilter($filter); $response = $gapicClient->purgeContexts($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2257,9 +2272,7 @@ public function purgeExecutionsTest() // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $filter = 'filter-1274492040'; - $request = (new PurgeExecutionsRequest()) - ->setParent($formattedParent) - ->setFilter($filter); + $request = (new PurgeExecutionsRequest())->setParent($formattedParent)->setFilter($filter); $response = $gapicClient->purgeExecutions($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2317,19 +2330,20 @@ public function purgeExecutionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); $filter = 'filter-1274492040'; - $request = (new PurgeExecutionsRequest()) - ->setParent($formattedParent) - ->setFilter($filter); + $request = (new PurgeExecutionsRequest())->setParent($formattedParent)->setFilter($filter); $response = $gapicClient->purgeExecutions($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2365,8 +2379,7 @@ public function queryArtifactLineageSubgraphTest() $transport->addResponse($expectedResponse); // Mock request $formattedArtifact = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $request = (new QueryArtifactLineageSubgraphRequest()) - ->setArtifact($formattedArtifact); + $request = (new QueryArtifactLineageSubgraphRequest())->setArtifact($formattedArtifact); $response = $gapicClient->queryArtifactLineageSubgraph($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2390,17 +2403,19 @@ public function queryArtifactLineageSubgraphExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedArtifact = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $request = (new QueryArtifactLineageSubgraphRequest()) - ->setArtifact($formattedArtifact); + $request = (new QueryArtifactLineageSubgraphRequest())->setArtifact($formattedArtifact); try { $gapicClient->queryArtifactLineageSubgraph($request); // If the $gapicClient method call did not throw, fail the test @@ -2427,8 +2442,7 @@ public function queryContextLineageSubgraphTest() $transport->addResponse($expectedResponse); // Mock request $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new QueryContextLineageSubgraphRequest()) - ->setContext($formattedContext); + $request = (new QueryContextLineageSubgraphRequest())->setContext($formattedContext); $response = $gapicClient->queryContextLineageSubgraph($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2452,17 +2466,19 @@ public function queryContextLineageSubgraphExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new QueryContextLineageSubgraphRequest()) - ->setContext($formattedContext); + $request = (new QueryContextLineageSubgraphRequest())->setContext($formattedContext); try { $gapicClient->queryContextLineageSubgraph($request); // If the $gapicClient method call did not throw, fail the test @@ -2489,15 +2505,17 @@ public function queryExecutionInputsAndOutputsTest() $transport->addResponse($expectedResponse); // Mock request $formattedExecution = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $request = (new QueryExecutionInputsAndOutputsRequest()) - ->setExecution($formattedExecution); + $request = (new QueryExecutionInputsAndOutputsRequest())->setExecution($formattedExecution); $response = $gapicClient->queryExecutionInputsAndOutputs($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/QueryExecutionInputsAndOutputs', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.MetadataService/QueryExecutionInputsAndOutputs', + $actualFuncCall + ); $actualValue = $actualRequestObject->getExecution(); $this->assertProtobufEquals($formattedExecution, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -2514,17 +2532,19 @@ public function queryExecutionInputsAndOutputsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedExecution = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $request = (new QueryExecutionInputsAndOutputsRequest()) - ->setExecution($formattedExecution); + $request = (new QueryExecutionInputsAndOutputsRequest())->setExecution($formattedExecution); try { $gapicClient->queryExecutionInputsAndOutputs($request); // If the $gapicClient method call did not throw, fail the test @@ -2551,8 +2571,7 @@ public function removeContextChildrenTest() $transport->addResponse($expectedResponse); // Mock request $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new RemoveContextChildrenRequest()) - ->setContext($formattedContext); + $request = (new RemoveContextChildrenRequest())->setContext($formattedContext); $response = $gapicClient->removeContextChildren($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2576,17 +2595,19 @@ public function removeContextChildrenExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new RemoveContextChildrenRequest()) - ->setContext($formattedContext); + $request = (new RemoveContextChildrenRequest())->setContext($formattedContext); try { $gapicClient->removeContextChildren($request); // If the $gapicClient method call did not throw, fail the test @@ -2627,8 +2648,7 @@ public function updateArtifactTest() $transport->addResponse($expectedResponse); // Mock request $artifact = new Artifact(); - $request = (new UpdateArtifactRequest()) - ->setArtifact($artifact); + $request = (new UpdateArtifactRequest())->setArtifact($artifact); $response = $gapicClient->updateArtifact($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2652,17 +2672,19 @@ public function updateArtifactExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $artifact = new Artifact(); - $request = (new UpdateArtifactRequest()) - ->setArtifact($artifact); + $request = (new UpdateArtifactRequest())->setArtifact($artifact); try { $gapicClient->updateArtifact($request); // If the $gapicClient method call did not throw, fail the test @@ -2701,8 +2723,7 @@ public function updateContextTest() $transport->addResponse($expectedResponse); // Mock request $context = new Context(); - $request = (new UpdateContextRequest()) - ->setContext($context); + $request = (new UpdateContextRequest())->setContext($context); $response = $gapicClient->updateContext($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2726,17 +2747,19 @@ public function updateContextExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $context = new Context(); - $request = (new UpdateContextRequest()) - ->setContext($context); + $request = (new UpdateContextRequest())->setContext($context); try { $gapicClient->updateContext($request); // If the $gapicClient method call did not throw, fail the test @@ -2775,8 +2798,7 @@ public function updateExecutionTest() $transport->addResponse($expectedResponse); // Mock request $execution = new Execution(); - $request = (new UpdateExecutionRequest()) - ->setExecution($execution); + $request = (new UpdateExecutionRequest())->setExecution($execution); $response = $gapicClient->updateExecution($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2800,17 +2822,19 @@ public function updateExecutionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $execution = new Execution(); - $request = (new UpdateExecutionRequest()) - ->setExecution($execution); + $request = (new UpdateExecutionRequest())->setExecution($execution); try { $gapicClient->updateExecution($request); // If the $gapicClient method call did not throw, fail the test @@ -2863,12 +2887,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -2895,9 +2922,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -2927,12 +2952,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -2965,8 +2993,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2990,17 +3017,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -3032,9 +3061,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3060,19 +3087,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -3100,9 +3128,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3128,19 +3154,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -3167,15 +3194,17 @@ public function addContextArtifactsAndExecutionsAsyncTest() $transport->addResponse($expectedResponse); // Mock request $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $request = (new AddContextArtifactsAndExecutionsRequest()) - ->setContext($formattedContext); + $request = (new AddContextArtifactsAndExecutionsRequest())->setContext($formattedContext); $response = $gapicClient->addContextArtifactsAndExecutionsAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/AddContextArtifactsAndExecutions', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.MetadataService/AddContextArtifactsAndExecutions', + $actualFuncCall + ); $actualValue = $actualRequestObject->getContext(); $this->assertProtobufEquals($formattedContext, $actualValue); $this->assertTrue($transport->isExhausted()); diff --git a/AiPlatform/tests/Unit/V1/Client/MigrationServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/MigrationServiceClientTest.php index 8a3817d32220..d400c757da71 100644 --- a/AiPlatform/tests/Unit/V1/Client/MigrationServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/MigrationServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return MigrationServiceClient */ @@ -168,12 +170,15 @@ public function batchMigrateResourcesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -214,17 +219,14 @@ public function searchMigratableResourcesTest() // Mock response $nextPageToken = ''; $migratableResourcesElement = new MigratableResource(); - $migratableResources = [ - $migratableResourcesElement, - ]; + $migratableResources = [$migratableResourcesElement]; $expectedResponse = new SearchMigratableResourcesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setMigratableResources($migratableResources); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new SearchMigratableResourcesRequest()) - ->setParent($formattedParent); + $request = (new SearchMigratableResourcesRequest())->setParent($formattedParent); $response = $gapicClient->searchMigratableResources($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -251,17 +253,19 @@ public function searchMigratableResourcesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new SearchMigratableResourcesRequest()) - ->setParent($formattedParent); + $request = (new SearchMigratableResourcesRequest())->setParent($formattedParent); try { $gapicClient->searchMigratableResources($request); // If the $gapicClient method call did not throw, fail the test @@ -314,12 +318,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -346,9 +353,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -378,12 +383,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -416,8 +424,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -441,17 +448,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -483,9 +492,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -511,19 +518,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -551,9 +559,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -579,19 +585,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test diff --git a/AiPlatform/tests/Unit/V1/Client/ModelGardenServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/ModelGardenServiceClientTest.php index 066646cb2261..330de89e4e88 100644 --- a/AiPlatform/tests/Unit/V1/Client/ModelGardenServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/ModelGardenServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ModelGardenServiceClient */ @@ -88,8 +90,7 @@ public function getPublisherModelTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->publisherModelName('[PUBLISHER]', '[MODEL]'); - $request = (new GetPublisherModelRequest()) - ->setName($formattedName); + $request = (new GetPublisherModelRequest())->setName($formattedName); $response = $gapicClient->getPublisherModel($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -113,17 +114,19 @@ public function getPublisherModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->publisherModelName('[PUBLISHER]', '[MODEL]'); - $request = (new GetPublisherModelRequest()) - ->setName($formattedName); + $request = (new GetPublisherModelRequest())->setName($formattedName); try { $gapicClient->getPublisherModel($request); // If the $gapicClient method call did not throw, fail the test @@ -176,12 +179,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -208,9 +214,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -240,12 +244,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -278,8 +285,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -303,17 +309,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -345,9 +353,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -373,19 +379,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -413,9 +420,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -441,19 +446,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -486,8 +492,7 @@ public function getPublisherModelAsyncTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->publisherModelName('[PUBLISHER]', '[MODEL]'); - $request = (new GetPublisherModelRequest()) - ->setName($formattedName); + $request = (new GetPublisherModelRequest())->setName($formattedName); $response = $gapicClient->getPublisherModelAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/AiPlatform/tests/Unit/V1/Client/ModelServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/ModelServiceClientTest.php index f54ecc36feaf..7815ca97ac96 100644 --- a/AiPlatform/tests/Unit/V1/Client/ModelServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/ModelServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ModelServiceClient */ @@ -119,7 +121,13 @@ public function batchImportEvaluatedAnnotationsTest() $expectedResponse->setImportedEvaluatedAnnotationsCount($importedEvaluatedAnnotationsCount); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); + $formattedParent = $gapicClient->modelEvaluationSliceName( + '[PROJECT]', + '[LOCATION]', + '[MODEL]', + '[EVALUATION]', + '[SLICE]' + ); $evaluatedAnnotations = []; $request = (new BatchImportEvaluatedAnnotationsRequest()) ->setParent($formattedParent) @@ -149,15 +157,24 @@ public function batchImportEvaluatedAnnotationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); + $formattedParent = $gapicClient->modelEvaluationSliceName( + '[PROJECT]', + '[LOCATION]', + '[MODEL]', + '[EVALUATION]', + '[SLICE]' + ); $evaluatedAnnotations = []; $request = (new BatchImportEvaluatedAnnotationsRequest()) ->setParent($formattedParent) @@ -217,12 +234,15 @@ public function batchImportModelEvaluationSlicesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); @@ -279,9 +299,7 @@ public function copyModelTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $formattedSourceModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new CopyModelRequest()) - ->setParent($formattedParent) - ->setSourceModel($formattedSourceModel); + $request = (new CopyModelRequest())->setParent($formattedParent)->setSourceModel($formattedSourceModel); $response = $gapicClient->copyModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -339,19 +357,20 @@ public function copyModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $formattedSourceModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new CopyModelRequest()) - ->setParent($formattedParent) - ->setSourceModel($formattedSourceModel); + $request = (new CopyModelRequest())->setParent($formattedParent)->setSourceModel($formattedSourceModel); $response = $gapicClient->copyModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -405,8 +424,7 @@ public function deleteModelTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new DeleteModelRequest()) - ->setName($formattedName); + $request = (new DeleteModelRequest())->setName($formattedName); $response = $gapicClient->deleteModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -462,17 +480,19 @@ public function deleteModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new DeleteModelRequest()) - ->setName($formattedName); + $request = (new DeleteModelRequest())->setName($formattedName); $response = $gapicClient->deleteModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -526,8 +546,7 @@ public function deleteModelVersionTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new DeleteModelVersionRequest()) - ->setName($formattedName); + $request = (new DeleteModelVersionRequest())->setName($formattedName); $response = $gapicClient->deleteModelVersion($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -583,17 +602,19 @@ public function deleteModelVersionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new DeleteModelVersionRequest()) - ->setName($formattedName); + $request = (new DeleteModelVersionRequest())->setName($formattedName); $response = $gapicClient->deleteModelVersion($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -648,9 +669,7 @@ public function exportModelTest() // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); $outputConfig = new OutputConfig(); - $request = (new ExportModelRequest()) - ->setName($formattedName) - ->setOutputConfig($outputConfig); + $request = (new ExportModelRequest())->setName($formattedName)->setOutputConfig($outputConfig); $response = $gapicClient->exportModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -708,19 +727,20 @@ public function exportModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); $outputConfig = new OutputConfig(); - $request = (new ExportModelRequest()) - ->setName($formattedName) - ->setOutputConfig($outputConfig); + $request = (new ExportModelRequest())->setName($formattedName)->setOutputConfig($outputConfig); $response = $gapicClient->exportModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -778,8 +798,7 @@ public function getModelTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new GetModelRequest()) - ->setName($formattedName); + $request = (new GetModelRequest())->setName($formattedName); $response = $gapicClient->getModel($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -803,17 +822,19 @@ public function getModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new GetModelRequest()) - ->setName($formattedName); + $request = (new GetModelRequest())->setName($formattedName); try { $gapicClient->getModel($request); // If the $gapicClient method call did not throw, fail the test @@ -850,8 +871,7 @@ public function getModelEvaluationTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - $request = (new GetModelEvaluationRequest()) - ->setName($formattedName); + $request = (new GetModelEvaluationRequest())->setName($formattedName); $response = $gapicClient->getModelEvaluation($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -875,17 +895,19 @@ public function getModelEvaluationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - $request = (new GetModelEvaluationRequest()) - ->setName($formattedName); + $request = (new GetModelEvaluationRequest())->setName($formattedName); try { $gapicClient->getModelEvaluation($request); // If the $gapicClient method call did not throw, fail the test @@ -915,9 +937,14 @@ public function getModelEvaluationSliceTest() $expectedResponse->setMetricsSchemaUri($metricsSchemaUri); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); - $request = (new GetModelEvaluationSliceRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelEvaluationSliceName( + '[PROJECT]', + '[LOCATION]', + '[MODEL]', + '[EVALUATION]', + '[SLICE]' + ); + $request = (new GetModelEvaluationSliceRequest())->setName($formattedName); $response = $gapicClient->getModelEvaluationSlice($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -941,17 +968,25 @@ public function getModelEvaluationSliceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); - $request = (new GetModelEvaluationSliceRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->modelEvaluationSliceName( + '[PROJECT]', + '[LOCATION]', + '[MODEL]', + '[EVALUATION]', + '[SLICE]' + ); + $request = (new GetModelEvaluationSliceRequest())->setName($formattedName); try { $gapicClient->getModelEvaluationSlice($request); // If the $gapicClient method call did not throw, fail the test @@ -1017,12 +1052,15 @@ public function importModelEvaluationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); @@ -1054,17 +1092,14 @@ public function listModelEvaluationSlicesTest() // Mock response $nextPageToken = ''; $modelEvaluationSlicesElement = new ModelEvaluationSlice(); - $modelEvaluationSlices = [ - $modelEvaluationSlicesElement, - ]; + $modelEvaluationSlices = [$modelEvaluationSlicesElement]; $expectedResponse = new ListModelEvaluationSlicesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setModelEvaluationSlices($modelEvaluationSlices); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - $request = (new ListModelEvaluationSlicesRequest()) - ->setParent($formattedParent); + $request = (new ListModelEvaluationSlicesRequest())->setParent($formattedParent); $response = $gapicClient->listModelEvaluationSlices($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1091,17 +1126,19 @@ public function listModelEvaluationSlicesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - $request = (new ListModelEvaluationSlicesRequest()) - ->setParent($formattedParent); + $request = (new ListModelEvaluationSlicesRequest())->setParent($formattedParent); try { $gapicClient->listModelEvaluationSlices($request); // If the $gapicClient method call did not throw, fail the test @@ -1126,17 +1163,14 @@ public function listModelEvaluationsTest() // Mock response $nextPageToken = ''; $modelEvaluationsElement = new ModelEvaluation(); - $modelEvaluations = [ - $modelEvaluationsElement, - ]; + $modelEvaluations = [$modelEvaluationsElement]; $expectedResponse = new ListModelEvaluationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setModelEvaluations($modelEvaluations); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new ListModelEvaluationsRequest()) - ->setParent($formattedParent); + $request = (new ListModelEvaluationsRequest())->setParent($formattedParent); $response = $gapicClient->listModelEvaluations($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1163,17 +1197,19 @@ public function listModelEvaluationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new ListModelEvaluationsRequest()) - ->setParent($formattedParent); + $request = (new ListModelEvaluationsRequest())->setParent($formattedParent); try { $gapicClient->listModelEvaluations($request); // If the $gapicClient method call did not throw, fail the test @@ -1198,17 +1234,14 @@ public function listModelVersionsTest() // Mock response $nextPageToken = ''; $modelsElement = new Model(); - $models = [ - $modelsElement, - ]; + $models = [$modelsElement]; $expectedResponse = new ListModelVersionsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setModels($models); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new ListModelVersionsRequest()) - ->setName($formattedName); + $request = (new ListModelVersionsRequest())->setName($formattedName); $response = $gapicClient->listModelVersions($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1235,17 +1268,19 @@ public function listModelVersionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new ListModelVersionsRequest()) - ->setName($formattedName); + $request = (new ListModelVersionsRequest())->setName($formattedName); try { $gapicClient->listModelVersions($request); // If the $gapicClient method call did not throw, fail the test @@ -1270,17 +1305,14 @@ public function listModelsTest() // Mock response $nextPageToken = ''; $modelsElement = new Model(); - $models = [ - $modelsElement, - ]; + $models = [$modelsElement]; $expectedResponse = new ListModelsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setModels($models); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListModelsRequest()) - ->setParent($formattedParent); + $request = (new ListModelsRequest())->setParent($formattedParent); $response = $gapicClient->listModels($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1307,17 +1339,19 @@ public function listModelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListModelsRequest()) - ->setParent($formattedParent); + $request = (new ListModelsRequest())->setParent($formattedParent); try { $gapicClient->listModels($request); // If the $gapicClient method call did not throw, fail the test @@ -1367,9 +1401,7 @@ public function mergeVersionAliasesTest() // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); $versionAliases = []; - $request = (new MergeVersionAliasesRequest()) - ->setName($formattedName) - ->setVersionAliases($versionAliases); + $request = (new MergeVersionAliasesRequest())->setName($formattedName)->setVersionAliases($versionAliases); $response = $gapicClient->mergeVersionAliases($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1395,19 +1427,20 @@ public function mergeVersionAliasesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); $versionAliases = []; - $request = (new MergeVersionAliasesRequest()) - ->setName($formattedName) - ->setVersionAliases($versionAliases); + $request = (new MergeVersionAliasesRequest())->setName($formattedName)->setVersionAliases($versionAliases); try { $gapicClient->mergeVersionAliases($request); // If the $gapicClient method call did not throw, fail the test @@ -1452,8 +1485,7 @@ public function updateExplanationDatasetTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new UpdateExplanationDatasetRequest()) - ->setModel($formattedModel); + $request = (new UpdateExplanationDatasetRequest())->setModel($formattedModel); $response = $gapicClient->updateExplanationDataset($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1509,17 +1541,19 @@ public function updateExplanationDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $request = (new UpdateExplanationDatasetRequest()) - ->setModel($formattedModel); + $request = (new UpdateExplanationDatasetRequest())->setModel($formattedModel); $response = $gapicClient->updateExplanationDataset($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1580,9 +1614,7 @@ public function updateModelTest() $modelDisplayName = 'modelDisplayName1578770308'; $model->setDisplayName($modelDisplayName); $updateMask = new FieldMask(); - $request = (new UpdateModelRequest()) - ->setModel($model) - ->setUpdateMask($updateMask); + $request = (new UpdateModelRequest())->setModel($model)->setUpdateMask($updateMask); $response = $gapicClient->updateModel($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1608,21 +1640,22 @@ public function updateModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $model = new Model(); $modelDisplayName = 'modelDisplayName1578770308'; $model->setDisplayName($modelDisplayName); $updateMask = new FieldMask(); - $request = (new UpdateModelRequest()) - ->setModel($model) - ->setUpdateMask($updateMask); + $request = (new UpdateModelRequest())->setModel($model)->setUpdateMask($updateMask); try { $gapicClient->updateModel($request); // If the $gapicClient method call did not throw, fail the test @@ -1674,9 +1707,7 @@ public function uploadModelTest() $model = new Model(); $modelDisplayName = 'modelDisplayName1578770308'; $model->setDisplayName($modelDisplayName); - $request = (new UploadModelRequest()) - ->setParent($formattedParent) - ->setModel($model); + $request = (new UploadModelRequest())->setParent($formattedParent)->setModel($model); $response = $gapicClient->uploadModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1734,21 +1765,22 @@ public function uploadModelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $model = new Model(); $modelDisplayName = 'modelDisplayName1578770308'; $model->setDisplayName($modelDisplayName); - $request = (new UploadModelRequest()) - ->setParent($formattedParent) - ->setModel($model); + $request = (new UploadModelRequest())->setParent($formattedParent)->setModel($model); $response = $gapicClient->uploadModel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1810,12 +1842,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1842,9 +1877,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1874,12 +1907,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1912,8 +1948,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1937,17 +1972,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1979,9 +2016,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2007,19 +2042,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -2047,9 +2083,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2075,19 +2109,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -2115,7 +2150,13 @@ public function batchImportEvaluatedAnnotationsAsyncTest() $expectedResponse->setImportedEvaluatedAnnotationsCount($importedEvaluatedAnnotationsCount); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); + $formattedParent = $gapicClient->modelEvaluationSliceName( + '[PROJECT]', + '[LOCATION]', + '[MODEL]', + '[EVALUATION]', + '[SLICE]' + ); $evaluatedAnnotations = []; $request = (new BatchImportEvaluatedAnnotationsRequest()) ->setParent($formattedParent) diff --git a/AiPlatform/tests/Unit/V1/Client/NotebookServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/NotebookServiceClientTest.php index d82dacce12e8..53be8286861d 100644 --- a/AiPlatform/tests/Unit/V1/Client/NotebookServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/NotebookServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\AIPlatform\V1\AssignNotebookRuntimeRequest; @@ -54,6 +53,7 @@ use Google\Cloud\Location\ListLocationsRequest; use Google\Cloud\Location\ListLocationsResponse; use Google\Cloud\Location\Location; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; @@ -78,7 +78,9 @@ private function createTransport($deserialize = null) /** @return CredentialsWrapper */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NotebookServiceClient */ @@ -141,7 +143,11 @@ public function assignNotebookRuntimeTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNotebookRuntimeTemplate = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); + $formattedNotebookRuntimeTemplate = $gapicClient->notebookRuntimeTemplateName( + '[PROJECT]', + '[LOCATION]', + '[NOTEBOOK_RUNTIME_TEMPLATE]' + ); $notebookRuntime = new NotebookRuntime(); $notebookRuntimeRuntimeUser = 'notebookRuntimeRuntimeUser825639430'; $notebookRuntime->setRuntimeUser($notebookRuntimeRuntimeUser); @@ -210,16 +216,23 @@ public function assignNotebookRuntimeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNotebookRuntimeTemplate = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); + $formattedNotebookRuntimeTemplate = $gapicClient->notebookRuntimeTemplateName( + '[PROJECT]', + '[LOCATION]', + '[NOTEBOOK_RUNTIME_TEMPLATE]' + ); $notebookRuntime = new NotebookRuntime(); $notebookRuntimeRuntimeUser = 'notebookRuntimeRuntimeUser825639430'; $notebookRuntime->setRuntimeUser($notebookRuntimeRuntimeUser); @@ -309,7 +322,10 @@ public function createNotebookRuntimeTemplateTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/CreateNotebookRuntimeTemplate', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.NotebookService/CreateNotebookRuntimeTemplate', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getNotebookRuntimeTemplate(); @@ -357,12 +373,15 @@ public function createNotebookRuntimeTemplateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -425,8 +444,7 @@ public function deleteNotebookRuntimeTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $request = (new DeleteNotebookRuntimeRequest()) - ->setName($formattedName); + $request = (new DeleteNotebookRuntimeRequest())->setName($formattedName); $response = $gapicClient->deleteNotebookRuntime($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -482,17 +500,19 @@ public function deleteNotebookRuntimeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $request = (new DeleteNotebookRuntimeRequest()) - ->setName($formattedName); + $request = (new DeleteNotebookRuntimeRequest())->setName($formattedName); $response = $gapicClient->deleteNotebookRuntime($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -545,9 +565,12 @@ public function deleteNotebookRuntimeTemplateTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - $request = (new DeleteNotebookRuntimeTemplateRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->notebookRuntimeTemplateName( + '[PROJECT]', + '[LOCATION]', + '[NOTEBOOK_RUNTIME_TEMPLATE]' + ); + $request = (new DeleteNotebookRuntimeTemplateRequest())->setName($formattedName); $response = $gapicClient->deleteNotebookRuntimeTemplate($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -557,7 +580,10 @@ public function deleteNotebookRuntimeTemplateTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookRuntimeTemplate', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookRuntimeTemplate', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -603,17 +629,23 @@ public function deleteNotebookRuntimeTemplateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - $request = (new DeleteNotebookRuntimeTemplateRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->notebookRuntimeTemplateName( + '[PROJECT]', + '[LOCATION]', + '[NOTEBOOK_RUNTIME_TEMPLATE]' + ); + $request = (new DeleteNotebookRuntimeTemplateRequest())->setName($formattedName); $response = $gapicClient->deleteNotebookRuntimeTemplate($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -669,8 +701,7 @@ public function getNotebookRuntimeTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $request = (new GetNotebookRuntimeRequest()) - ->setName($formattedName); + $request = (new GetNotebookRuntimeRequest())->setName($formattedName); $response = $gapicClient->getNotebookRuntime($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -694,17 +725,19 @@ public function getNotebookRuntimeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $request = (new GetNotebookRuntimeRequest()) - ->setName($formattedName); + $request = (new GetNotebookRuntimeRequest())->setName($formattedName); try { $gapicClient->getNotebookRuntime($request); // If the $gapicClient method call did not throw, fail the test @@ -742,9 +775,12 @@ public function getNotebookRuntimeTemplateTest() $expectedResponse->setEtag($etag); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - $request = (new GetNotebookRuntimeTemplateRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->notebookRuntimeTemplateName( + '[PROJECT]', + '[LOCATION]', + '[NOTEBOOK_RUNTIME_TEMPLATE]' + ); + $request = (new GetNotebookRuntimeTemplateRequest())->setName($formattedName); $response = $gapicClient->getNotebookRuntimeTemplate($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -768,17 +804,23 @@ public function getNotebookRuntimeTemplateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - $request = (new GetNotebookRuntimeTemplateRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->notebookRuntimeTemplateName( + '[PROJECT]', + '[LOCATION]', + '[NOTEBOOK_RUNTIME_TEMPLATE]' + ); + $request = (new GetNotebookRuntimeTemplateRequest())->setName($formattedName); try { $gapicClient->getNotebookRuntimeTemplate($request); // If the $gapicClient method call did not throw, fail the test @@ -803,17 +845,14 @@ public function listNotebookRuntimeTemplatesTest() // Mock response $nextPageToken = ''; $notebookRuntimeTemplatesElement = new NotebookRuntimeTemplate(); - $notebookRuntimeTemplates = [ - $notebookRuntimeTemplatesElement, - ]; + $notebookRuntimeTemplates = [$notebookRuntimeTemplatesElement]; $expectedResponse = new ListNotebookRuntimeTemplatesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setNotebookRuntimeTemplates($notebookRuntimeTemplates); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNotebookRuntimeTemplatesRequest()) - ->setParent($formattedParent); + $request = (new ListNotebookRuntimeTemplatesRequest())->setParent($formattedParent); $response = $gapicClient->listNotebookRuntimeTemplates($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -840,17 +879,19 @@ public function listNotebookRuntimeTemplatesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNotebookRuntimeTemplatesRequest()) - ->setParent($formattedParent); + $request = (new ListNotebookRuntimeTemplatesRequest())->setParent($formattedParent); try { $gapicClient->listNotebookRuntimeTemplates($request); // If the $gapicClient method call did not throw, fail the test @@ -875,17 +916,14 @@ public function listNotebookRuntimesTest() // Mock response $nextPageToken = ''; $notebookRuntimesElement = new NotebookRuntime(); - $notebookRuntimes = [ - $notebookRuntimesElement, - ]; + $notebookRuntimes = [$notebookRuntimesElement]; $expectedResponse = new ListNotebookRuntimesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setNotebookRuntimes($notebookRuntimes); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNotebookRuntimesRequest()) - ->setParent($formattedParent); + $request = (new ListNotebookRuntimesRequest())->setParent($formattedParent); $response = $gapicClient->listNotebookRuntimes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -912,17 +950,19 @@ public function listNotebookRuntimesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNotebookRuntimesRequest()) - ->setParent($formattedParent); + $request = (new ListNotebookRuntimesRequest())->setParent($formattedParent); try { $gapicClient->listNotebookRuntimes($request); // If the $gapicClient method call did not throw, fail the test @@ -967,8 +1007,7 @@ public function startNotebookRuntimeTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $request = (new StartNotebookRuntimeRequest()) - ->setName($formattedName); + $request = (new StartNotebookRuntimeRequest())->setName($formattedName); $response = $gapicClient->startNotebookRuntime($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1024,17 +1063,19 @@ public function startNotebookRuntimeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $request = (new StartNotebookRuntimeRequest()) - ->setName($formattedName); + $request = (new StartNotebookRuntimeRequest())->setName($formattedName); $response = $gapicClient->startNotebookRuntime($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1113,12 +1154,15 @@ public function updateNotebookRuntimeTemplateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $notebookRuntimeTemplate = new NotebookRuntimeTemplate(); @@ -1172,8 +1216,7 @@ public function upgradeNotebookRuntimeTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $request = (new UpgradeNotebookRuntimeRequest()) - ->setName($formattedName); + $request = (new UpgradeNotebookRuntimeRequest())->setName($formattedName); $response = $gapicClient->upgradeNotebookRuntime($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1229,17 +1272,19 @@ public function upgradeNotebookRuntimeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $request = (new UpgradeNotebookRuntimeRequest()) - ->setName($formattedName); + $request = (new UpgradeNotebookRuntimeRequest())->setName($formattedName); $response = $gapicClient->upgradeNotebookRuntime($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1301,12 +1346,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1333,9 +1381,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1365,12 +1411,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1403,8 +1452,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1428,17 +1476,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1470,9 +1520,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1498,19 +1546,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1538,9 +1587,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1566,19 +1613,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1643,7 +1691,11 @@ public function assignNotebookRuntimeAsyncTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNotebookRuntimeTemplate = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); + $formattedNotebookRuntimeTemplate = $gapicClient->notebookRuntimeTemplateName( + '[PROJECT]', + '[LOCATION]', + '[NOTEBOOK_RUNTIME_TEMPLATE]' + ); $notebookRuntime = new NotebookRuntime(); $notebookRuntimeRuntimeUser = 'notebookRuntimeRuntimeUser825639430'; $notebookRuntime->setRuntimeUser($notebookRuntimeRuntimeUser); diff --git a/AiPlatform/tests/Unit/V1/Client/PersistentResourceServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/PersistentResourceServiceClientTest.php index d7883ca272d8..ef17bc41e889 100644 --- a/AiPlatform/tests/Unit/V1/Client/PersistentResourceServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/PersistentResourceServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\AIPlatform\V1\Client\PersistentResourceServiceClient; @@ -45,6 +44,7 @@ use Google\Cloud\Location\ListLocationsRequest; use Google\Cloud\Location\ListLocationsResponse; use Google\Cloud\Location\Location; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; @@ -69,7 +69,9 @@ private function createTransport($deserialize = null) /** @return CredentialsWrapper */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return PersistentResourceServiceClient */ @@ -135,7 +137,10 @@ public function createPersistentResourceTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/CreatePersistentResource', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.PersistentResourceService/CreatePersistentResource', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getPersistentResource(); @@ -185,12 +190,15 @@ public function createPersistentResourceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -255,8 +263,7 @@ public function deletePersistentResourceTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $request = (new DeletePersistentResourceRequest()) - ->setName($formattedName); + $request = (new DeletePersistentResourceRequest())->setName($formattedName); $response = $gapicClient->deletePersistentResource($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -266,7 +273,10 @@ public function deletePersistentResourceTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/DeletePersistentResource', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.PersistentResourceService/DeletePersistentResource', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -312,17 +322,19 @@ public function deletePersistentResourceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $request = (new DeletePersistentResourceRequest()) - ->setName($formattedName); + $request = (new DeletePersistentResourceRequest())->setName($formattedName); $response = $gapicClient->deletePersistentResource($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -364,15 +376,17 @@ public function getPersistentResourceTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $request = (new GetPersistentResourceRequest()) - ->setName($formattedName); + $request = (new GetPersistentResourceRequest())->setName($formattedName); $response = $gapicClient->getPersistentResource($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/GetPersistentResource', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.PersistentResourceService/GetPersistentResource', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -389,17 +403,19 @@ public function getPersistentResourceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $request = (new GetPersistentResourceRequest()) - ->setName($formattedName); + $request = (new GetPersistentResourceRequest())->setName($formattedName); try { $gapicClient->getPersistentResource($request); // If the $gapicClient method call did not throw, fail the test @@ -424,17 +440,14 @@ public function listPersistentResourcesTest() // Mock response $nextPageToken = ''; $persistentResourcesElement = new PersistentResource(); - $persistentResources = [ - $persistentResourcesElement, - ]; + $persistentResources = [$persistentResourcesElement]; $expectedResponse = new ListPersistentResourcesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setPersistentResources($persistentResources); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListPersistentResourcesRequest()) - ->setParent($formattedParent); + $request = (new ListPersistentResourcesRequest())->setParent($formattedParent); $response = $gapicClient->listPersistentResources($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -444,7 +457,10 @@ public function listPersistentResourcesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/ListPersistentResources', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.PersistentResourceService/ListPersistentResources', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -461,17 +477,19 @@ public function listPersistentResourcesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListPersistentResourcesRequest()) - ->setParent($formattedParent); + $request = (new ListPersistentResourcesRequest())->setParent($formattedParent); try { $gapicClient->listPersistentResources($request); // If the $gapicClient method call did not throw, fail the test @@ -522,8 +540,7 @@ public function rebootPersistentResourceTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $request = (new RebootPersistentResourceRequest()) - ->setName($formattedName); + $request = (new RebootPersistentResourceRequest())->setName($formattedName); $response = $gapicClient->rebootPersistentResource($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -533,7 +550,10 @@ public function rebootPersistentResourceTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/RebootPersistentResource', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.PersistentResourceService/RebootPersistentResource', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -579,17 +599,19 @@ public function rebootPersistentResourceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $request = (new RebootPersistentResourceRequest()) - ->setName($formattedName); + $request = (new RebootPersistentResourceRequest())->setName($formattedName); $response = $gapicClient->rebootPersistentResource($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -664,7 +686,10 @@ public function updatePersistentResourceTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/UpdatePersistentResource', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.PersistentResourceService/UpdatePersistentResource', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getPersistentResource(); $this->assertProtobufEquals($persistentResource, $actualValue); $actualValue = $actualApiRequestObject->getUpdateMask(); @@ -712,12 +737,15 @@ public function updatePersistentResourceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $persistentResource = new PersistentResource(); @@ -788,12 +816,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -820,9 +851,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -852,12 +881,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -890,8 +922,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -915,17 +946,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -957,9 +990,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -985,19 +1016,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1025,9 +1057,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1053,19 +1083,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1133,7 +1164,10 @@ public function createPersistentResourceAsyncTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/CreatePersistentResource', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.PersistentResourceService/CreatePersistentResource', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getPersistentResource(); diff --git a/AiPlatform/tests/Unit/V1/Client/PipelineServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/PipelineServiceClientTest.php index 7f93b7647796..719791e5e651 100644 --- a/AiPlatform/tests/Unit/V1/Client/PipelineServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/PipelineServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return PipelineServiceClient */ @@ -122,12 +124,8 @@ public function batchCancelPipelineJobsTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNames = [ - $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - ]; - $request = (new BatchCancelPipelineJobsRequest()) - ->setParent($formattedParent) - ->setNames($formattedNames); + $formattedNames = [$gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]')]; + $request = (new BatchCancelPipelineJobsRequest())->setParent($formattedParent)->setNames($formattedNames); $response = $gapicClient->batchCancelPipelineJobs($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -185,21 +183,20 @@ public function batchCancelPipelineJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNames = [ - $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - ]; - $request = (new BatchCancelPipelineJobsRequest()) - ->setParent($formattedParent) - ->setNames($formattedNames); + $formattedNames = [$gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]')]; + $request = (new BatchCancelPipelineJobsRequest())->setParent($formattedParent)->setNames($formattedNames); $response = $gapicClient->batchCancelPipelineJobs($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -253,12 +250,8 @@ public function batchDeletePipelineJobsTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNames = [ - $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - ]; - $request = (new BatchDeletePipelineJobsRequest()) - ->setParent($formattedParent) - ->setNames($formattedNames); + $formattedNames = [$gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]')]; + $request = (new BatchDeletePipelineJobsRequest())->setParent($formattedParent)->setNames($formattedNames); $response = $gapicClient->batchDeletePipelineJobs($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -316,21 +309,20 @@ public function batchDeletePipelineJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNames = [ - $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - ]; - $request = (new BatchDeletePipelineJobsRequest()) - ->setParent($formattedParent) - ->setNames($formattedNames); + $formattedNames = [$gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]')]; + $request = (new BatchDeletePipelineJobsRequest())->setParent($formattedParent)->setNames($formattedNames); $response = $gapicClient->batchDeletePipelineJobs($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -366,8 +358,7 @@ public function cancelPipelineJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $request = (new CancelPipelineJobRequest()) - ->setName($formattedName); + $request = (new CancelPipelineJobRequest())->setName($formattedName); $gapicClient->cancelPipelineJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -390,17 +381,19 @@ public function cancelPipelineJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $request = (new CancelPipelineJobRequest()) - ->setName($formattedName); + $request = (new CancelPipelineJobRequest())->setName($formattedName); try { $gapicClient->cancelPipelineJob($request); // If the $gapicClient method call did not throw, fail the test @@ -427,8 +420,7 @@ public function cancelTrainingPipelineTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $request = (new CancelTrainingPipelineRequest()) - ->setName($formattedName); + $request = (new CancelTrainingPipelineRequest())->setName($formattedName); $gapicClient->cancelTrainingPipeline($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -451,17 +443,19 @@ public function cancelTrainingPipelineExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $request = (new CancelTrainingPipelineRequest()) - ->setName($formattedName); + $request = (new CancelTrainingPipelineRequest())->setName($formattedName); try { $gapicClient->cancelTrainingPipeline($request); // If the $gapicClient method call did not throw, fail the test @@ -501,9 +495,7 @@ public function createPipelineJobTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $pipelineJob = new PipelineJob(); - $request = (new CreatePipelineJobRequest()) - ->setParent($formattedParent) - ->setPipelineJob($pipelineJob); + $request = (new CreatePipelineJobRequest())->setParent($formattedParent)->setPipelineJob($pipelineJob); $response = $gapicClient->createPipelineJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -529,19 +521,20 @@ public function createPipelineJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $pipelineJob = new PipelineJob(); - $request = (new CreatePipelineJobRequest()) - ->setParent($formattedParent) - ->setPipelineJob($pipelineJob); + $request = (new CreatePipelineJobRequest())->setParent($formattedParent)->setPipelineJob($pipelineJob); try { $gapicClient->createPipelineJob($request); // If the $gapicClient method call did not throw, fail the test @@ -613,12 +606,15 @@ public function createTrainingPipelineExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -676,8 +672,7 @@ public function deletePipelineJobTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $request = (new DeletePipelineJobRequest()) - ->setName($formattedName); + $request = (new DeletePipelineJobRequest())->setName($formattedName); $response = $gapicClient->deletePipelineJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -733,17 +728,19 @@ public function deletePipelineJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $request = (new DeletePipelineJobRequest()) - ->setName($formattedName); + $request = (new DeletePipelineJobRequest())->setName($formattedName); $response = $gapicClient->deletePipelineJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -797,8 +794,7 @@ public function deleteTrainingPipelineTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $request = (new DeleteTrainingPipelineRequest()) - ->setName($formattedName); + $request = (new DeleteTrainingPipelineRequest())->setName($formattedName); $response = $gapicClient->deleteTrainingPipeline($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -854,17 +850,19 @@ public function deleteTrainingPipelineExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $request = (new DeleteTrainingPipelineRequest()) - ->setName($formattedName); + $request = (new DeleteTrainingPipelineRequest())->setName($formattedName); $response = $gapicClient->deleteTrainingPipeline($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -912,8 +910,7 @@ public function getPipelineJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $request = (new GetPipelineJobRequest()) - ->setName($formattedName); + $request = (new GetPipelineJobRequest())->setName($formattedName); $response = $gapicClient->getPipelineJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -937,17 +934,19 @@ public function getPipelineJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $request = (new GetPipelineJobRequest()) - ->setName($formattedName); + $request = (new GetPipelineJobRequest())->setName($formattedName); try { $gapicClient->getPipelineJob($request); // If the $gapicClient method call did not throw, fail the test @@ -984,8 +983,7 @@ public function getTrainingPipelineTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $request = (new GetTrainingPipelineRequest()) - ->setName($formattedName); + $request = (new GetTrainingPipelineRequest())->setName($formattedName); $response = $gapicClient->getTrainingPipeline($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1009,17 +1007,19 @@ public function getTrainingPipelineExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $request = (new GetTrainingPipelineRequest()) - ->setName($formattedName); + $request = (new GetTrainingPipelineRequest())->setName($formattedName); try { $gapicClient->getTrainingPipeline($request); // If the $gapicClient method call did not throw, fail the test @@ -1044,17 +1044,14 @@ public function listPipelineJobsTest() // Mock response $nextPageToken = ''; $pipelineJobsElement = new PipelineJob(); - $pipelineJobs = [ - $pipelineJobsElement, - ]; + $pipelineJobs = [$pipelineJobsElement]; $expectedResponse = new ListPipelineJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setPipelineJobs($pipelineJobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListPipelineJobsRequest()) - ->setParent($formattedParent); + $request = (new ListPipelineJobsRequest())->setParent($formattedParent); $response = $gapicClient->listPipelineJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1081,17 +1078,19 @@ public function listPipelineJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListPipelineJobsRequest()) - ->setParent($formattedParent); + $request = (new ListPipelineJobsRequest())->setParent($formattedParent); try { $gapicClient->listPipelineJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -1116,17 +1115,14 @@ public function listTrainingPipelinesTest() // Mock response $nextPageToken = ''; $trainingPipelinesElement = new TrainingPipeline(); - $trainingPipelines = [ - $trainingPipelinesElement, - ]; + $trainingPipelines = [$trainingPipelinesElement]; $expectedResponse = new ListTrainingPipelinesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTrainingPipelines($trainingPipelines); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListTrainingPipelinesRequest()) - ->setParent($formattedParent); + $request = (new ListTrainingPipelinesRequest())->setParent($formattedParent); $response = $gapicClient->listTrainingPipelines($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1153,17 +1149,19 @@ public function listTrainingPipelinesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListTrainingPipelinesRequest()) - ->setParent($formattedParent); + $request = (new ListTrainingPipelinesRequest())->setParent($formattedParent); try { $gapicClient->listTrainingPipelines($request); // If the $gapicClient method call did not throw, fail the test @@ -1216,12 +1214,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1248,9 +1249,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1280,12 +1279,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1318,8 +1320,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1343,17 +1344,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1385,9 +1388,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1413,19 +1414,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1453,9 +1455,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1481,19 +1481,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1538,12 +1539,8 @@ public function batchCancelPipelineJobsAsyncTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNames = [ - $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - ]; - $request = (new BatchCancelPipelineJobsRequest()) - ->setParent($formattedParent) - ->setNames($formattedNames); + $formattedNames = [$gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]')]; + $request = (new BatchCancelPipelineJobsRequest())->setParent($formattedParent)->setNames($formattedNames); $response = $gapicClient->batchCancelPipelineJobsAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/AiPlatform/tests/Unit/V1/Client/PredictionServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/PredictionServiceClientTest.php index ee62251314c8..037cb7db22d2 100644 --- a/AiPlatform/tests/Unit/V1/Client/PredictionServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/PredictionServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return PredictionServiceClient */ @@ -103,8 +105,7 @@ public function directPredictTest() $transport->addResponse($expectedResponse); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new DirectPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new DirectPredictRequest())->setEndpoint($formattedEndpoint); $response = $gapicClient->directPredict($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -128,17 +129,19 @@ public function directPredictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new DirectPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new DirectPredictRequest())->setEndpoint($formattedEndpoint); try { $gapicClient->directPredict($request); // If the $gapicClient method call did not throw, fail the test @@ -167,8 +170,7 @@ public function directRawPredictTest() $transport->addResponse($expectedResponse); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new DirectRawPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new DirectRawPredictRequest())->setEndpoint($formattedEndpoint); $response = $gapicClient->directRawPredict($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -192,17 +194,19 @@ public function directRawPredictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new DirectRawPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new DirectRawPredictRequest())->setEndpoint($formattedEndpoint); try { $gapicClient->directRawPredict($request); // If the $gapicClient method call did not throw, fail the test @@ -232,9 +236,7 @@ public function explainTest() // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $instances = []; - $request = (new ExplainRequest()) - ->setEndpoint($formattedEndpoint) - ->setInstances($instances); + $request = (new ExplainRequest())->setEndpoint($formattedEndpoint)->setInstances($instances); $response = $gapicClient->explain($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -260,19 +262,20 @@ public function explainExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $instances = []; - $request = (new ExplainRequest()) - ->setEndpoint($formattedEndpoint) - ->setInstances($instances); + $request = (new ExplainRequest())->setEndpoint($formattedEndpoint)->setInstances($instances); try { $gapicClient->explain($request); // If the $gapicClient method call did not throw, fail the test @@ -300,9 +303,7 @@ public function generateContentTest() // Mock request $model = 'model104069929'; $contents = []; - $request = (new GenerateContentRequest()) - ->setModel($model) - ->setContents($contents); + $request = (new GenerateContentRequest())->setModel($model)->setContents($contents); $response = $gapicClient->generateContent($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -328,19 +329,20 @@ public function generateContentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $model = 'model104069929'; $contents = []; - $request = (new GenerateContentRequest()) - ->setModel($model) - ->setContents($contents); + $request = (new GenerateContentRequest())->setModel($model)->setContents($contents); try { $gapicClient->generateContent($request); // If the $gapicClient method call did not throw, fail the test @@ -376,9 +378,7 @@ public function predictTest() // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $instances = []; - $request = (new PredictRequest()) - ->setEndpoint($formattedEndpoint) - ->setInstances($instances); + $request = (new PredictRequest())->setEndpoint($formattedEndpoint)->setInstances($instances); $response = $gapicClient->predict($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -404,19 +404,20 @@ public function predictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); $instances = []; - $request = (new PredictRequest()) - ->setEndpoint($formattedEndpoint) - ->setInstances($instances); + $request = (new PredictRequest())->setEndpoint($formattedEndpoint)->setInstances($instances); try { $gapicClient->predict($request); // If the $gapicClient method call did not throw, fail the test @@ -447,8 +448,7 @@ public function rawPredictTest() $transport->addResponse($expectedResponse); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new RawPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new RawPredictRequest())->setEndpoint($formattedEndpoint); $response = $gapicClient->rawPredict($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -472,17 +472,19 @@ public function rawPredictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new RawPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new RawPredictRequest())->setEndpoint($formattedEndpoint); try { $gapicClient->rawPredict($request); // If the $gapicClient method call did not throw, fail the test @@ -513,8 +515,7 @@ public function serverStreamingPredictTest() $transport->addResponse($expectedResponse3); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new StreamingPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new StreamingPredictRequest())->setEndpoint($formattedEndpoint); $serverStream = $gapicClient->serverStreamingPredict($request); $this->assertInstanceOf(ServerStream::class, $serverStream); $responses = iterator_to_array($serverStream->readAll()); @@ -543,18 +544,20 @@ public function serverStreamingPredictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new StreamingPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new StreamingPredictRequest())->setEndpoint($formattedEndpoint); $serverStream = $gapicClient->serverStreamingPredict($request); $results = $serverStream->readAll(); try { @@ -600,10 +603,7 @@ public function streamDirectPredictTest() $bidi->write($request); $responses = []; $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); + $bidi->writeAll([$request2, $request3]); foreach ($bidi->closeWriteAndReadAll() as $response) { $responses[] = $response; } @@ -641,12 +641,15 @@ public function streamDirectPredictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); $bidi = $gapicClient->streamDirectPredict(); @@ -700,10 +703,7 @@ public function streamDirectRawPredictTest() $bidi->write($request); $responses = []; $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); + $bidi->writeAll([$request2, $request3]); foreach ($bidi->closeWriteAndReadAll() as $response) { $responses[] = $response; } @@ -741,12 +741,15 @@ public function streamDirectRawPredictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); $bidi = $gapicClient->streamDirectRawPredict(); @@ -782,9 +785,7 @@ public function streamGenerateContentTest() // Mock request $model = 'model104069929'; $contents = []; - $request = (new GenerateContentRequest()) - ->setModel($model) - ->setContents($contents); + $request = (new GenerateContentRequest())->setModel($model)->setContents($contents); $serverStream = $gapicClient->streamGenerateContent($request); $this->assertInstanceOf(ServerStream::class, $serverStream); $responses = iterator_to_array($serverStream->readAll()); @@ -815,20 +816,21 @@ public function streamGenerateContentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); // Mock request $model = 'model104069929'; $contents = []; - $request = (new GenerateContentRequest()) - ->setModel($model) - ->setContents($contents); + $request = (new GenerateContentRequest())->setModel($model)->setContents($contents); $serverStream = $gapicClient->streamGenerateContent($request); $results = $serverStream->readAll(); try { @@ -873,8 +875,7 @@ public function streamRawPredictTest() $transport->addResponse($expectedResponse3); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new StreamRawPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new StreamRawPredictRequest())->setEndpoint($formattedEndpoint); $serverStream = $gapicClient->streamRawPredict($request); $this->assertInstanceOf(ServerStream::class, $serverStream); $responses = iterator_to_array($serverStream->readAll()); @@ -903,18 +904,20 @@ public function streamRawPredictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new StreamRawPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new StreamRawPredictRequest())->setEndpoint($formattedEndpoint); $serverStream = $gapicClient->streamRawPredict($request); $results = $serverStream->readAll(); try { @@ -960,10 +963,7 @@ public function streamingPredictTest() $bidi->write($request); $responses = []; $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); + $bidi->writeAll([$request2, $request3]); foreach ($bidi->closeWriteAndReadAll() as $response) { $responses[] = $response; } @@ -1001,12 +1001,15 @@ public function streamingPredictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); $bidi = $gapicClient->streamingPredict(); @@ -1060,10 +1063,7 @@ public function streamingRawPredictTest() $bidi->write($request); $responses = []; $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); + $bidi->writeAll([$request2, $request3]); foreach ($bidi->closeWriteAndReadAll() as $response) { $responses[] = $response; } @@ -1101,12 +1101,15 @@ public function streamingRawPredictExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); $bidi = $gapicClient->streamingRawPredict(); @@ -1163,12 +1166,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1195,9 +1201,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1227,12 +1231,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1265,8 +1272,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1290,17 +1296,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1332,9 +1340,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1360,19 +1366,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1400,9 +1407,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1428,19 +1433,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1467,8 +1473,7 @@ public function directPredictAsyncTest() $transport->addResponse($expectedResponse); // Mock request $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = (new DirectPredictRequest()) - ->setEndpoint($formattedEndpoint); + $request = (new DirectPredictRequest())->setEndpoint($formattedEndpoint); $response = $gapicClient->directPredictAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/AiPlatform/tests/Unit/V1/Client/ScheduleServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/ScheduleServiceClientTest.php index 2f535f076c9a..9da175606c68 100644 --- a/AiPlatform/tests/Unit/V1/Client/ScheduleServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/ScheduleServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ScheduleServiceClient */ @@ -116,9 +118,7 @@ public function createScheduleTest() $schedule->setDisplayName($scheduleDisplayName); $scheduleMaxConcurrentRunCount = 423065016; $schedule->setMaxConcurrentRunCount($scheduleMaxConcurrentRunCount); - $request = (new CreateScheduleRequest()) - ->setParent($formattedParent) - ->setSchedule($schedule); + $request = (new CreateScheduleRequest())->setParent($formattedParent)->setSchedule($schedule); $response = $gapicClient->createSchedule($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -144,12 +144,15 @@ public function createScheduleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -158,9 +161,7 @@ public function createScheduleExceptionTest() $schedule->setDisplayName($scheduleDisplayName); $scheduleMaxConcurrentRunCount = 423065016; $schedule->setMaxConcurrentRunCount($scheduleMaxConcurrentRunCount); - $request = (new CreateScheduleRequest()) - ->setParent($formattedParent) - ->setSchedule($schedule); + $request = (new CreateScheduleRequest())->setParent($formattedParent)->setSchedule($schedule); try { $gapicClient->createSchedule($request); // If the $gapicClient method call did not throw, fail the test @@ -205,8 +206,7 @@ public function deleteScheduleTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $request = (new DeleteScheduleRequest()) - ->setName($formattedName); + $request = (new DeleteScheduleRequest())->setName($formattedName); $response = $gapicClient->deleteSchedule($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -262,17 +262,19 @@ public function deleteScheduleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $request = (new DeleteScheduleRequest()) - ->setName($formattedName); + $request = (new DeleteScheduleRequest())->setName($formattedName); $response = $gapicClient->deleteSchedule($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -324,8 +326,7 @@ public function getScheduleTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $request = (new GetScheduleRequest()) - ->setName($formattedName); + $request = (new GetScheduleRequest())->setName($formattedName); $response = $gapicClient->getSchedule($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -349,17 +350,19 @@ public function getScheduleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $request = (new GetScheduleRequest()) - ->setName($formattedName); + $request = (new GetScheduleRequest())->setName($formattedName); try { $gapicClient->getSchedule($request); // If the $gapicClient method call did not throw, fail the test @@ -384,17 +387,14 @@ public function listSchedulesTest() // Mock response $nextPageToken = ''; $schedulesElement = new Schedule(); - $schedules = [ - $schedulesElement, - ]; + $schedules = [$schedulesElement]; $expectedResponse = new ListSchedulesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setSchedules($schedules); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListSchedulesRequest()) - ->setParent($formattedParent); + $request = (new ListSchedulesRequest())->setParent($formattedParent); $response = $gapicClient->listSchedules($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -421,17 +421,19 @@ public function listSchedulesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListSchedulesRequest()) - ->setParent($formattedParent); + $request = (new ListSchedulesRequest())->setParent($formattedParent); try { $gapicClient->listSchedules($request); // If the $gapicClient method call did not throw, fail the test @@ -458,8 +460,7 @@ public function pauseScheduleTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $request = (new PauseScheduleRequest()) - ->setName($formattedName); + $request = (new PauseScheduleRequest())->setName($formattedName); $gapicClient->pauseSchedule($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -482,17 +483,19 @@ public function pauseScheduleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $request = (new PauseScheduleRequest()) - ->setName($formattedName); + $request = (new PauseScheduleRequest())->setName($formattedName); try { $gapicClient->pauseSchedule($request); // If the $gapicClient method call did not throw, fail the test @@ -519,8 +522,7 @@ public function resumeScheduleTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $request = (new ResumeScheduleRequest()) - ->setName($formattedName); + $request = (new ResumeScheduleRequest())->setName($formattedName); $gapicClient->resumeSchedule($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -543,17 +545,19 @@ public function resumeScheduleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $request = (new ResumeScheduleRequest()) - ->setName($formattedName); + $request = (new ResumeScheduleRequest())->setName($formattedName); try { $gapicClient->resumeSchedule($request); // If the $gapicClient method call did not throw, fail the test @@ -601,9 +605,7 @@ public function updateScheduleTest() $scheduleMaxConcurrentRunCount = 423065016; $schedule->setMaxConcurrentRunCount($scheduleMaxConcurrentRunCount); $updateMask = new FieldMask(); - $request = (new UpdateScheduleRequest()) - ->setSchedule($schedule) - ->setUpdateMask($updateMask); + $request = (new UpdateScheduleRequest())->setSchedule($schedule)->setUpdateMask($updateMask); $response = $gapicClient->updateSchedule($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -629,12 +631,15 @@ public function updateScheduleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $schedule = new Schedule(); @@ -643,9 +648,7 @@ public function updateScheduleExceptionTest() $scheduleMaxConcurrentRunCount = 423065016; $schedule->setMaxConcurrentRunCount($scheduleMaxConcurrentRunCount); $updateMask = new FieldMask(); - $request = (new UpdateScheduleRequest()) - ->setSchedule($schedule) - ->setUpdateMask($updateMask); + $request = (new UpdateScheduleRequest())->setSchedule($schedule)->setUpdateMask($updateMask); try { $gapicClient->updateSchedule($request); // If the $gapicClient method call did not throw, fail the test @@ -698,12 +701,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -730,9 +736,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -762,12 +766,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -800,8 +807,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -825,17 +831,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -867,9 +875,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -895,19 +901,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -935,9 +942,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -963,19 +968,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1023,9 +1029,7 @@ public function createScheduleAsyncTest() $schedule->setDisplayName($scheduleDisplayName); $scheduleMaxConcurrentRunCount = 423065016; $schedule->setMaxConcurrentRunCount($scheduleMaxConcurrentRunCount); - $request = (new CreateScheduleRequest()) - ->setParent($formattedParent) - ->setSchedule($schedule); + $request = (new CreateScheduleRequest())->setParent($formattedParent)->setSchedule($schedule); $response = $gapicClient->createScheduleAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/AiPlatform/tests/Unit/V1/Client/SpecialistPoolServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/SpecialistPoolServiceClientTest.php index 807351f28fa1..1a2d5efe5a48 100644 --- a/AiPlatform/tests/Unit/V1/Client/SpecialistPoolServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/SpecialistPoolServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return SpecialistPoolServiceClient */ @@ -122,9 +124,7 @@ public function createSpecialistPoolTest() $specialistPool->setName($specialistPoolName); $specialistPoolDisplayName = 'specialistPoolDisplayName703175488'; $specialistPool->setDisplayName($specialistPoolDisplayName); - $request = (new CreateSpecialistPoolRequest()) - ->setParent($formattedParent) - ->setSpecialistPool($specialistPool); + $request = (new CreateSpecialistPoolRequest())->setParent($formattedParent)->setSpecialistPool($specialistPool); $response = $gapicClient->createSpecialistPool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -182,12 +182,15 @@ public function createSpecialistPoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -196,9 +199,7 @@ public function createSpecialistPoolExceptionTest() $specialistPool->setName($specialistPoolName); $specialistPoolDisplayName = 'specialistPoolDisplayName703175488'; $specialistPool->setDisplayName($specialistPoolDisplayName); - $request = (new CreateSpecialistPoolRequest()) - ->setParent($formattedParent) - ->setSpecialistPool($specialistPool); + $request = (new CreateSpecialistPoolRequest())->setParent($formattedParent)->setSpecialistPool($specialistPool); $response = $gapicClient->createSpecialistPool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -252,8 +253,7 @@ public function deleteSpecialistPoolTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - $request = (new DeleteSpecialistPoolRequest()) - ->setName($formattedName); + $request = (new DeleteSpecialistPoolRequest())->setName($formattedName); $response = $gapicClient->deleteSpecialistPool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -309,17 +309,19 @@ public function deleteSpecialistPoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - $request = (new DeleteSpecialistPoolRequest()) - ->setName($formattedName); + $request = (new DeleteSpecialistPoolRequest())->setName($formattedName); $response = $gapicClient->deleteSpecialistPool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -361,8 +363,7 @@ public function getSpecialistPoolTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - $request = (new GetSpecialistPoolRequest()) - ->setName($formattedName); + $request = (new GetSpecialistPoolRequest())->setName($formattedName); $response = $gapicClient->getSpecialistPool($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -386,17 +387,19 @@ public function getSpecialistPoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - $request = (new GetSpecialistPoolRequest()) - ->setName($formattedName); + $request = (new GetSpecialistPoolRequest())->setName($formattedName); try { $gapicClient->getSpecialistPool($request); // If the $gapicClient method call did not throw, fail the test @@ -421,17 +424,14 @@ public function listSpecialistPoolsTest() // Mock response $nextPageToken = ''; $specialistPoolsElement = new SpecialistPool(); - $specialistPools = [ - $specialistPoolsElement, - ]; + $specialistPools = [$specialistPoolsElement]; $expectedResponse = new ListSpecialistPoolsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setSpecialistPools($specialistPools); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListSpecialistPoolsRequest()) - ->setParent($formattedParent); + $request = (new ListSpecialistPoolsRequest())->setParent($formattedParent); $response = $gapicClient->listSpecialistPools($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -458,17 +458,19 @@ public function listSpecialistPoolsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListSpecialistPoolsRequest()) - ->setParent($formattedParent); + $request = (new ListSpecialistPoolsRequest())->setParent($formattedParent); try { $gapicClient->listSpecialistPools($request); // If the $gapicClient method call did not throw, fail the test @@ -524,9 +526,7 @@ public function updateSpecialistPoolTest() $specialistPoolDisplayName = 'specialistPoolDisplayName703175488'; $specialistPool->setDisplayName($specialistPoolDisplayName); $updateMask = new FieldMask(); - $request = (new UpdateSpecialistPoolRequest()) - ->setSpecialistPool($specialistPool) - ->setUpdateMask($updateMask); + $request = (new UpdateSpecialistPoolRequest())->setSpecialistPool($specialistPool)->setUpdateMask($updateMask); $response = $gapicClient->updateSpecialistPool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -584,12 +584,15 @@ public function updateSpecialistPoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $specialistPool = new SpecialistPool(); @@ -598,9 +601,7 @@ public function updateSpecialistPoolExceptionTest() $specialistPoolDisplayName = 'specialistPoolDisplayName703175488'; $specialistPool->setDisplayName($specialistPoolDisplayName); $updateMask = new FieldMask(); - $request = (new UpdateSpecialistPoolRequest()) - ->setSpecialistPool($specialistPool) - ->setUpdateMask($updateMask); + $request = (new UpdateSpecialistPoolRequest())->setSpecialistPool($specialistPool)->setUpdateMask($updateMask); $response = $gapicClient->updateSpecialistPool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -662,12 +663,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -694,9 +698,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -726,12 +728,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -764,8 +769,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -789,17 +793,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -831,9 +837,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -859,19 +863,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -899,9 +904,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -927,19 +930,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -995,9 +999,7 @@ public function createSpecialistPoolAsyncTest() $specialistPool->setName($specialistPoolName); $specialistPoolDisplayName = 'specialistPoolDisplayName703175488'; $specialistPool->setDisplayName($specialistPoolDisplayName); - $request = (new CreateSpecialistPoolRequest()) - ->setParent($formattedParent) - ->setSpecialistPool($specialistPool); + $request = (new CreateSpecialistPoolRequest())->setParent($formattedParent)->setSpecialistPool($specialistPool); $response = $gapicClient->createSpecialistPoolAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/AiPlatform/tests/Unit/V1/Client/TensorboardServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/TensorboardServiceClientTest.php index e61a543c3f95..c12487cf37cb 100644 --- a/AiPlatform/tests/Unit/V1/Client/TensorboardServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/TensorboardServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TensorboardServiceClient */ @@ -136,11 +138,14 @@ public function batchCreateTensorboardRunsTest() $expectedResponse = new BatchCreateTensorboardRunsResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); + $formattedParent = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); $requests = []; - $request = (new BatchCreateTensorboardRunsRequest()) - ->setParent($formattedParent) - ->setRequests($requests); + $request = (new BatchCreateTensorboardRunsRequest())->setParent($formattedParent)->setRequests($requests); $response = $gapicClient->batchCreateTensorboardRuns($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -166,19 +171,25 @@ public function batchCreateTensorboardRunsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); + $formattedParent = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); $requests = []; - $request = (new BatchCreateTensorboardRunsRequest()) - ->setParent($formattedParent) - ->setRequests($requests); + $request = (new BatchCreateTensorboardRunsRequest())->setParent($formattedParent)->setRequests($requests); try { $gapicClient->batchCreateTensorboardRuns($request); // If the $gapicClient method call did not throw, fail the test @@ -204,18 +215,24 @@ public function batchCreateTensorboardTimeSeriesTest() $expectedResponse = new BatchCreateTensorboardTimeSeriesResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); + $formattedParent = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); $requests = []; - $request = (new BatchCreateTensorboardTimeSeriesRequest()) - ->setParent($formattedParent) - ->setRequests($requests); + $request = (new BatchCreateTensorboardTimeSeriesRequest())->setParent($formattedParent)->setRequests($requests); $response = $gapicClient->batchCreateTensorboardTimeSeries($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardTimeSeries', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardTimeSeries', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getRequests(); @@ -234,19 +251,25 @@ public function batchCreateTensorboardTimeSeriesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); + $formattedParent = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); $requests = []; - $request = (new BatchCreateTensorboardTimeSeriesRequest()) - ->setParent($formattedParent) - ->setRequests($requests); + $request = (new BatchCreateTensorboardTimeSeriesRequest())->setParent($formattedParent)->setRequests($requests); try { $gapicClient->batchCreateTensorboardTimeSeries($request); // If the $gapicClient method call did not throw, fail the test @@ -274,7 +297,14 @@ public function batchReadTensorboardTimeSeriesDataTest() // Mock request $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); $formattedTimeSeries = [ - $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'), + $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ), ]; $request = (new BatchReadTensorboardTimeSeriesDataRequest()) ->setTensorboard($formattedTensorboard) @@ -285,7 +315,10 @@ public function batchReadTensorboardTimeSeriesDataTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/BatchReadTensorboardTimeSeriesData', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/BatchReadTensorboardTimeSeriesData', + $actualFuncCall + ); $actualValue = $actualRequestObject->getTensorboard(); $this->assertProtobufEquals($formattedTensorboard, $actualValue); $actualValue = $actualRequestObject->getTimeSeries(); @@ -304,17 +337,27 @@ public function batchReadTensorboardTimeSeriesDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); $formattedTimeSeries = [ - $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'), + $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ), ]; $request = (new BatchReadTensorboardTimeSeriesDataRequest()) ->setTensorboard($formattedTensorboard) @@ -380,9 +423,7 @@ public function createTensorboardTest() $tensorboard = new Tensorboard(); $tensorboardDisplayName = 'tensorboardDisplayName-448676352'; $tensorboard->setDisplayName($tensorboardDisplayName); - $request = (new CreateTensorboardRequest()) - ->setParent($formattedParent) - ->setTensorboard($tensorboard); + $request = (new CreateTensorboardRequest())->setParent($formattedParent)->setTensorboard($tensorboard); $response = $gapicClient->createTensorboard($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -440,21 +481,22 @@ public function createTensorboardExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); $tensorboard = new Tensorboard(); $tensorboardDisplayName = 'tensorboardDisplayName-448676352'; $tensorboard->setDisplayName($tensorboardDisplayName); - $request = (new CreateTensorboardRequest()) - ->setParent($formattedParent) - ->setTensorboard($tensorboard); + $request = (new CreateTensorboardRequest())->setParent($formattedParent)->setTensorboard($tensorboard); $response = $gapicClient->createTensorboard($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -499,7 +541,12 @@ public function createTensorboardExperimentTest() $expectedResponse->setSource($source); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); + $formattedParent = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); $tensorboardExperimentId = 'tensorboardExperimentId932137483'; $request = (new CreateTensorboardExperimentRequest()) ->setParent($formattedParent) @@ -510,7 +557,10 @@ public function createTensorboardExperimentTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardExperiment', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardExperiment', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getTensorboardExperimentId(); @@ -529,15 +579,23 @@ public function createTensorboardExperimentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); + $formattedParent = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); $tensorboardExperimentId = 'tensorboardExperimentId932137483'; $request = (new CreateTensorboardExperimentRequest()) ->setParent($formattedParent) @@ -575,7 +633,13 @@ public function createTensorboardRunTest() $expectedResponse->setEtag($etag); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); + $formattedParent = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); $tensorboardRun = new TensorboardRun(); $tensorboardRunDisplayName = 'tensorboardRunDisplayName-996156817'; $tensorboardRun->setDisplayName($tensorboardRunDisplayName); @@ -611,15 +675,24 @@ public function createTensorboardRunExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); + $formattedParent = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); $tensorboardRun = new TensorboardRun(); $tensorboardRunDisplayName = 'tensorboardRunDisplayName-996156817'; $tensorboardRun->setDisplayName($tensorboardRunDisplayName); @@ -665,7 +738,14 @@ public function createTensorboardTimeSeriesTest() $expectedResponse->setPluginData($pluginData); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); + $formattedParent = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); $tensorboardTimeSeries = new TensorboardTimeSeries(); $tensorboardTimeSeriesDisplayName = 'tensorboardTimeSeriesDisplayName1084140540'; $tensorboardTimeSeries->setDisplayName($tensorboardTimeSeriesDisplayName); @@ -680,7 +760,10 @@ public function createTensorboardTimeSeriesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardTimeSeries', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardTimeSeries', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getTensorboardTimeSeries(); @@ -699,15 +782,25 @@ public function createTensorboardTimeSeriesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); + $formattedParent = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); $tensorboardTimeSeries = new TensorboardTimeSeries(); $tensorboardTimeSeriesDisplayName = 'tensorboardTimeSeriesDisplayName1084140540'; $tensorboardTimeSeries->setDisplayName($tensorboardTimeSeriesDisplayName); @@ -760,8 +853,7 @@ public function deleteTensorboardTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new DeleteTensorboardRequest()) - ->setName($formattedName); + $request = (new DeleteTensorboardRequest())->setName($formattedName); $response = $gapicClient->deleteTensorboard($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -817,17 +909,19 @@ public function deleteTensorboardExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new DeleteTensorboardRequest()) - ->setName($formattedName); + $request = (new DeleteTensorboardRequest())->setName($formattedName); $response = $gapicClient->deleteTensorboard($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -880,9 +974,13 @@ public function deleteTensorboardExperimentTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $request = (new DeleteTensorboardExperimentRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); + $request = (new DeleteTensorboardExperimentRequest())->setName($formattedName); $response = $gapicClient->deleteTensorboardExperiment($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -892,7 +990,10 @@ public function deleteTensorboardExperimentTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardExperiment', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardExperiment', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -938,17 +1039,24 @@ public function deleteTensorboardExperimentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $request = (new DeleteTensorboardExperimentRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); + $request = (new DeleteTensorboardExperimentRequest())->setName($formattedName); $response = $gapicClient->deleteTensorboardExperiment($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1001,9 +1109,14 @@ public function deleteTensorboardRunTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $request = (new DeleteTensorboardRunRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); + $request = (new DeleteTensorboardRunRequest())->setName($formattedName); $response = $gapicClient->deleteTensorboardRun($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1059,17 +1172,25 @@ public function deleteTensorboardRunExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $request = (new DeleteTensorboardRunRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); + $request = (new DeleteTensorboardRunRequest())->setName($formattedName); $response = $gapicClient->deleteTensorboardRun($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1122,9 +1243,15 @@ public function deleteTensorboardTimeSeriesTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new DeleteTensorboardTimeSeriesRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new DeleteTensorboardTimeSeriesRequest())->setName($formattedName); $response = $gapicClient->deleteTensorboardTimeSeries($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1134,7 +1261,10 @@ public function deleteTensorboardTimeSeriesTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardTimeSeries', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardTimeSeries', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -1180,17 +1310,26 @@ public function deleteTensorboardTimeSeriesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new DeleteTensorboardTimeSeriesRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new DeleteTensorboardTimeSeriesRequest())->setName($formattedName); $response = $gapicClient->deleteTensorboardTimeSeries($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1224,17 +1363,23 @@ public function exportTensorboardTimeSeriesDataTest() // Mock response $nextPageToken = ''; $timeSeriesDataPointsElement = new TimeSeriesDataPoint(); - $timeSeriesDataPoints = [ - $timeSeriesDataPointsElement, - ]; + $timeSeriesDataPoints = [$timeSeriesDataPointsElement]; $expectedResponse = new ExportTensorboardTimeSeriesDataResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTimeSeriesDataPoints($timeSeriesDataPoints); $transport->addResponse($expectedResponse); // Mock request - $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new ExportTensorboardTimeSeriesDataRequest()) - ->setTensorboardTimeSeries($formattedTensorboardTimeSeries); + $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new ExportTensorboardTimeSeriesDataRequest())->setTensorboardTimeSeries( + $formattedTensorboardTimeSeries + ); $response = $gapicClient->exportTensorboardTimeSeriesData($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1244,7 +1389,10 @@ public function exportTensorboardTimeSeriesDataTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ExportTensorboardTimeSeriesData', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/ExportTensorboardTimeSeriesData', + $actualFuncCall + ); $actualValue = $actualRequestObject->getTensorboardTimeSeries(); $this->assertProtobufEquals($formattedTensorboardTimeSeries, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -1261,17 +1409,28 @@ public function exportTensorboardTimeSeriesDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new ExportTensorboardTimeSeriesDataRequest()) - ->setTensorboardTimeSeries($formattedTensorboardTimeSeries); + $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new ExportTensorboardTimeSeriesDataRequest())->setTensorboardTimeSeries( + $formattedTensorboardTimeSeries + ); try { $gapicClient->exportTensorboardTimeSeriesData($request); // If the $gapicClient method call did not throw, fail the test @@ -1312,8 +1471,7 @@ public function getTensorboardTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new GetTensorboardRequest()) - ->setName($formattedName); + $request = (new GetTensorboardRequest())->setName($formattedName); $response = $gapicClient->getTensorboard($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1337,17 +1495,19 @@ public function getTensorboardExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new GetTensorboardRequest()) - ->setName($formattedName); + $request = (new GetTensorboardRequest())->setName($formattedName); try { $gapicClient->getTensorboard($request); // If the $gapicClient method call did not throw, fail the test @@ -1383,9 +1543,13 @@ public function getTensorboardExperimentTest() $expectedResponse->setSource($source); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $request = (new GetTensorboardExperimentRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); + $request = (new GetTensorboardExperimentRequest())->setName($formattedName); $response = $gapicClient->getTensorboardExperiment($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1409,17 +1573,24 @@ public function getTensorboardExperimentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $request = (new GetTensorboardExperimentRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); + $request = (new GetTensorboardExperimentRequest())->setName($formattedName); try { $gapicClient->getTensorboardExperiment($request); // If the $gapicClient method call did not throw, fail the test @@ -1453,9 +1624,14 @@ public function getTensorboardRunTest() $expectedResponse->setEtag($etag); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $request = (new GetTensorboardRunRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); + $request = (new GetTensorboardRunRequest())->setName($formattedName); $response = $gapicClient->getTensorboardRun($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1479,17 +1655,25 @@ public function getTensorboardRunExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $request = (new GetTensorboardRunRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); + $request = (new GetTensorboardRunRequest())->setName($formattedName); try { $gapicClient->getTensorboardRun($request); // If the $gapicClient method call did not throw, fail the test @@ -1527,9 +1711,15 @@ public function getTensorboardTimeSeriesTest() $expectedResponse->setPluginData($pluginData); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new GetTensorboardTimeSeriesRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new GetTensorboardTimeSeriesRequest())->setName($formattedName); $response = $gapicClient->getTensorboardTimeSeries($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1553,17 +1743,26 @@ public function getTensorboardTimeSeriesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new GetTensorboardTimeSeriesRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new GetTensorboardTimeSeriesRequest())->setName($formattedName); try { $gapicClient->getTensorboardTimeSeries($request); // If the $gapicClient method call did not throw, fail the test @@ -1588,17 +1787,14 @@ public function listTensorboardExperimentsTest() // Mock response $nextPageToken = ''; $tensorboardExperimentsElement = new TensorboardExperiment(); - $tensorboardExperiments = [ - $tensorboardExperimentsElement, - ]; + $tensorboardExperiments = [$tensorboardExperimentsElement]; $expectedResponse = new ListTensorboardExperimentsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTensorboardExperiments($tensorboardExperiments); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new ListTensorboardExperimentsRequest()) - ->setParent($formattedParent); + $request = (new ListTensorboardExperimentsRequest())->setParent($formattedParent); $response = $gapicClient->listTensorboardExperiments($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1625,17 +1821,19 @@ public function listTensorboardExperimentsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new ListTensorboardExperimentsRequest()) - ->setParent($formattedParent); + $request = (new ListTensorboardExperimentsRequest())->setParent($formattedParent); try { $gapicClient->listTensorboardExperiments($request); // If the $gapicClient method call did not throw, fail the test @@ -1660,17 +1858,19 @@ public function listTensorboardRunsTest() // Mock response $nextPageToken = ''; $tensorboardRunsElement = new TensorboardRun(); - $tensorboardRuns = [ - $tensorboardRunsElement, - ]; + $tensorboardRuns = [$tensorboardRunsElement]; $expectedResponse = new ListTensorboardRunsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTensorboardRuns($tensorboardRuns); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $request = (new ListTensorboardRunsRequest()) - ->setParent($formattedParent); + $formattedParent = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); + $request = (new ListTensorboardRunsRequest())->setParent($formattedParent); $response = $gapicClient->listTensorboardRuns($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1697,17 +1897,24 @@ public function listTensorboardRunsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $request = (new ListTensorboardRunsRequest()) - ->setParent($formattedParent); + $formattedParent = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); + $request = (new ListTensorboardRunsRequest())->setParent($formattedParent); try { $gapicClient->listTensorboardRuns($request); // If the $gapicClient method call did not throw, fail the test @@ -1732,17 +1939,20 @@ public function listTensorboardTimeSeriesTest() // Mock response $nextPageToken = ''; $tensorboardTimeSeriesElement = new TensorboardTimeSeries(); - $tensorboardTimeSeries = [ - $tensorboardTimeSeriesElement, - ]; + $tensorboardTimeSeries = [$tensorboardTimeSeriesElement]; $expectedResponse = new ListTensorboardTimeSeriesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTensorboardTimeSeries($tensorboardTimeSeries); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $request = (new ListTensorboardTimeSeriesRequest()) - ->setParent($formattedParent); + $formattedParent = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); + $request = (new ListTensorboardTimeSeriesRequest())->setParent($formattedParent); $response = $gapicClient->listTensorboardTimeSeries($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1769,17 +1979,25 @@ public function listTensorboardTimeSeriesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $request = (new ListTensorboardTimeSeriesRequest()) - ->setParent($formattedParent); + $formattedParent = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); + $request = (new ListTensorboardTimeSeriesRequest())->setParent($formattedParent); try { $gapicClient->listTensorboardTimeSeries($request); // If the $gapicClient method call did not throw, fail the test @@ -1804,17 +2022,14 @@ public function listTensorboardsTest() // Mock response $nextPageToken = ''; $tensorboardsElement = new Tensorboard(); - $tensorboards = [ - $tensorboardsElement, - ]; + $tensorboards = [$tensorboardsElement]; $expectedResponse = new ListTensorboardsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTensorboards($tensorboards); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListTensorboardsRequest()) - ->setParent($formattedParent); + $request = (new ListTensorboardsRequest())->setParent($formattedParent); $response = $gapicClient->listTensorboards($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1841,17 +2056,19 @@ public function listTensorboardsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListTensorboardsRequest()) - ->setParent($formattedParent); + $request = (new ListTensorboardsRequest())->setParent($formattedParent); try { $gapicClient->listTensorboards($request); // If the $gapicClient method call did not throw, fail the test @@ -1881,9 +2098,15 @@ public function readTensorboardBlobDataTest() $expectedResponse3 = new ReadTensorboardBlobDataResponse(); $transport->addResponse($expectedResponse3); // Mock request - $formattedTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new ReadTensorboardBlobDataRequest()) - ->setTimeSeries($formattedTimeSeries); + $formattedTimeSeries = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new ReadTensorboardBlobDataRequest())->setTimeSeries($formattedTimeSeries); $serverStream = $gapicClient->readTensorboardBlobData($request); $this->assertInstanceOf(ServerStream::class, $serverStream); $responses = iterator_to_array($serverStream->readAll()); @@ -1912,18 +2135,27 @@ public function readTensorboardBlobDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); // Mock request - $formattedTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new ReadTensorboardBlobDataRequest()) - ->setTimeSeries($formattedTimeSeries); + $formattedTimeSeries = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new ReadTensorboardBlobDataRequest())->setTimeSeries($formattedTimeSeries); $serverStream = $gapicClient->readTensorboardBlobData($request); $results = $serverStream->readAll(); try { @@ -1954,8 +2186,7 @@ public function readTensorboardSizeTest() $transport->addResponse($expectedResponse); // Mock request $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new ReadTensorboardSizeRequest()) - ->setTensorboard($formattedTensorboard); + $request = (new ReadTensorboardSizeRequest())->setTensorboard($formattedTensorboard); $response = $gapicClient->readTensorboardSize($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1979,17 +2210,19 @@ public function readTensorboardSizeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new ReadTensorboardSizeRequest()) - ->setTensorboard($formattedTensorboard); + $request = (new ReadTensorboardSizeRequest())->setTensorboard($formattedTensorboard); try { $gapicClient->readTensorboardSize($request); // If the $gapicClient method call did not throw, fail the test @@ -2015,16 +2248,27 @@ public function readTensorboardTimeSeriesDataTest() $expectedResponse = new ReadTensorboardTimeSeriesDataResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new ReadTensorboardTimeSeriesDataRequest()) - ->setTensorboardTimeSeries($formattedTensorboardTimeSeries); + $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new ReadTensorboardTimeSeriesDataRequest())->setTensorboardTimeSeries( + $formattedTensorboardTimeSeries + ); $response = $gapicClient->readTensorboardTimeSeriesData($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardTimeSeriesData', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardTimeSeriesData', + $actualFuncCall + ); $actualValue = $actualRequestObject->getTensorboardTimeSeries(); $this->assertProtobufEquals($formattedTensorboardTimeSeries, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -2041,17 +2285,28 @@ public function readTensorboardTimeSeriesDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $request = (new ReadTensorboardTimeSeriesDataRequest()) - ->setTensorboardTimeSeries($formattedTensorboardTimeSeries); + $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]', + '[TIME_SERIES]' + ); + $request = (new ReadTensorboardTimeSeriesDataRequest())->setTensorboardTimeSeries( + $formattedTensorboardTimeSeries + ); try { $gapicClient->readTensorboardTimeSeriesData($request); // If the $gapicClient method call did not throw, fail the test @@ -2078,8 +2333,7 @@ public function readTensorboardUsageTest() $transport->addResponse($expectedResponse); // Mock request $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new ReadTensorboardUsageRequest()) - ->setTensorboard($formattedTensorboard); + $request = (new ReadTensorboardUsageRequest())->setTensorboard($formattedTensorboard); $response = $gapicClient->readTensorboardUsage($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2103,17 +2357,19 @@ public function readTensorboardUsageExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $request = (new ReadTensorboardUsageRequest()) - ->setTensorboard($formattedTensorboard); + $request = (new ReadTensorboardUsageRequest())->setTensorboard($formattedTensorboard); try { $gapicClient->readTensorboardUsage($request); // If the $gapicClient method call did not throw, fail the test @@ -2175,9 +2431,7 @@ public function updateTensorboardTest() $tensorboard = new Tensorboard(); $tensorboardDisplayName = 'tensorboardDisplayName-448676352'; $tensorboard->setDisplayName($tensorboardDisplayName); - $request = (new UpdateTensorboardRequest()) - ->setUpdateMask($updateMask) - ->setTensorboard($tensorboard); + $request = (new UpdateTensorboardRequest())->setUpdateMask($updateMask)->setTensorboard($tensorboard); $response = $gapicClient->updateTensorboard($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2235,21 +2489,22 @@ public function updateTensorboardExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $updateMask = new FieldMask(); $tensorboard = new Tensorboard(); $tensorboardDisplayName = 'tensorboardDisplayName-448676352'; $tensorboard->setDisplayName($tensorboardDisplayName); - $request = (new UpdateTensorboardRequest()) - ->setUpdateMask($updateMask) - ->setTensorboard($tensorboard); + $request = (new UpdateTensorboardRequest())->setUpdateMask($updateMask)->setTensorboard($tensorboard); $response = $gapicClient->updateTensorboard($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2305,7 +2560,10 @@ public function updateTensorboardExperimentTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardExperiment', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardExperiment', + $actualFuncCall + ); $actualValue = $actualRequestObject->getUpdateMask(); $this->assertProtobufEquals($updateMask, $actualValue); $actualValue = $actualRequestObject->getTensorboardExperiment(); @@ -2324,12 +2582,15 @@ public function updateTensorboardExperimentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $updateMask = new FieldMask(); @@ -2374,9 +2635,7 @@ public function updateTensorboardRunTest() $tensorboardRun = new TensorboardRun(); $tensorboardRunDisplayName = 'tensorboardRunDisplayName-996156817'; $tensorboardRun->setDisplayName($tensorboardRunDisplayName); - $request = (new UpdateTensorboardRunRequest()) - ->setUpdateMask($updateMask) - ->setTensorboardRun($tensorboardRun); + $request = (new UpdateTensorboardRunRequest())->setUpdateMask($updateMask)->setTensorboardRun($tensorboardRun); $response = $gapicClient->updateTensorboardRun($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2402,21 +2661,22 @@ public function updateTensorboardRunExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $updateMask = new FieldMask(); $tensorboardRun = new TensorboardRun(); $tensorboardRunDisplayName = 'tensorboardRunDisplayName-996156817'; $tensorboardRun->setDisplayName($tensorboardRunDisplayName); - $request = (new UpdateTensorboardRunRequest()) - ->setUpdateMask($updateMask) - ->setTensorboardRun($tensorboardRun); + $request = (new UpdateTensorboardRunRequest())->setUpdateMask($updateMask)->setTensorboardRun($tensorboardRun); try { $gapicClient->updateTensorboardRun($request); // If the $gapicClient method call did not throw, fail the test @@ -2469,7 +2729,10 @@ public function updateTensorboardTimeSeriesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardTimeSeries', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardTimeSeries', + $actualFuncCall + ); $actualValue = $actualRequestObject->getUpdateMask(); $this->assertProtobufEquals($updateMask, $actualValue); $actualValue = $actualRequestObject->getTensorboardTimeSeries(); @@ -2488,12 +2751,15 @@ public function updateTensorboardTimeSeriesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $updateMask = new FieldMask(); @@ -2530,7 +2796,12 @@ public function writeTensorboardExperimentDataTest() $expectedResponse = new WriteTensorboardExperimentDataResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedTensorboardExperiment = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); + $formattedTensorboardExperiment = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); $writeRunDataRequests = []; $request = (new WriteTensorboardExperimentDataRequest()) ->setTensorboardExperiment($formattedTensorboardExperiment) @@ -2541,7 +2812,10 @@ public function writeTensorboardExperimentDataTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardExperimentData', $actualFuncCall); + $this->assertSame( + '/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardExperimentData', + $actualFuncCall + ); $actualValue = $actualRequestObject->getTensorboardExperiment(); $this->assertProtobufEquals($formattedTensorboardExperiment, $actualValue); $actualValue = $actualRequestObject->getWriteRunDataRequests(); @@ -2560,15 +2834,23 @@ public function writeTensorboardExperimentDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedTensorboardExperiment = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); + $formattedTensorboardExperiment = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); $writeRunDataRequests = []; $request = (new WriteTensorboardExperimentDataRequest()) ->setTensorboardExperiment($formattedTensorboardExperiment) @@ -2598,7 +2880,13 @@ public function writeTensorboardRunDataTest() $expectedResponse = new WriteTensorboardRunDataResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedTensorboardRun = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); + $formattedTensorboardRun = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); $timeSeriesData = []; $request = (new WriteTensorboardRunDataRequest()) ->setTensorboardRun($formattedTensorboardRun) @@ -2628,15 +2916,24 @@ public function writeTensorboardRunDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedTensorboardRun = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); + $formattedTensorboardRun = $gapicClient->tensorboardRunName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]', + '[RUN]' + ); $timeSeriesData = []; $request = (new WriteTensorboardRunDataRequest()) ->setTensorboardRun($formattedTensorboardRun) @@ -2693,12 +2990,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -2725,9 +3025,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -2757,12 +3055,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -2795,8 +3096,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2820,17 +3120,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -2862,9 +3164,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2890,19 +3190,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -2930,9 +3231,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2958,19 +3257,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -2996,11 +3296,14 @@ public function batchCreateTensorboardRunsAsyncTest() $expectedResponse = new BatchCreateTensorboardRunsResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); + $formattedParent = $gapicClient->tensorboardExperimentName( + '[PROJECT]', + '[LOCATION]', + '[TENSORBOARD]', + '[EXPERIMENT]' + ); $requests = []; - $request = (new BatchCreateTensorboardRunsRequest()) - ->setParent($formattedParent) - ->setRequests($requests); + $request = (new BatchCreateTensorboardRunsRequest())->setParent($formattedParent)->setRequests($requests); $response = $gapicClient->batchCreateTensorboardRunsAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/AiPlatform/tests/Unit/V1/Client/VizierServiceClientTest.php b/AiPlatform/tests/Unit/V1/Client/VizierServiceClientTest.php index 13392b55692e..622ea009cf97 100644 --- a/AiPlatform/tests/Unit/V1/Client/VizierServiceClientTest.php +++ b/AiPlatform/tests/Unit/V1/Client/VizierServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return VizierServiceClient */ @@ -120,9 +122,7 @@ public function addTrialMeasurementTest() // Mock request $formattedTrialName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); $measurement = new Measurement(); - $request = (new AddTrialMeasurementRequest()) - ->setTrialName($formattedTrialName) - ->setMeasurement($measurement); + $request = (new AddTrialMeasurementRequest())->setTrialName($formattedTrialName)->setMeasurement($measurement); $response = $gapicClient->addTrialMeasurement($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -148,19 +148,20 @@ public function addTrialMeasurementExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedTrialName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); $measurement = new Measurement(); - $request = (new AddTrialMeasurementRequest()) - ->setTrialName($formattedTrialName) - ->setMeasurement($measurement); + $request = (new AddTrialMeasurementRequest())->setTrialName($formattedTrialName)->setMeasurement($measurement); try { $gapicClient->addTrialMeasurement($request); // If the $gapicClient method call did not throw, fail the test @@ -207,8 +208,7 @@ public function checkTrialEarlyStoppingStateTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedTrialName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new CheckTrialEarlyStoppingStateRequest()) - ->setTrialName($formattedTrialName); + $request = (new CheckTrialEarlyStoppingStateRequest())->setTrialName($formattedTrialName); $response = $gapicClient->checkTrialEarlyStoppingState($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -264,17 +264,19 @@ public function checkTrialEarlyStoppingStateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedTrialName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new CheckTrialEarlyStoppingStateRequest()) - ->setTrialName($formattedTrialName); + $request = (new CheckTrialEarlyStoppingStateRequest())->setTrialName($formattedTrialName); $response = $gapicClient->checkTrialEarlyStoppingState($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -320,8 +322,7 @@ public function completeTrialTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new CompleteTrialRequest()) - ->setName($formattedName); + $request = (new CompleteTrialRequest())->setName($formattedName); $response = $gapicClient->completeTrial($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -345,17 +346,19 @@ public function completeTrialExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new CompleteTrialRequest()) - ->setName($formattedName); + $request = (new CompleteTrialRequest())->setName($formattedName); try { $gapicClient->completeTrial($request); // If the $gapicClient method call did not throw, fail the test @@ -397,9 +400,7 @@ public function createStudyTest() $studySpecParameters = []; $studyStudySpec->setParameters($studySpecParameters); $study->setStudySpec($studyStudySpec); - $request = (new CreateStudyRequest()) - ->setParent($formattedParent) - ->setStudy($study); + $request = (new CreateStudyRequest())->setParent($formattedParent)->setStudy($study); $response = $gapicClient->createStudy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -425,12 +426,15 @@ public function createStudyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -443,9 +447,7 @@ public function createStudyExceptionTest() $studySpecParameters = []; $studyStudySpec->setParameters($studySpecParameters); $study->setStudySpec($studyStudySpec); - $request = (new CreateStudyRequest()) - ->setParent($formattedParent) - ->setStudy($study); + $request = (new CreateStudyRequest())->setParent($formattedParent)->setStudy($study); try { $gapicClient->createStudy($request); // If the $gapicClient method call did not throw, fail the test @@ -483,9 +485,7 @@ public function createTrialTest() // Mock request $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); $trial = new Trial(); - $request = (new CreateTrialRequest()) - ->setParent($formattedParent) - ->setTrial($trial); + $request = (new CreateTrialRequest())->setParent($formattedParent)->setTrial($trial); $response = $gapicClient->createTrial($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -511,19 +511,20 @@ public function createTrialExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); $trial = new Trial(); - $request = (new CreateTrialRequest()) - ->setParent($formattedParent) - ->setTrial($trial); + $request = (new CreateTrialRequest())->setParent($formattedParent)->setTrial($trial); try { $gapicClient->createTrial($request); // If the $gapicClient method call did not throw, fail the test @@ -550,8 +551,7 @@ public function deleteStudyTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $request = (new DeleteStudyRequest()) - ->setName($formattedName); + $request = (new DeleteStudyRequest())->setName($formattedName); $gapicClient->deleteStudy($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -574,17 +574,19 @@ public function deleteStudyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $request = (new DeleteStudyRequest()) - ->setName($formattedName); + $request = (new DeleteStudyRequest())->setName($formattedName); try { $gapicClient->deleteStudy($request); // If the $gapicClient method call did not throw, fail the test @@ -611,8 +613,7 @@ public function deleteTrialTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new DeleteTrialRequest()) - ->setName($formattedName); + $request = (new DeleteTrialRequest())->setName($formattedName); $gapicClient->deleteTrial($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -635,17 +636,19 @@ public function deleteTrialExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new DeleteTrialRequest()) - ->setName($formattedName); + $request = (new DeleteTrialRequest())->setName($formattedName); try { $gapicClient->deleteTrial($request); // If the $gapicClient method call did not throw, fail the test @@ -678,8 +681,7 @@ public function getStudyTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $request = (new GetStudyRequest()) - ->setName($formattedName); + $request = (new GetStudyRequest())->setName($formattedName); $response = $gapicClient->getStudy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -703,17 +705,19 @@ public function getStudyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $request = (new GetStudyRequest()) - ->setName($formattedName); + $request = (new GetStudyRequest())->setName($formattedName); try { $gapicClient->getStudy($request); // If the $gapicClient method call did not throw, fail the test @@ -750,8 +754,7 @@ public function getTrialTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new GetTrialRequest()) - ->setName($formattedName); + $request = (new GetTrialRequest())->setName($formattedName); $response = $gapicClient->getTrial($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -775,17 +778,19 @@ public function getTrialExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new GetTrialRequest()) - ->setName($formattedName); + $request = (new GetTrialRequest())->setName($formattedName); try { $gapicClient->getTrial($request); // If the $gapicClient method call did not throw, fail the test @@ -812,8 +817,7 @@ public function listOptimalTrialsTest() $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $request = (new ListOptimalTrialsRequest()) - ->setParent($formattedParent); + $request = (new ListOptimalTrialsRequest())->setParent($formattedParent); $response = $gapicClient->listOptimalTrials($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -837,17 +841,19 @@ public function listOptimalTrialsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $request = (new ListOptimalTrialsRequest()) - ->setParent($formattedParent); + $request = (new ListOptimalTrialsRequest())->setParent($formattedParent); try { $gapicClient->listOptimalTrials($request); // If the $gapicClient method call did not throw, fail the test @@ -872,17 +878,14 @@ public function listStudiesTest() // Mock response $nextPageToken = ''; $studiesElement = new Study(); - $studies = [ - $studiesElement, - ]; + $studies = [$studiesElement]; $expectedResponse = new ListStudiesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setStudies($studies); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListStudiesRequest()) - ->setParent($formattedParent); + $request = (new ListStudiesRequest())->setParent($formattedParent); $response = $gapicClient->listStudies($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -909,17 +912,19 @@ public function listStudiesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListStudiesRequest()) - ->setParent($formattedParent); + $request = (new ListStudiesRequest())->setParent($formattedParent); try { $gapicClient->listStudies($request); // If the $gapicClient method call did not throw, fail the test @@ -944,17 +949,14 @@ public function listTrialsTest() // Mock response $nextPageToken = ''; $trialsElement = new Trial(); - $trials = [ - $trialsElement, - ]; + $trials = [$trialsElement]; $expectedResponse = new ListTrialsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTrials($trials); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $request = (new ListTrialsRequest()) - ->setParent($formattedParent); + $request = (new ListTrialsRequest())->setParent($formattedParent); $response = $gapicClient->listTrials($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -981,17 +983,19 @@ public function listTrialsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $request = (new ListTrialsRequest()) - ->setParent($formattedParent); + $request = (new ListTrialsRequest())->setParent($formattedParent); try { $gapicClient->listTrials($request); // If the $gapicClient method call did not throw, fail the test @@ -1025,9 +1029,7 @@ public function lookupStudyTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $displayName = 'displayName1615086568'; - $request = (new LookupStudyRequest()) - ->setParent($formattedParent) - ->setDisplayName($displayName); + $request = (new LookupStudyRequest())->setParent($formattedParent)->setDisplayName($displayName); $response = $gapicClient->lookupStudy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1053,19 +1055,20 @@ public function lookupStudyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $displayName = 'displayName1615086568'; - $request = (new LookupStudyRequest()) - ->setParent($formattedParent) - ->setDisplayName($displayName); + $request = (new LookupStudyRequest())->setParent($formattedParent)->setDisplayName($displayName); try { $gapicClient->lookupStudy($request); // If the $gapicClient method call did not throw, fail the test @@ -1102,8 +1105,7 @@ public function stopTrialTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new StopTrialRequest()) - ->setName($formattedName); + $request = (new StopTrialRequest())->setName($formattedName); $response = $gapicClient->stopTrial($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1127,17 +1129,19 @@ public function stopTrialExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $request = (new StopTrialRequest()) - ->setName($formattedName); + $request = (new StopTrialRequest())->setName($formattedName); try { $gapicClient->stopTrial($request); // If the $gapicClient method call did not throw, fail the test @@ -1247,12 +1251,15 @@ public function suggestTrialsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); @@ -1323,12 +1330,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1355,9 +1365,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1387,12 +1395,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1425,8 +1436,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1450,17 +1460,19 @@ public function getIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1492,9 +1504,7 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1520,19 +1530,20 @@ public function setIamPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1560,9 +1571,7 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1588,19 +1597,20 @@ public function testIamPermissionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1638,9 +1648,7 @@ public function addTrialMeasurementAsyncTest() // Mock request $formattedTrialName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); $measurement = new Measurement(); - $request = (new AddTrialMeasurementRequest()) - ->setTrialName($formattedTrialName) - ->setMeasurement($measurement); + $request = (new AddTrialMeasurementRequest())->setTrialName($formattedTrialName)->setMeasurement($measurement); $response = $gapicClient->addTrialMeasurementAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/AiPlatform/tests/Unit/V1/DatasetServiceClientTest.php b/AiPlatform/tests/Unit/V1/DatasetServiceClientTest.php deleted file mode 100644 index ab4b9fb3aa91..000000000000 --- a/AiPlatform/tests/Unit/V1/DatasetServiceClientTest.php +++ /dev/null @@ -1,2181 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return DatasetServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new DatasetServiceClient($options); - } - - /** @test */ - public function createDatasetTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDatasetTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $metadataSchemaUri = 'metadataSchemaUri-152319778'; - $dataItemCount = 2014260376; - $etag = 'etag3123477'; - $metadataArtifact = 'metadataArtifact2087706850'; - $modelReference = 'modelReference-1502407243'; - $expectedResponse = new Dataset(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setMetadataSchemaUri($metadataSchemaUri); - $expectedResponse->setDataItemCount($dataItemCount); - $expectedResponse->setEtag($etag); - $expectedResponse->setMetadataArtifact($metadataArtifact); - $expectedResponse->setModelReference($modelReference); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createDatasetTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $dataset = new Dataset(); - $datasetDisplayName = 'datasetDisplayName1912393429'; - $dataset->setDisplayName($datasetDisplayName); - $datasetMetadataSchemaUri = 'datasetMetadataSchemaUri-1520763900'; - $dataset->setMetadataSchemaUri($datasetMetadataSchemaUri); - $datasetMetadata = new Value(); - $dataset->setMetadata($datasetMetadata); - $response = $gapicClient->createDataset($formattedParent, $dataset); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/CreateDataset', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getDataset(); - $this->assertProtobufEquals($dataset, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatasetTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createDatasetExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDatasetTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $dataset = new Dataset(); - $datasetDisplayName = 'datasetDisplayName1912393429'; - $dataset->setDisplayName($datasetDisplayName); - $datasetMetadataSchemaUri = 'datasetMetadataSchemaUri-1520763900'; - $dataset->setMetadataSchemaUri($datasetMetadataSchemaUri); - $datasetMetadata = new Value(); - $dataset->setMetadata($datasetMetadata); - $response = $gapicClient->createDataset($formattedParent, $dataset); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatasetTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createDatasetVersionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDatasetVersionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $etag = 'etag3123477'; - $bigQueryDatasetName = 'bigQueryDatasetName-1230960216'; - $displayName = 'displayName1615086568'; - $modelReference = 'modelReference-1502407243'; - $expectedResponse = new DatasetVersion(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $expectedResponse->setBigQueryDatasetName($bigQueryDatasetName); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setModelReference($modelReference); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createDatasetVersionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $datasetVersion = new DatasetVersion(); - $datasetVersionMetadata = new Value(); - $datasetVersion->setMetadata($datasetVersionMetadata); - $response = $gapicClient->createDatasetVersion($formattedParent, $datasetVersion); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/CreateDatasetVersion', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getDatasetVersion(); - $this->assertProtobufEquals($datasetVersion, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatasetVersionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createDatasetVersionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDatasetVersionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $datasetVersion = new DatasetVersion(); - $datasetVersionMetadata = new Value(); - $datasetVersion->setMetadata($datasetVersionMetadata); - $response = $gapicClient->createDatasetVersion($formattedParent, $datasetVersion); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatasetVersionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteDatasetTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteDatasetTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteDatasetTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $response = $gapicClient->deleteDataset($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/DeleteDataset', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDatasetTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteDatasetExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteDatasetTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $response = $gapicClient->deleteDataset($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDatasetTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteDatasetVersionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteDatasetVersionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteDatasetVersionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $response = $gapicClient->deleteDatasetVersion($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/DeleteDatasetVersion', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDatasetVersionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteDatasetVersionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteDatasetVersionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $response = $gapicClient->deleteDatasetVersion($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDatasetVersionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteSavedQueryTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteSavedQueryTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteSavedQueryTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->savedQueryName('[PROJECT]', '[LOCATION]', '[DATASET]', '[SAVED_QUERY]'); - $response = $gapicClient->deleteSavedQuery($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/DeleteSavedQuery', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteSavedQueryTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteSavedQueryExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteSavedQueryTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->savedQueryName('[PROJECT]', '[LOCATION]', '[DATASET]', '[SAVED_QUERY]'); - $response = $gapicClient->deleteSavedQuery($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteSavedQueryTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function exportDataTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/exportDataTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new ExportDataResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/exportDataTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $exportConfig = new ExportDataConfig(); - $response = $gapicClient->exportData($formattedName, $exportConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/ExportData', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualApiRequestObject->getExportConfig(); - $this->assertProtobufEquals($exportConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/exportDataTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function exportDataExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/exportDataTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $exportConfig = new ExportDataConfig(); - $response = $gapicClient->exportData($formattedName, $exportConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/exportDataTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getAnnotationSpecTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $etag = 'etag3123477'; - $expectedResponse = new AnnotationSpec(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->annotationSpecName('[PROJECT]', '[LOCATION]', '[DATASET]', '[ANNOTATION_SPEC]'); - $response = $gapicClient->getAnnotationSpec($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/GetAnnotationSpec', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAnnotationSpecExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->annotationSpecName('[PROJECT]', '[LOCATION]', '[DATASET]', '[ANNOTATION_SPEC]'); - try { - $gapicClient->getAnnotationSpec($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatasetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $metadataSchemaUri = 'metadataSchemaUri-152319778'; - $dataItemCount = 2014260376; - $etag = 'etag3123477'; - $metadataArtifact = 'metadataArtifact2087706850'; - $modelReference = 'modelReference-1502407243'; - $expectedResponse = new Dataset(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setMetadataSchemaUri($metadataSchemaUri); - $expectedResponse->setDataItemCount($dataItemCount); - $expectedResponse->setEtag($etag); - $expectedResponse->setMetadataArtifact($metadataArtifact); - $expectedResponse->setModelReference($modelReference); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $response = $gapicClient->getDataset($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/GetDataset', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatasetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - try { - $gapicClient->getDataset($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatasetVersionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $bigQueryDatasetName = 'bigQueryDatasetName-1230960216'; - $displayName = 'displayName1615086568'; - $modelReference = 'modelReference-1502407243'; - $expectedResponse = new DatasetVersion(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $expectedResponse->setBigQueryDatasetName($bigQueryDatasetName); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setModelReference($modelReference); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $response = $gapicClient->getDatasetVersion($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/GetDatasetVersion', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatasetVersionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - try { - $gapicClient->getDatasetVersion($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function importDataTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/importDataTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new ImportDataResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/importDataTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $importConfigs = []; - $response = $gapicClient->importData($formattedName, $importConfigs); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/ImportData', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualApiRequestObject->getImportConfigs(); - $this->assertProtobufEquals($importConfigs, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/importDataTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function importDataExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/importDataTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $importConfigs = []; - $response = $gapicClient->importData($formattedName, $importConfigs); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/importDataTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function listAnnotationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $annotationsElement = new Annotation(); - $annotations = [ - $annotationsElement, - ]; - $expectedResponse = new ListAnnotationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAnnotations($annotations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->dataItemName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATA_ITEM]'); - $response = $gapicClient->listAnnotations($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAnnotations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/ListAnnotations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAnnotationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->dataItemName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATA_ITEM]'); - try { - $gapicClient->listAnnotations($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDataItemsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $dataItemsElement = new DataItem(); - $dataItems = [ - $dataItemsElement, - ]; - $expectedResponse = new ListDataItemsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDataItems($dataItems); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $response = $gapicClient->listDataItems($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDataItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/ListDataItems', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDataItemsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - try { - $gapicClient->listDataItems($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatasetVersionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $datasetVersionsElement = new DatasetVersion(); - $datasetVersions = [ - $datasetVersionsElement, - ]; - $expectedResponse = new ListDatasetVersionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDatasetVersions($datasetVersions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $response = $gapicClient->listDatasetVersions($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDatasetVersions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/ListDatasetVersions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatasetVersionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - try { - $gapicClient->listDatasetVersions($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatasetsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $datasetsElement = new Dataset(); - $datasets = [ - $datasetsElement, - ]; - $expectedResponse = new ListDatasetsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDatasets($datasets); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listDatasets($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDatasets()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/ListDatasets', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatasetsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listDatasets($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSavedQueriesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $savedQueriesElement = new SavedQuery(); - $savedQueries = [ - $savedQueriesElement, - ]; - $expectedResponse = new ListSavedQueriesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSavedQueries($savedQueries); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $response = $gapicClient->listSavedQueries($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSavedQueries()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/ListSavedQueries', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSavedQueriesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - try { - $gapicClient->listSavedQueries($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function restoreDatasetVersionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/restoreDatasetVersionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $bigQueryDatasetName = 'bigQueryDatasetName-1230960216'; - $displayName = 'displayName1615086568'; - $modelReference = 'modelReference-1502407243'; - $expectedResponse = new DatasetVersion(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $expectedResponse->setBigQueryDatasetName($bigQueryDatasetName); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setModelReference($modelReference); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/restoreDatasetVersionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $response = $gapicClient->restoreDatasetVersion($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/RestoreDatasetVersion', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/restoreDatasetVersionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function restoreDatasetVersionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/restoreDatasetVersionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetVersionName('[PROJECT]', '[LOCATION]', '[DATASET]', '[DATASET_VERSION]'); - $response = $gapicClient->restoreDatasetVersion($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/restoreDatasetVersionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function searchDataItemsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $dataItemViewsElement = new DataItemView(); - $dataItemViews = [ - $dataItemViewsElement, - ]; - $expectedResponse = new SearchDataItemsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDataItemViews($dataItemViews); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDataset = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - $response = $gapicClient->searchDataItems($formattedDataset); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDataItemViews()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/SearchDataItems', $actualFuncCall); - $actualValue = $actualRequestObject->getDataset(); - $this->assertProtobufEquals($formattedDataset, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchDataItemsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDataset = $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); - try { - $gapicClient->searchDataItems($formattedDataset); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateDatasetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $metadataSchemaUri = 'metadataSchemaUri-152319778'; - $dataItemCount = 2014260376; - $etag = 'etag3123477'; - $metadataArtifact = 'metadataArtifact2087706850'; - $modelReference = 'modelReference-1502407243'; - $expectedResponse = new Dataset(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setMetadataSchemaUri($metadataSchemaUri); - $expectedResponse->setDataItemCount($dataItemCount); - $expectedResponse->setEtag($etag); - $expectedResponse->setMetadataArtifact($metadataArtifact); - $expectedResponse->setModelReference($modelReference); - $transport->addResponse($expectedResponse); - // Mock request - $dataset = new Dataset(); - $datasetDisplayName = 'datasetDisplayName1912393429'; - $dataset->setDisplayName($datasetDisplayName); - $datasetMetadataSchemaUri = 'datasetMetadataSchemaUri-1520763900'; - $dataset->setMetadataSchemaUri($datasetMetadataSchemaUri); - $datasetMetadata = new Value(); - $dataset->setMetadata($datasetMetadata); - $updateMask = new FieldMask(); - $response = $gapicClient->updateDataset($dataset, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/UpdateDataset', $actualFuncCall); - $actualValue = $actualRequestObject->getDataset(); - $this->assertProtobufEquals($dataset, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateDatasetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $dataset = new Dataset(); - $datasetDisplayName = 'datasetDisplayName1912393429'; - $dataset->setDisplayName($datasetDisplayName); - $datasetMetadataSchemaUri = 'datasetMetadataSchemaUri-1520763900'; - $dataset->setMetadataSchemaUri($datasetMetadataSchemaUri); - $datasetMetadata = new Value(); - $dataset->setMetadata($datasetMetadata); - $updateMask = new FieldMask(); - try { - $gapicClient->updateDataset($dataset, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateDatasetVersionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $etag = 'etag3123477'; - $bigQueryDatasetName = 'bigQueryDatasetName-1230960216'; - $displayName = 'displayName1615086568'; - $modelReference = 'modelReference-1502407243'; - $expectedResponse = new DatasetVersion(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $expectedResponse->setBigQueryDatasetName($bigQueryDatasetName); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setModelReference($modelReference); - $transport->addResponse($expectedResponse); - // Mock request - $datasetVersion = new DatasetVersion(); - $datasetVersionMetadata = new Value(); - $datasetVersion->setMetadata($datasetVersionMetadata); - $updateMask = new FieldMask(); - $response = $gapicClient->updateDatasetVersion($datasetVersion, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DatasetService/UpdateDatasetVersion', $actualFuncCall); - $actualValue = $actualRequestObject->getDatasetVersion(); - $this->assertProtobufEquals($datasetVersion, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateDatasetVersionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $datasetVersion = new DatasetVersion(); - $datasetVersionMetadata = new Value(); - $datasetVersion->setMetadata($datasetVersionMetadata); - $updateMask = new FieldMask(); - try { - $gapicClient->updateDatasetVersion($datasetVersion, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/DeploymentResourcePoolServiceClientTest.php b/AiPlatform/tests/Unit/V1/DeploymentResourcePoolServiceClientTest.php deleted file mode 100644 index 4a03f5e208c0..000000000000 --- a/AiPlatform/tests/Unit/V1/DeploymentResourcePoolServiceClientTest.php +++ /dev/null @@ -1,849 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return DeploymentResourcePoolServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new DeploymentResourcePoolServiceClient($options); - } - - /** @test */ - public function createDeploymentResourcePoolTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDeploymentResourcePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $serviceAccount = 'serviceAccount-1948028253'; - $disableContainerLogging = true; - $expectedResponse = new DeploymentResourcePool(); - $expectedResponse->setName($name); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setDisableContainerLogging($disableContainerLogging); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createDeploymentResourcePoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $deploymentResourcePool = new DeploymentResourcePool(); - $deploymentResourcePoolDedicatedResources = new DedicatedResources(); - $dedicatedResourcesMachineSpec = new MachineSpec(); - $deploymentResourcePoolDedicatedResources->setMachineSpec($dedicatedResourcesMachineSpec); - $dedicatedResourcesMinReplicaCount = 386489645; - $deploymentResourcePoolDedicatedResources->setMinReplicaCount($dedicatedResourcesMinReplicaCount); - $deploymentResourcePool->setDedicatedResources($deploymentResourcePoolDedicatedResources); - $deploymentResourcePoolId = 'deploymentResourcePoolId732232487'; - $response = $gapicClient->createDeploymentResourcePool($formattedParent, $deploymentResourcePool, $deploymentResourcePoolId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/CreateDeploymentResourcePool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getDeploymentResourcePool(); - $this->assertProtobufEquals($deploymentResourcePool, $actualValue); - $actualValue = $actualApiRequestObject->getDeploymentResourcePoolId(); - $this->assertProtobufEquals($deploymentResourcePoolId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDeploymentResourcePoolTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createDeploymentResourcePoolExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDeploymentResourcePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $deploymentResourcePool = new DeploymentResourcePool(); - $deploymentResourcePoolDedicatedResources = new DedicatedResources(); - $dedicatedResourcesMachineSpec = new MachineSpec(); - $deploymentResourcePoolDedicatedResources->setMachineSpec($dedicatedResourcesMachineSpec); - $dedicatedResourcesMinReplicaCount = 386489645; - $deploymentResourcePoolDedicatedResources->setMinReplicaCount($dedicatedResourcesMinReplicaCount); - $deploymentResourcePool->setDedicatedResources($deploymentResourcePoolDedicatedResources); - $deploymentResourcePoolId = 'deploymentResourcePoolId732232487'; - $response = $gapicClient->createDeploymentResourcePool($formattedParent, $deploymentResourcePool, $deploymentResourcePoolId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDeploymentResourcePoolTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteDeploymentResourcePoolTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteDeploymentResourcePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteDeploymentResourcePoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - $response = $gapicClient->deleteDeploymentResourcePool($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/DeleteDeploymentResourcePool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDeploymentResourcePoolTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteDeploymentResourcePoolExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteDeploymentResourcePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - $response = $gapicClient->deleteDeploymentResourcePool($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDeploymentResourcePoolTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getDeploymentResourcePoolTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $serviceAccount = 'serviceAccount-1948028253'; - $disableContainerLogging = true; - $expectedResponse = new DeploymentResourcePool(); - $expectedResponse->setName($name2); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setDisableContainerLogging($disableContainerLogging); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - $response = $gapicClient->getDeploymentResourcePool($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/GetDeploymentResourcePool', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDeploymentResourcePoolExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->deploymentResourcePoolName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT_RESOURCE_POOL]'); - try { - $gapicClient->getDeploymentResourcePool($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDeploymentResourcePoolsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $deploymentResourcePoolsElement = new DeploymentResourcePool(); - $deploymentResourcePools = [ - $deploymentResourcePoolsElement, - ]; - $expectedResponse = new ListDeploymentResourcePoolsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDeploymentResourcePools($deploymentResourcePools); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listDeploymentResourcePools($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDeploymentResourcePools()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/ListDeploymentResourcePools', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDeploymentResourcePoolsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listDeploymentResourcePools($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function queryDeployedModelsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $totalDeployedModelCount = 591684507; - $totalEndpointCount = 61124672; - $deployedModelsElement = new DeployedModel(); - $deployedModels = [ - $deployedModelsElement, - ]; - $expectedResponse = new QueryDeployedModelsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTotalDeployedModelCount($totalDeployedModelCount); - $expectedResponse->setTotalEndpointCount($totalEndpointCount); - $expectedResponse->setDeployedModels($deployedModels); - $transport->addResponse($expectedResponse); - // Mock request - $deploymentResourcePool = 'deploymentResourcePool-1160399437'; - $response = $gapicClient->queryDeployedModels($deploymentResourcePool); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDeployedModels()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.DeploymentResourcePoolService/QueryDeployedModels', $actualFuncCall); - $actualValue = $actualRequestObject->getDeploymentResourcePool(); - $this->assertProtobufEquals($deploymentResourcePool, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function queryDeployedModelsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $deploymentResourcePool = 'deploymentResourcePool-1160399437'; - try { - $gapicClient->queryDeployedModels($deploymentResourcePool); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/EndpointServiceClientTest.php b/AiPlatform/tests/Unit/V1/EndpointServiceClientTest.php deleted file mode 100644 index 314831724b7b..000000000000 --- a/AiPlatform/tests/Unit/V1/EndpointServiceClientTest.php +++ /dev/null @@ -1,1237 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return EndpointServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new EndpointServiceClient($options); - } - - /** @test */ - public function createEndpointTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createEndpointTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $network = 'network1843485230'; - $enablePrivateServiceConnect = true; - $modelDeploymentMonitoringJob = 'modelDeploymentMonitoringJob1797127786'; - $expectedResponse = new Endpoint(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setNetwork($network); - $expectedResponse->setEnablePrivateServiceConnect($enablePrivateServiceConnect); - $expectedResponse->setModelDeploymentMonitoringJob($modelDeploymentMonitoringJob); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createEndpointTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $endpoint = new Endpoint(); - $endpointDisplayName = 'endpointDisplayName697270680'; - $endpoint->setDisplayName($endpointDisplayName); - $response = $gapicClient->createEndpoint($formattedParent, $endpoint); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.EndpointService/CreateEndpoint', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getEndpoint(); - $this->assertProtobufEquals($endpoint, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createEndpointTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createEndpointExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createEndpointTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $endpoint = new Endpoint(); - $endpointDisplayName = 'endpointDisplayName697270680'; - $endpoint->setDisplayName($endpointDisplayName); - $response = $gapicClient->createEndpoint($formattedParent, $endpoint); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createEndpointTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteEndpointTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteEndpointTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteEndpointTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $response = $gapicClient->deleteEndpoint($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.EndpointService/DeleteEndpoint', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteEndpointTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteEndpointExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteEndpointTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $response = $gapicClient->deleteEndpoint($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteEndpointTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deployModelTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deployModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new DeployModelResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deployModelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $deployedModel = new DeployedModel(); - $deployedModelModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $deployedModel->setModel($deployedModelModel); - $response = $gapicClient->deployModel($formattedEndpoint, $deployedModel); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.EndpointService/DeployModel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $actualValue = $actualApiRequestObject->getDeployedModel(); - $this->assertProtobufEquals($deployedModel, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deployModelTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deployModelExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deployModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $deployedModel = new DeployedModel(); - $deployedModelModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $deployedModel->setModel($deployedModelModel); - $response = $gapicClient->deployModel($formattedEndpoint, $deployedModel); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deployModelTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getEndpointTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $network = 'network1843485230'; - $enablePrivateServiceConnect = true; - $modelDeploymentMonitoringJob = 'modelDeploymentMonitoringJob1797127786'; - $expectedResponse = new Endpoint(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setNetwork($network); - $expectedResponse->setEnablePrivateServiceConnect($enablePrivateServiceConnect); - $expectedResponse->setModelDeploymentMonitoringJob($modelDeploymentMonitoringJob); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $response = $gapicClient->getEndpoint($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.EndpointService/GetEndpoint', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEndpointExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - try { - $gapicClient->getEndpoint($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listEndpointsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $endpointsElement = new Endpoint(); - $endpoints = [ - $endpointsElement, - ]; - $expectedResponse = new ListEndpointsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setEndpoints($endpoints); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listEndpoints($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getEndpoints()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.EndpointService/ListEndpoints', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listEndpointsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listEndpoints($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function mutateDeployedModelTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/mutateDeployedModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new MutateDeployedModelResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/mutateDeployedModelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $deployedModel = new DeployedModel(); - $deployedModelModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $deployedModel->setModel($deployedModelModel); - $updateMask = new FieldMask(); - $response = $gapicClient->mutateDeployedModel($formattedEndpoint, $deployedModel, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.EndpointService/MutateDeployedModel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $actualValue = $actualApiRequestObject->getDeployedModel(); - $this->assertProtobufEquals($deployedModel, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/mutateDeployedModelTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function mutateDeployedModelExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/mutateDeployedModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $deployedModel = new DeployedModel(); - $deployedModelModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $deployedModel->setModel($deployedModelModel); - $updateMask = new FieldMask(); - $response = $gapicClient->mutateDeployedModel($formattedEndpoint, $deployedModel, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/mutateDeployedModelTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function undeployModelTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/undeployModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new UndeployModelResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/undeployModelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $deployedModelId = 'deployedModelId866642506'; - $response = $gapicClient->undeployModel($formattedEndpoint, $deployedModelId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.EndpointService/UndeployModel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $actualValue = $actualApiRequestObject->getDeployedModelId(); - $this->assertProtobufEquals($deployedModelId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/undeployModelTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function undeployModelExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/undeployModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $deployedModelId = 'deployedModelId866642506'; - $response = $gapicClient->undeployModel($formattedEndpoint, $deployedModelId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/undeployModelTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateEndpointTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $network = 'network1843485230'; - $enablePrivateServiceConnect = true; - $modelDeploymentMonitoringJob = 'modelDeploymentMonitoringJob1797127786'; - $expectedResponse = new Endpoint(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setNetwork($network); - $expectedResponse->setEnablePrivateServiceConnect($enablePrivateServiceConnect); - $expectedResponse->setModelDeploymentMonitoringJob($modelDeploymentMonitoringJob); - $transport->addResponse($expectedResponse); - // Mock request - $endpoint = new Endpoint(); - $endpointDisplayName = 'endpointDisplayName697270680'; - $endpoint->setDisplayName($endpointDisplayName); - $updateMask = new FieldMask(); - $response = $gapicClient->updateEndpoint($endpoint, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.EndpointService/UpdateEndpoint', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($endpoint, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateEndpointExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $endpoint = new Endpoint(); - $endpointDisplayName = 'endpointDisplayName697270680'; - $endpoint->setDisplayName($endpointDisplayName); - $updateMask = new FieldMask(); - try { - $gapicClient->updateEndpoint($endpoint, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/FeatureOnlineStoreAdminServiceClientTest.php b/AiPlatform/tests/Unit/V1/FeatureOnlineStoreAdminServiceClientTest.php deleted file mode 100644 index f535822129fe..000000000000 --- a/AiPlatform/tests/Unit/V1/FeatureOnlineStoreAdminServiceClientTest.php +++ /dev/null @@ -1,1568 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FeatureOnlineStoreAdminServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FeatureOnlineStoreAdminServiceClient($options); - } - - /** @test */ - public function createFeatureOnlineStoreTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureOnlineStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new FeatureOnlineStore(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFeatureOnlineStoreTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $featureOnlineStore = new FeatureOnlineStore(); - $featureOnlineStoreId = 'featureOnlineStoreId-10760612'; - $response = $gapicClient->createFeatureOnlineStore($formattedParent, $featureOnlineStore, $featureOnlineStoreId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureOnlineStore', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureOnlineStore(); - $this->assertProtobufEquals($featureOnlineStore, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureOnlineStoreId(); - $this->assertProtobufEquals($featureOnlineStoreId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureOnlineStoreTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeatureOnlineStoreExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureOnlineStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $featureOnlineStore = new FeatureOnlineStore(); - $featureOnlineStoreId = 'featureOnlineStoreId-10760612'; - $response = $gapicClient->createFeatureOnlineStore($formattedParent, $featureOnlineStore, $featureOnlineStoreId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureOnlineStoreTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeatureViewTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureViewTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new FeatureView(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFeatureViewTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $featureView = new FeatureView(); - $featureViewId = 'featureViewId-1041382228'; - $response = $gapicClient->createFeatureView($formattedParent, $featureView, $featureViewId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureView', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureView(); - $this->assertProtobufEquals($featureView, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureViewId(); - $this->assertProtobufEquals($featureViewId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureViewTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeatureViewExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureViewTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $featureView = new FeatureView(); - $featureViewId = 'featureViewId-1041382228'; - $response = $gapicClient->createFeatureView($formattedParent, $featureView, $featureViewId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureViewTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureOnlineStoreTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureOnlineStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFeatureOnlineStoreTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $response = $gapicClient->deleteFeatureOnlineStore($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureOnlineStore', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureOnlineStoreTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureOnlineStoreExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureOnlineStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $response = $gapicClient->deleteFeatureOnlineStore($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureOnlineStoreTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureViewTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureViewTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFeatureViewTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $response = $gapicClient->deleteFeatureView($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureView', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureViewTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureViewExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureViewTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $response = $gapicClient->deleteFeatureView($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureViewTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getFeatureOnlineStoreTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $expectedResponse = new FeatureOnlineStore(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $response = $gapicClient->getFeatureOnlineStore($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureOnlineStore', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureOnlineStoreExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - try { - $gapicClient->getFeatureOnlineStore($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureViewTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $expectedResponse = new FeatureView(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $response = $gapicClient->getFeatureView($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureView', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureViewExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - try { - $gapicClient->getFeatureView($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureViewSyncTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new FeatureViewSync(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->featureViewSyncName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $response = $gapicClient->getFeatureViewSync($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureViewSync', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureViewSyncExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureViewSyncName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - try { - $gapicClient->getFeatureViewSync($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeatureOnlineStoresTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $featureOnlineStoresElement = new FeatureOnlineStore(); - $featureOnlineStores = [ - $featureOnlineStoresElement, - ]; - $expectedResponse = new ListFeatureOnlineStoresResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFeatureOnlineStores($featureOnlineStores); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listFeatureOnlineStores($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFeatureOnlineStores()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureOnlineStores', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeatureOnlineStoresExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listFeatureOnlineStores($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeatureViewSyncsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $featureViewSyncsElement = new FeatureViewSync(); - $featureViewSyncs = [ - $featureViewSyncsElement, - ]; - $expectedResponse = new ListFeatureViewSyncsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFeatureViewSyncs($featureViewSyncs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $response = $gapicClient->listFeatureViewSyncs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFeatureViewSyncs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViewSyncs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeatureViewSyncsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - try { - $gapicClient->listFeatureViewSyncs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeatureViewsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $featureViewsElement = new FeatureView(); - $featureViews = [ - $featureViewsElement, - ]; - $expectedResponse = new ListFeatureViewsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFeatureViews($featureViews); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - $response = $gapicClient->listFeatureViews($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFeatureViews()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViews', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeatureViewsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->featureOnlineStoreName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]'); - try { - $gapicClient->listFeatureViews($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function syncFeatureViewTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $featureViewSync = 'featureViewSync-40619540'; - $expectedResponse = new SyncFeatureViewResponse(); - $expectedResponse->setFeatureViewSync($featureViewSync); - $transport->addResponse($expectedResponse); - // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $response = $gapicClient->syncFeatureView($formattedFeatureView); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/SyncFeatureView', $actualFuncCall); - $actualValue = $actualRequestObject->getFeatureView(); - $this->assertProtobufEquals($formattedFeatureView, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function syncFeatureViewExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - try { - $gapicClient->syncFeatureView($formattedFeatureView); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateFeatureOnlineStoreTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureOnlineStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new FeatureOnlineStore(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFeatureOnlineStoreTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $featureOnlineStore = new FeatureOnlineStore(); - $response = $gapicClient->updateFeatureOnlineStore($featureOnlineStore); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureOnlineStore', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFeatureOnlineStore(); - $this->assertProtobufEquals($featureOnlineStore, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureOnlineStoreTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateFeatureOnlineStoreExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureOnlineStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $featureOnlineStore = new FeatureOnlineStore(); - $response = $gapicClient->updateFeatureOnlineStore($featureOnlineStore); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureOnlineStoreTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateFeatureViewTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureViewTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new FeatureView(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFeatureViewTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $featureView = new FeatureView(); - $response = $gapicClient->updateFeatureView($featureView); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureView', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFeatureView(); - $this->assertProtobufEquals($featureView, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureViewTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateFeatureViewExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureViewTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $featureView = new FeatureView(); - $response = $gapicClient->updateFeatureView($featureView); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureViewTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/FeatureOnlineStoreServiceClientTest.php b/AiPlatform/tests/Unit/V1/FeatureOnlineStoreServiceClientTest.php deleted file mode 100644 index 5007b6696c1b..000000000000 --- a/AiPlatform/tests/Unit/V1/FeatureOnlineStoreServiceClientTest.php +++ /dev/null @@ -1,497 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FeatureOnlineStoreServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FeatureOnlineStoreServiceClient($options); - } - - /** @test */ - public function fetchFeatureValuesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new FetchFeatureValuesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $response = $gapicClient->fetchFeatureValues($formattedFeatureView); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreService/FetchFeatureValues', $actualFuncCall); - $actualValue = $actualRequestObject->getFeatureView(); - $this->assertProtobufEquals($formattedFeatureView, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function fetchFeatureValuesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - try { - $gapicClient->fetchFeatureValues($formattedFeatureView); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchNearestEntitiesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SearchNearestEntitiesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $query = new NearestNeighborQuery(); - $response = $gapicClient->searchNearestEntities($formattedFeatureView, $query); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureOnlineStoreService/SearchNearestEntities', $actualFuncCall); - $actualValue = $actualRequestObject->getFeatureView(); - $this->assertProtobufEquals($formattedFeatureView, $actualValue); - $actualValue = $actualRequestObject->getQuery(); - $this->assertProtobufEquals($query, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchNearestEntitiesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedFeatureView = $gapicClient->featureViewName('[PROJECT]', '[LOCATION]', '[FEATURE_ONLINE_STORE]', '[FEATURE_VIEW]'); - $query = new NearestNeighborQuery(); - try { - $gapicClient->searchNearestEntities($formattedFeatureView, $query); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/FeatureRegistryServiceClientTest.php b/AiPlatform/tests/Unit/V1/FeatureRegistryServiceClientTest.php deleted file mode 100644 index a224521d73af..000000000000 --- a/AiPlatform/tests/Unit/V1/FeatureRegistryServiceClientTest.php +++ /dev/null @@ -1,1407 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FeatureRegistryServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FeatureRegistryServiceClient($options); - } - - /** @test */ - public function createFeatureTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $disableMonitoring = false; - $versionColumnName = 'versionColumnName-1981743891'; - $pointOfContact = 'pointOfContact1207498695'; - $expectedResponse = new Feature(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setDisableMonitoring($disableMonitoring); - $expectedResponse->setVersionColumnName($versionColumnName); - $expectedResponse->setPointOfContact($pointOfContact); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFeatureTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $feature = new Feature(); - $featureId = 'featureId-150697212'; - $response = $gapicClient->createFeature($formattedParent, $feature, $featureId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/CreateFeature', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFeature(); - $this->assertProtobufEquals($feature, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureId(); - $this->assertProtobufEquals($featureId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeatureExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $feature = new Feature(); - $featureId = 'featureId-150697212'; - $response = $gapicClient->createFeature($formattedParent, $feature, $featureId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeatureGroupTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureGroupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $etag = 'etag3123477'; - $description = 'description-1724546052'; - $expectedResponse = new FeatureGroup(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFeatureGroupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $featureGroup = new FeatureGroup(); - $featureGroupId = 'featureGroupId1387078148'; - $response = $gapicClient->createFeatureGroup($formattedParent, $featureGroup, $featureGroupId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/CreateFeatureGroup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureGroup(); - $this->assertProtobufEquals($featureGroup, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureGroupId(); - $this->assertProtobufEquals($featureGroupId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureGroupTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeatureGroupExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureGroupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $featureGroup = new FeatureGroup(); - $featureGroupId = 'featureGroupId1387078148'; - $response = $gapicClient->createFeatureGroup($formattedParent, $featureGroup, $featureGroupId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureGroupTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFeatureTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $response = $gapicClient->deleteFeature($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/DeleteFeature', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $response = $gapicClient->deleteFeature($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureGroupTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureGroupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFeatureGroupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - $response = $gapicClient->deleteFeatureGroup($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/DeleteFeatureGroup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureGroupTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureGroupExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureGroupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - $response = $gapicClient->deleteFeatureGroup($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureGroupTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getFeatureTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $disableMonitoring = false; - $versionColumnName = 'versionColumnName-1981743891'; - $pointOfContact = 'pointOfContact1207498695'; - $expectedResponse = new Feature(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setDisableMonitoring($disableMonitoring); - $expectedResponse->setVersionColumnName($versionColumnName); - $expectedResponse->setPointOfContact($pointOfContact); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $response = $gapicClient->getFeature($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/GetFeature', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - try { - $gapicClient->getFeature($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureGroupTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $description = 'description-1724546052'; - $expectedResponse = new FeatureGroup(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - $response = $gapicClient->getFeatureGroup($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/GetFeatureGroup', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureGroupExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureGroupName('[PROJECT]', '[LOCATION]', '[FEATURE_GROUP]'); - try { - $gapicClient->getFeatureGroup($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeatureGroupsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $featureGroupsElement = new FeatureGroup(); - $featureGroups = [ - $featureGroupsElement, - ]; - $expectedResponse = new ListFeatureGroupsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFeatureGroups($featureGroups); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listFeatureGroups($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFeatureGroups()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/ListFeatureGroups', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeatureGroupsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listFeatureGroups($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeaturesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $featuresElement = new Feature(); - $features = [ - $featuresElement, - ]; - $expectedResponse = new ListFeaturesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFeatures($features); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $response = $gapicClient->listFeatures($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFeatures()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/ListFeatures', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeaturesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - try { - $gapicClient->listFeatures($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateFeatureTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $disableMonitoring = false; - $versionColumnName = 'versionColumnName-1981743891'; - $pointOfContact = 'pointOfContact1207498695'; - $expectedResponse = new Feature(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setDisableMonitoring($disableMonitoring); - $expectedResponse->setVersionColumnName($versionColumnName); - $expectedResponse->setPointOfContact($pointOfContact); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFeatureTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $feature = new Feature(); - $response = $gapicClient->updateFeature($feature); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/UpdateFeature', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFeature(); - $this->assertProtobufEquals($feature, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateFeatureExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $feature = new Feature(); - $response = $gapicClient->updateFeature($feature); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateFeatureGroupTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureGroupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $etag = 'etag3123477'; - $description = 'description-1724546052'; - $expectedResponse = new FeatureGroup(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFeatureGroupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $featureGroup = new FeatureGroup(); - $response = $gapicClient->updateFeatureGroup($featureGroup); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeatureRegistryService/UpdateFeatureGroup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFeatureGroup(); - $this->assertProtobufEquals($featureGroup, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureGroupTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateFeatureGroupExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureGroupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $featureGroup = new FeatureGroup(); - $response = $gapicClient->updateFeatureGroup($featureGroup); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureGroupTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/FeaturestoreOnlineServingServiceClientTest.php b/AiPlatform/tests/Unit/V1/FeaturestoreOnlineServingServiceClientTest.php deleted file mode 100644 index 6979e443a946..000000000000 --- a/AiPlatform/tests/Unit/V1/FeaturestoreOnlineServingServiceClientTest.php +++ /dev/null @@ -1,601 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FeaturestoreOnlineServingServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FeaturestoreOnlineServingServiceClient($options); - } - - /** @test */ - public function readFeatureValuesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ReadFeatureValuesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $entityId = 'entityId-740565257'; - $featureSelector = new FeatureSelector(); - $featureSelectorIdMatcher = new IdMatcher(); - $idMatcherIds = []; - $featureSelectorIdMatcher->setIds($idMatcherIds); - $featureSelector->setIdMatcher($featureSelectorIdMatcher); - $response = $gapicClient->readFeatureValues($formattedEntityType, $entityId, $featureSelector); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/ReadFeatureValues', $actualFuncCall); - $actualValue = $actualRequestObject->getEntityType(); - $this->assertProtobufEquals($formattedEntityType, $actualValue); - $actualValue = $actualRequestObject->getEntityId(); - $this->assertProtobufEquals($entityId, $actualValue); - $actualValue = $actualRequestObject->getFeatureSelector(); - $this->assertProtobufEquals($featureSelector, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readFeatureValuesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $entityId = 'entityId-740565257'; - $featureSelector = new FeatureSelector(); - $featureSelectorIdMatcher = new IdMatcher(); - $idMatcherIds = []; - $featureSelectorIdMatcher->setIds($idMatcherIds); - $featureSelector->setIdMatcher($featureSelectorIdMatcher); - try { - $gapicClient->readFeatureValues($formattedEntityType, $entityId, $featureSelector); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingReadFeatureValuesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ReadFeatureValuesResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new ReadFeatureValuesResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new ReadFeatureValuesResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $entityIds = []; - $featureSelector = new FeatureSelector(); - $featureSelectorIdMatcher = new IdMatcher(); - $idMatcherIds = []; - $featureSelectorIdMatcher->setIds($idMatcherIds); - $featureSelector->setIdMatcher($featureSelectorIdMatcher); - $serverStream = $gapicClient->streamingReadFeatureValues($formattedEntityType, $entityIds, $featureSelector); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/StreamingReadFeatureValues', $actualFuncCall); - $actualValue = $actualRequestObject->getEntityType(); - $this->assertProtobufEquals($formattedEntityType, $actualValue); - $actualValue = $actualRequestObject->getEntityIds(); - $this->assertProtobufEquals($entityIds, $actualValue); - $actualValue = $actualRequestObject->getFeatureSelector(); - $this->assertProtobufEquals($featureSelector, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingReadFeatureValuesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $entityIds = []; - $featureSelector = new FeatureSelector(); - $featureSelectorIdMatcher = new IdMatcher(); - $idMatcherIds = []; - $featureSelectorIdMatcher->setIds($idMatcherIds); - $featureSelector->setIdMatcher($featureSelectorIdMatcher); - $serverStream = $gapicClient->streamingReadFeatureValues($formattedEntityType, $entityIds, $featureSelector); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function writeFeatureValuesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new WriteFeatureValuesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $payloads = []; - $response = $gapicClient->writeFeatureValues($formattedEntityType, $payloads); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/WriteFeatureValues', $actualFuncCall); - $actualValue = $actualRequestObject->getEntityType(); - $this->assertProtobufEquals($formattedEntityType, $actualValue); - $actualValue = $actualRequestObject->getPayloads(); - $this->assertProtobufEquals($payloads, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function writeFeatureValuesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $payloads = []; - try { - $gapicClient->writeFeatureValues($formattedEntityType, $payloads); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/FeaturestoreServiceClientTest.php b/AiPlatform/tests/Unit/V1/FeaturestoreServiceClientTest.php deleted file mode 100644 index 9ff4b63043f5..000000000000 --- a/AiPlatform/tests/Unit/V1/FeaturestoreServiceClientTest.php +++ /dev/null @@ -1,2498 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FeaturestoreServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FeaturestoreServiceClient($options); - } - - /** @test */ - public function batchCreateFeaturesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchCreateFeaturesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new BatchCreateFeaturesResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/batchCreateFeaturesTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $requests = []; - $response = $gapicClient->batchCreateFeatures($formattedParent, $requests); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/BatchCreateFeatures', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getRequests(); - $this->assertProtobufEquals($requests, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchCreateFeaturesTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function batchCreateFeaturesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchCreateFeaturesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $requests = []; - $response = $gapicClient->batchCreateFeatures($formattedParent, $requests); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchCreateFeaturesTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function batchReadFeatureValuesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchReadFeatureValuesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new BatchReadFeatureValuesResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/batchReadFeatureValuesTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedFeaturestore = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $destination = new FeatureValueDestination(); - $entityTypeSpecs = []; - $response = $gapicClient->batchReadFeatureValues($formattedFeaturestore, $destination, $entityTypeSpecs); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/BatchReadFeatureValues', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFeaturestore(); - $this->assertProtobufEquals($formattedFeaturestore, $actualValue); - $actualValue = $actualApiRequestObject->getDestination(); - $this->assertProtobufEquals($destination, $actualValue); - $actualValue = $actualApiRequestObject->getEntityTypeSpecs(); - $this->assertProtobufEquals($entityTypeSpecs, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchReadFeatureValuesTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function batchReadFeatureValuesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchReadFeatureValuesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedFeaturestore = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $destination = new FeatureValueDestination(); - $entityTypeSpecs = []; - $response = $gapicClient->batchReadFeatureValues($formattedFeaturestore, $destination, $entityTypeSpecs); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchReadFeatureValuesTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createEntityTypeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createEntityTypeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $offlineStorageTtlDays = 844678422; - $expectedResponse = new EntityType(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setOfflineStorageTtlDays($offlineStorageTtlDays); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createEntityTypeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $entityTypeId = 'entityTypeId1181734884'; - $response = $gapicClient->createEntityType($formattedParent, $entityTypeId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/CreateEntityType', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getEntityTypeId(); - $this->assertProtobufEquals($entityTypeId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createEntityTypeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createEntityTypeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createEntityTypeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $entityTypeId = 'entityTypeId1181734884'; - $response = $gapicClient->createEntityType($formattedParent, $entityTypeId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createEntityTypeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeatureTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $disableMonitoring = false; - $versionColumnName = 'versionColumnName-1981743891'; - $pointOfContact = 'pointOfContact1207498695'; - $expectedResponse = new Feature(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setDisableMonitoring($disableMonitoring); - $expectedResponse->setVersionColumnName($versionColumnName); - $expectedResponse->setPointOfContact($pointOfContact); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFeatureTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $feature = new Feature(); - $featureId = 'featureId-150697212'; - $response = $gapicClient->createFeature($formattedParent, $feature, $featureId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/CreateFeature', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFeature(); - $this->assertProtobufEquals($feature, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureId(); - $this->assertProtobufEquals($featureId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeatureExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $feature = new Feature(); - $featureId = 'featureId-150697212'; - $response = $gapicClient->createFeature($formattedParent, $feature, $featureId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeatureTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeaturestoreTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeaturestoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $etag = 'etag3123477'; - $onlineStorageTtlDays = 1491501178; - $expectedResponse = new Featurestore(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $expectedResponse->setOnlineStorageTtlDays($onlineStorageTtlDays); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createFeaturestoreTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $featurestore = new Featurestore(); - $featurestoreId = 'featurestoreId-2136676817'; - $response = $gapicClient->createFeaturestore($formattedParent, $featurestore, $featurestoreId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/CreateFeaturestore', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFeaturestore(); - $this->assertProtobufEquals($featurestore, $actualValue); - $actualValue = $actualApiRequestObject->getFeaturestoreId(); - $this->assertProtobufEquals($featurestoreId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeaturestoreTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createFeaturestoreExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createFeaturestoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $featurestore = new Featurestore(); - $featurestoreId = 'featurestoreId-2136676817'; - $response = $gapicClient->createFeaturestore($formattedParent, $featurestore, $featurestoreId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createFeaturestoreTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteEntityTypeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteEntityTypeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteEntityTypeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $response = $gapicClient->deleteEntityType($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/DeleteEntityType', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteEntityTypeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteEntityTypeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteEntityTypeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $response = $gapicClient->deleteEntityType($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteEntityTypeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFeatureTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $response = $gapicClient->deleteFeature($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeature', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $response = $gapicClient->deleteFeature($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureValuesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureValuesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new DeleteFeatureValuesResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFeatureValuesTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $response = $gapicClient->deleteFeatureValues($formattedEntityType); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeatureValues', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getEntityType(); - $this->assertProtobufEquals($formattedEntityType, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureValuesTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeatureValuesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureValuesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $response = $gapicClient->deleteFeatureValues($formattedEntityType); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureValuesTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeaturestoreTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeaturestoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFeaturestoreTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $response = $gapicClient->deleteFeaturestore($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeaturestore', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeaturestoreTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteFeaturestoreExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeaturestoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $response = $gapicClient->deleteFeaturestore($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeaturestoreTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function exportFeatureValuesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/exportFeatureValuesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new ExportFeatureValuesResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/exportFeatureValuesTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $destination = new FeatureValueDestination(); - $featureSelector = new FeatureSelector(); - $featureSelectorIdMatcher = new IdMatcher(); - $idMatcherIds = []; - $featureSelectorIdMatcher->setIds($idMatcherIds); - $featureSelector->setIdMatcher($featureSelectorIdMatcher); - $response = $gapicClient->exportFeatureValues($formattedEntityType, $destination, $featureSelector); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/ExportFeatureValues', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getEntityType(); - $this->assertProtobufEquals($formattedEntityType, $actualValue); - $actualValue = $actualApiRequestObject->getDestination(); - $this->assertProtobufEquals($destination, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureSelector(); - $this->assertProtobufEquals($featureSelector, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/exportFeatureValuesTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function exportFeatureValuesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/exportFeatureValuesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $destination = new FeatureValueDestination(); - $featureSelector = new FeatureSelector(); - $featureSelectorIdMatcher = new IdMatcher(); - $idMatcherIds = []; - $featureSelectorIdMatcher->setIds($idMatcherIds); - $featureSelector->setIdMatcher($featureSelectorIdMatcher); - $response = $gapicClient->exportFeatureValues($formattedEntityType, $destination, $featureSelector); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/exportFeatureValuesTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getEntityTypeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $offlineStorageTtlDays = 844678422; - $expectedResponse = new EntityType(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setOfflineStorageTtlDays($offlineStorageTtlDays); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $response = $gapicClient->getEntityType($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/GetEntityType', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEntityTypeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - try { - $gapicClient->getEntityType($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $disableMonitoring = false; - $versionColumnName = 'versionColumnName-1981743891'; - $pointOfContact = 'pointOfContact1207498695'; - $expectedResponse = new Feature(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setDisableMonitoring($disableMonitoring); - $expectedResponse->setVersionColumnName($versionColumnName); - $expectedResponse->setPointOfContact($pointOfContact); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - $response = $gapicClient->getFeature($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/GetFeature', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeatureExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featureName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]', '[FEATURE]'); - try { - $gapicClient->getFeature($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeaturestoreTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $onlineStorageTtlDays = 1491501178; - $expectedResponse = new Featurestore(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $expectedResponse->setOnlineStorageTtlDays($onlineStorageTtlDays); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $response = $gapicClient->getFeaturestore($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/GetFeaturestore', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFeaturestoreExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - try { - $gapicClient->getFeaturestore($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function importFeatureValuesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/importFeatureValuesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $importedEntityCount = 1840044274; - $importedFeatureValueCount = 1221471427; - $invalidRowCount = 366655966; - $timestampOutsideRetentionRowsCount = 43092019; - $expectedResponse = new ImportFeatureValuesResponse(); - $expectedResponse->setImportedEntityCount($importedEntityCount); - $expectedResponse->setImportedFeatureValueCount($importedFeatureValueCount); - $expectedResponse->setInvalidRowCount($invalidRowCount); - $expectedResponse->setTimestampOutsideRetentionRowsCount($timestampOutsideRetentionRowsCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/importFeatureValuesTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $featureSpecs = []; - $response = $gapicClient->importFeatureValues($formattedEntityType, $featureSpecs); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/ImportFeatureValues', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getEntityType(); - $this->assertProtobufEquals($formattedEntityType, $actualValue); - $actualValue = $actualApiRequestObject->getFeatureSpecs(); - $this->assertProtobufEquals($featureSpecs, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/importFeatureValuesTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function importFeatureValuesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/importFeatureValuesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedEntityType = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $featureSpecs = []; - $response = $gapicClient->importFeatureValues($formattedEntityType, $featureSpecs); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/importFeatureValuesTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function listEntityTypesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $entityTypesElement = new EntityType(); - $entityTypes = [ - $entityTypesElement, - ]; - $expectedResponse = new ListEntityTypesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setEntityTypes($entityTypes); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - $response = $gapicClient->listEntityTypes($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getEntityTypes()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/ListEntityTypes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listEntityTypesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->featurestoreName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]'); - try { - $gapicClient->listEntityTypes($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeaturesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $featuresElement = new Feature(); - $features = [ - $featuresElement, - ]; - $expectedResponse = new ListFeaturesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFeatures($features); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - $response = $gapicClient->listFeatures($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFeatures()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/ListFeatures', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeaturesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->entityTypeName('[PROJECT]', '[LOCATION]', '[FEATURESTORE]', '[ENTITY_TYPE]'); - try { - $gapicClient->listFeatures($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeaturestoresTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $featurestoresElement = new Featurestore(); - $featurestores = [ - $featurestoresElement, - ]; - $expectedResponse = new ListFeaturestoresResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFeaturestores($featurestores); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listFeaturestores($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFeaturestores()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/ListFeaturestores', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listFeaturestoresExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listFeaturestores($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchFeaturesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $featuresElement = new Feature(); - $features = [ - $featuresElement, - ]; - $expectedResponse = new SearchFeaturesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setFeatures($features); - $transport->addResponse($expectedResponse); - // Mock request - $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->searchFeatures($formattedLocation); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getFeatures()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/SearchFeatures', $actualFuncCall); - $actualValue = $actualRequestObject->getLocation(); - $this->assertProtobufEquals($formattedLocation, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchFeaturesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedLocation = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->searchFeatures($formattedLocation); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateEntityTypeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $offlineStorageTtlDays = 844678422; - $expectedResponse = new EntityType(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setOfflineStorageTtlDays($offlineStorageTtlDays); - $transport->addResponse($expectedResponse); - // Mock request - $entityType = new EntityType(); - $response = $gapicClient->updateEntityType($entityType); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/UpdateEntityType', $actualFuncCall); - $actualValue = $actualRequestObject->getEntityType(); - $this->assertProtobufEquals($entityType, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateEntityTypeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $entityType = new EntityType(); - try { - $gapicClient->updateEntityType($entityType); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateFeatureTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $disableMonitoring = false; - $versionColumnName = 'versionColumnName-1981743891'; - $pointOfContact = 'pointOfContact1207498695'; - $expectedResponse = new Feature(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setDisableMonitoring($disableMonitoring); - $expectedResponse->setVersionColumnName($versionColumnName); - $expectedResponse->setPointOfContact($pointOfContact); - $transport->addResponse($expectedResponse); - // Mock request - $feature = new Feature(); - $response = $gapicClient->updateFeature($feature); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/UpdateFeature', $actualFuncCall); - $actualValue = $actualRequestObject->getFeature(); - $this->assertProtobufEquals($feature, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateFeatureExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $feature = new Feature(); - try { - $gapicClient->updateFeature($feature); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateFeaturestoreTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeaturestoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $etag = 'etag3123477'; - $onlineStorageTtlDays = 1491501178; - $expectedResponse = new Featurestore(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $expectedResponse->setOnlineStorageTtlDays($onlineStorageTtlDays); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFeaturestoreTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $featurestore = new Featurestore(); - $response = $gapicClient->updateFeaturestore($featurestore); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.FeaturestoreService/UpdateFeaturestore', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFeaturestore(); - $this->assertProtobufEquals($featurestore, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeaturestoreTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateFeaturestoreExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeaturestoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $featurestore = new Featurestore(); - $response = $gapicClient->updateFeaturestore($featurestore); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeaturestoreTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/GenAiTuningServiceClientTest.php b/AiPlatform/tests/Unit/V1/GenAiTuningServiceClientTest.php deleted file mode 100644 index 260b16c29e29..000000000000 --- a/AiPlatform/tests/Unit/V1/GenAiTuningServiceClientTest.php +++ /dev/null @@ -1,642 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return GenAiTuningServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new GenAiTuningServiceClient($options); - } - - /** @test */ - public function cancelTuningJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - $gapicClient->cancelTuningJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.GenAiTuningService/CancelTuningJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelTuningJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - try { - $gapicClient->cancelTuningJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTuningJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $baseModel = 'baseModel-480754629'; - $name = 'name3373707'; - $tunedModelDisplayName = 'tunedModelDisplayName358986993'; - $description = 'description-1724546052'; - $experiment = 'experiment-85337091'; - $expectedResponse = new TuningJob(); - $expectedResponse->setBaseModel($baseModel); - $expectedResponse->setName($name); - $expectedResponse->setTunedModelDisplayName($tunedModelDisplayName); - $expectedResponse->setDescription($description); - $expectedResponse->setExperiment($experiment); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $tuningJob = new TuningJob(); - $response = $gapicClient->createTuningJob($formattedParent, $tuningJob); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.GenAiTuningService/CreateTuningJob', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getTuningJob(); - $this->assertProtobufEquals($tuningJob, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTuningJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $tuningJob = new TuningJob(); - try { - $gapicClient->createTuningJob($formattedParent, $tuningJob); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTuningJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $baseModel = 'baseModel-480754629'; - $name2 = 'name2-1052831874'; - $tunedModelDisplayName = 'tunedModelDisplayName358986993'; - $description = 'description-1724546052'; - $experiment = 'experiment-85337091'; - $expectedResponse = new TuningJob(); - $expectedResponse->setBaseModel($baseModel); - $expectedResponse->setName($name2); - $expectedResponse->setTunedModelDisplayName($tunedModelDisplayName); - $expectedResponse->setDescription($description); - $expectedResponse->setExperiment($experiment); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - $response = $gapicClient->getTuningJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.GenAiTuningService/GetTuningJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTuningJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tuningJobName('[PROJECT]', '[LOCATION]', '[TUNING_JOB]'); - try { - $gapicClient->getTuningJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTuningJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $tuningJobsElement = new TuningJob(); - $tuningJobs = [ - $tuningJobsElement, - ]; - $expectedResponse = new ListTuningJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTuningJobs($tuningJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listTuningJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTuningJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.GenAiTuningService/ListTuningJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTuningJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listTuningJobs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/IndexEndpointServiceClientTest.php b/AiPlatform/tests/Unit/V1/IndexEndpointServiceClientTest.php deleted file mode 100644 index d3cb83c22d93..000000000000 --- a/AiPlatform/tests/Unit/V1/IndexEndpointServiceClientTest.php +++ /dev/null @@ -1,1247 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return IndexEndpointServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new IndexEndpointServiceClient($options); - } - - /** @test */ - public function createIndexEndpointTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createIndexEndpointTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $network = 'network1843485230'; - $enablePrivateServiceConnect = true; - $publicEndpointEnabled = false; - $publicEndpointDomainName = 'publicEndpointDomainName2015998354'; - $expectedResponse = new IndexEndpoint(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setNetwork($network); - $expectedResponse->setEnablePrivateServiceConnect($enablePrivateServiceConnect); - $expectedResponse->setPublicEndpointEnabled($publicEndpointEnabled); - $expectedResponse->setPublicEndpointDomainName($publicEndpointDomainName); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createIndexEndpointTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $indexEndpoint = new IndexEndpoint(); - $indexEndpointDisplayName = 'indexEndpointDisplayName-894895258'; - $indexEndpoint->setDisplayName($indexEndpointDisplayName); - $response = $gapicClient->createIndexEndpoint($formattedParent, $indexEndpoint); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexEndpointService/CreateIndexEndpoint', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getIndexEndpoint(); - $this->assertProtobufEquals($indexEndpoint, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createIndexEndpointTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createIndexEndpointExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createIndexEndpointTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $indexEndpoint = new IndexEndpoint(); - $indexEndpointDisplayName = 'indexEndpointDisplayName-894895258'; - $indexEndpoint->setDisplayName($indexEndpointDisplayName); - $response = $gapicClient->createIndexEndpoint($formattedParent, $indexEndpoint); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createIndexEndpointTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteIndexEndpointTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteIndexEndpointTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteIndexEndpointTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $response = $gapicClient->deleteIndexEndpoint($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexEndpointService/DeleteIndexEndpoint', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteIndexEndpointTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteIndexEndpointExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteIndexEndpointTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $response = $gapicClient->deleteIndexEndpoint($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteIndexEndpointTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deployIndexTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deployIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new DeployIndexResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deployIndexTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $deployedIndex = new DeployedIndex(); - $deployedIndexId = 'deployedIndexId-1101212953'; - $deployedIndex->setId($deployedIndexId); - $deployedIndexIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $deployedIndex->setIndex($deployedIndexIndex); - $response = $gapicClient->deployIndex($formattedIndexEndpoint, $deployedIndex); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexEndpointService/DeployIndex', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getIndexEndpoint(); - $this->assertProtobufEquals($formattedIndexEndpoint, $actualValue); - $actualValue = $actualApiRequestObject->getDeployedIndex(); - $this->assertProtobufEquals($deployedIndex, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deployIndexTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deployIndexExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deployIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $deployedIndex = new DeployedIndex(); - $deployedIndexId = 'deployedIndexId-1101212953'; - $deployedIndex->setId($deployedIndexId); - $deployedIndexIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $deployedIndex->setIndex($deployedIndexIndex); - $response = $gapicClient->deployIndex($formattedIndexEndpoint, $deployedIndex); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deployIndexTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getIndexEndpointTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $network = 'network1843485230'; - $enablePrivateServiceConnect = true; - $publicEndpointEnabled = false; - $publicEndpointDomainName = 'publicEndpointDomainName2015998354'; - $expectedResponse = new IndexEndpoint(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setNetwork($network); - $expectedResponse->setEnablePrivateServiceConnect($enablePrivateServiceConnect); - $expectedResponse->setPublicEndpointEnabled($publicEndpointEnabled); - $expectedResponse->setPublicEndpointDomainName($publicEndpointDomainName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $response = $gapicClient->getIndexEndpoint($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexEndpointService/GetIndexEndpoint', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIndexEndpointExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - try { - $gapicClient->getIndexEndpoint($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listIndexEndpointsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $indexEndpointsElement = new IndexEndpoint(); - $indexEndpoints = [ - $indexEndpointsElement, - ]; - $expectedResponse = new ListIndexEndpointsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setIndexEndpoints($indexEndpoints); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listIndexEndpoints($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getIndexEndpoints()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexEndpointService/ListIndexEndpoints', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listIndexEndpointsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listIndexEndpoints($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function mutateDeployedIndexTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/mutateDeployedIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new MutateDeployedIndexResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/mutateDeployedIndexTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $deployedIndex = new DeployedIndex(); - $deployedIndexId = 'deployedIndexId-1101212953'; - $deployedIndex->setId($deployedIndexId); - $deployedIndexIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $deployedIndex->setIndex($deployedIndexIndex); - $response = $gapicClient->mutateDeployedIndex($formattedIndexEndpoint, $deployedIndex); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexEndpointService/MutateDeployedIndex', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getIndexEndpoint(); - $this->assertProtobufEquals($formattedIndexEndpoint, $actualValue); - $actualValue = $actualApiRequestObject->getDeployedIndex(); - $this->assertProtobufEquals($deployedIndex, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/mutateDeployedIndexTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function mutateDeployedIndexExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/mutateDeployedIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $deployedIndex = new DeployedIndex(); - $deployedIndexId = 'deployedIndexId-1101212953'; - $deployedIndex->setId($deployedIndexId); - $deployedIndexIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $deployedIndex->setIndex($deployedIndexIndex); - $response = $gapicClient->mutateDeployedIndex($formattedIndexEndpoint, $deployedIndex); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/mutateDeployedIndexTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function undeployIndexTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/undeployIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new UndeployIndexResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/undeployIndexTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $deployedIndexId = 'deployedIndexId1598189569'; - $response = $gapicClient->undeployIndex($formattedIndexEndpoint, $deployedIndexId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexEndpointService/UndeployIndex', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getIndexEndpoint(); - $this->assertProtobufEquals($formattedIndexEndpoint, $actualValue); - $actualValue = $actualApiRequestObject->getDeployedIndexId(); - $this->assertProtobufEquals($deployedIndexId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/undeployIndexTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function undeployIndexExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/undeployIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $deployedIndexId = 'deployedIndexId1598189569'; - $response = $gapicClient->undeployIndex($formattedIndexEndpoint, $deployedIndexId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/undeployIndexTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateIndexEndpointTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $network = 'network1843485230'; - $enablePrivateServiceConnect = true; - $publicEndpointEnabled = false; - $publicEndpointDomainName = 'publicEndpointDomainName2015998354'; - $expectedResponse = new IndexEndpoint(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setNetwork($network); - $expectedResponse->setEnablePrivateServiceConnect($enablePrivateServiceConnect); - $expectedResponse->setPublicEndpointEnabled($publicEndpointEnabled); - $expectedResponse->setPublicEndpointDomainName($publicEndpointDomainName); - $transport->addResponse($expectedResponse); - // Mock request - $indexEndpoint = new IndexEndpoint(); - $indexEndpointDisplayName = 'indexEndpointDisplayName-894895258'; - $indexEndpoint->setDisplayName($indexEndpointDisplayName); - $updateMask = new FieldMask(); - $response = $gapicClient->updateIndexEndpoint($indexEndpoint, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexEndpointService/UpdateIndexEndpoint', $actualFuncCall); - $actualValue = $actualRequestObject->getIndexEndpoint(); - $this->assertProtobufEquals($indexEndpoint, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateIndexEndpointExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $indexEndpoint = new IndexEndpoint(); - $indexEndpointDisplayName = 'indexEndpointDisplayName-894895258'; - $indexEndpoint->setDisplayName($indexEndpointDisplayName); - $updateMask = new FieldMask(); - try { - $gapicClient->updateIndexEndpoint($indexEndpoint, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/IndexServiceClientTest.php b/AiPlatform/tests/Unit/V1/IndexServiceClientTest.php deleted file mode 100644 index 73dc363d7e81..000000000000 --- a/AiPlatform/tests/Unit/V1/IndexServiceClientTest.php +++ /dev/null @@ -1,1018 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return IndexServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new IndexServiceClient($options); - } - - /** @test */ - public function createIndexTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $metadataSchemaUri = 'metadataSchemaUri-152319778'; - $etag = 'etag3123477'; - $expectedResponse = new Index(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setMetadataSchemaUri($metadataSchemaUri); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createIndexTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $index = new Index(); - $indexDisplayName = 'indexDisplayName-632619461'; - $index->setDisplayName($indexDisplayName); - $response = $gapicClient->createIndex($formattedParent, $index); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexService/CreateIndex', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getIndex(); - $this->assertProtobufEquals($index, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createIndexTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createIndexExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $index = new Index(); - $indexDisplayName = 'indexDisplayName-632619461'; - $index->setDisplayName($indexDisplayName); - $response = $gapicClient->createIndex($formattedParent, $index); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createIndexTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteIndexTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteIndexTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $response = $gapicClient->deleteIndex($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexService/DeleteIndex', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteIndexTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteIndexExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $response = $gapicClient->deleteIndex($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteIndexTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getIndexTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $metadataSchemaUri = 'metadataSchemaUri-152319778'; - $etag = 'etag3123477'; - $expectedResponse = new Index(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setMetadataSchemaUri($metadataSchemaUri); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $response = $gapicClient->getIndex($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexService/GetIndex', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIndexExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - try { - $gapicClient->getIndex($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listIndexesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $indexesElement = new Index(); - $indexes = [ - $indexesElement, - ]; - $expectedResponse = new ListIndexesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setIndexes($indexes); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listIndexes($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getIndexes()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexService/ListIndexes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listIndexesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listIndexes($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function removeDatapointsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new RemoveDatapointsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $response = $gapicClient->removeDatapoints($formattedIndex); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexService/RemoveDatapoints', $actualFuncCall); - $actualValue = $actualRequestObject->getIndex(); - $this->assertProtobufEquals($formattedIndex, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function removeDatapointsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - try { - $gapicClient->removeDatapoints($formattedIndex); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateIndexTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $metadataSchemaUri = 'metadataSchemaUri-152319778'; - $etag = 'etag3123477'; - $expectedResponse = new Index(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setMetadataSchemaUri($metadataSchemaUri); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateIndexTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $index = new Index(); - $indexDisplayName = 'indexDisplayName-632619461'; - $index->setDisplayName($indexDisplayName); - $response = $gapicClient->updateIndex($index); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexService/UpdateIndex', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getIndex(); - $this->assertProtobufEquals($index, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateIndexTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateIndexExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateIndexTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $index = new Index(); - $indexDisplayName = 'indexDisplayName-632619461'; - $index->setDisplayName($indexDisplayName); - $response = $gapicClient->updateIndex($index); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateIndexTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function upsertDatapointsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new UpsertDatapointsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - $response = $gapicClient->upsertDatapoints($formattedIndex); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.IndexService/UpsertDatapoints', $actualFuncCall); - $actualValue = $actualRequestObject->getIndex(); - $this->assertProtobufEquals($formattedIndex, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function upsertDatapointsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedIndex = $gapicClient->indexName('[PROJECT]', '[LOCATION]', '[INDEX]'); - try { - $gapicClient->upsertDatapoints($formattedIndex); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/JobServiceClientTest.php b/AiPlatform/tests/Unit/V1/JobServiceClientTest.php deleted file mode 100644 index f4fd5eebb1a7..000000000000 --- a/AiPlatform/tests/Unit/V1/JobServiceClientTest.php +++ /dev/null @@ -1,3237 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return JobServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new JobServiceClient($options); - } - - /** @test */ - public function cancelBatchPredictionJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $gapicClient->cancelBatchPredictionJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CancelBatchPredictionJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelBatchPredictionJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - try { - $gapicClient->cancelBatchPredictionJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelCustomJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $gapicClient->cancelCustomJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CancelCustomJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelCustomJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - try { - $gapicClient->cancelCustomJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelDataLabelingJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $gapicClient->cancelDataLabelingJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CancelDataLabelingJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelDataLabelingJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - try { - $gapicClient->cancelDataLabelingJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelHyperparameterTuningJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $gapicClient->cancelHyperparameterTuningJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CancelHyperparameterTuningJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelHyperparameterTuningJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - try { - $gapicClient->cancelHyperparameterTuningJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelNasJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $gapicClient->cancelNasJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CancelNasJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelNasJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - try { - $gapicClient->cancelNasJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createBatchPredictionJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $model = 'model104069929'; - $modelVersionId = 'modelVersionId-1385431880'; - $serviceAccount = 'serviceAccount-1948028253'; - $generateExplanation = false; - $disableContainerLogging = true; - $expectedResponse = new BatchPredictionJob(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setModel($model); - $expectedResponse->setModelVersionId($modelVersionId); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setGenerateExplanation($generateExplanation); - $expectedResponse->setDisableContainerLogging($disableContainerLogging); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $batchPredictionJob = new BatchPredictionJob(); - $batchPredictionJobDisplayName = 'batchPredictionJobDisplayName-916867527'; - $batchPredictionJob->setDisplayName($batchPredictionJobDisplayName); - $batchPredictionJobInputConfig = new InputConfig(); - $inputConfigInstancesFormat = 'inputConfigInstancesFormat883633865'; - $batchPredictionJobInputConfig->setInstancesFormat($inputConfigInstancesFormat); - $batchPredictionJob->setInputConfig($batchPredictionJobInputConfig); - $batchPredictionJobOutputConfig = new OutputConfig(); - $outputConfigPredictionsFormat = 'outputConfigPredictionsFormat999432568'; - $batchPredictionJobOutputConfig->setPredictionsFormat($outputConfigPredictionsFormat); - $batchPredictionJob->setOutputConfig($batchPredictionJobOutputConfig); - $response = $gapicClient->createBatchPredictionJob($formattedParent, $batchPredictionJob); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CreateBatchPredictionJob', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getBatchPredictionJob(); - $this->assertProtobufEquals($batchPredictionJob, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createBatchPredictionJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $batchPredictionJob = new BatchPredictionJob(); - $batchPredictionJobDisplayName = 'batchPredictionJobDisplayName-916867527'; - $batchPredictionJob->setDisplayName($batchPredictionJobDisplayName); - $batchPredictionJobInputConfig = new InputConfig(); - $inputConfigInstancesFormat = 'inputConfigInstancesFormat883633865'; - $batchPredictionJobInputConfig->setInstancesFormat($inputConfigInstancesFormat); - $batchPredictionJob->setInputConfig($batchPredictionJobInputConfig); - $batchPredictionJobOutputConfig = new OutputConfig(); - $outputConfigPredictionsFormat = 'outputConfigPredictionsFormat999432568'; - $batchPredictionJobOutputConfig->setPredictionsFormat($outputConfigPredictionsFormat); - $batchPredictionJob->setOutputConfig($batchPredictionJobOutputConfig); - try { - $gapicClient->createBatchPredictionJob($formattedParent, $batchPredictionJob); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createCustomJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $expectedResponse = new CustomJob(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $customJob = new CustomJob(); - $customJobDisplayName = 'customJobDisplayName-299624383'; - $customJob->setDisplayName($customJobDisplayName); - $customJobJobSpec = new CustomJobSpec(); - $jobSpecWorkerPoolSpecs = []; - $customJobJobSpec->setWorkerPoolSpecs($jobSpecWorkerPoolSpecs); - $customJob->setJobSpec($customJobJobSpec); - $response = $gapicClient->createCustomJob($formattedParent, $customJob); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CreateCustomJob', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getCustomJob(); - $this->assertProtobufEquals($customJob, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createCustomJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $customJob = new CustomJob(); - $customJobDisplayName = 'customJobDisplayName-299624383'; - $customJob->setDisplayName($customJobDisplayName); - $customJobJobSpec = new CustomJobSpec(); - $jobSpecWorkerPoolSpecs = []; - $customJobJobSpec->setWorkerPoolSpecs($jobSpecWorkerPoolSpecs); - $customJob->setJobSpec($customJobJobSpec); - try { - $gapicClient->createCustomJob($formattedParent, $customJob); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createDataLabelingJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $labelerCount = 1457777167; - $instructionUri = 'instructionUri1537272379'; - $inputsSchemaUri = 'inputsSchemaUri990382564'; - $labelingProgress = 685978914; - $expectedResponse = new DataLabelingJob(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setLabelerCount($labelerCount); - $expectedResponse->setInstructionUri($instructionUri); - $expectedResponse->setInputsSchemaUri($inputsSchemaUri); - $expectedResponse->setLabelingProgress($labelingProgress); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $dataLabelingJob = new DataLabelingJob(); - $dataLabelingJobDisplayName = 'dataLabelingJobDisplayName708178632'; - $dataLabelingJob->setDisplayName($dataLabelingJobDisplayName); - $dataLabelingJobDatasets = [ - $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'), - ]; - $dataLabelingJob->setDatasets($dataLabelingJobDatasets); - $dataLabelingJobLabelerCount = 500093453; - $dataLabelingJob->setLabelerCount($dataLabelingJobLabelerCount); - $dataLabelingJobInstructionUri = 'dataLabelingJobInstructionUri-886362173'; - $dataLabelingJob->setInstructionUri($dataLabelingJobInstructionUri); - $dataLabelingJobInputsSchemaUri = 'dataLabelingJobInputsSchemaUri-1486933251'; - $dataLabelingJob->setInputsSchemaUri($dataLabelingJobInputsSchemaUri); - $dataLabelingJobInputs = new Value(); - $dataLabelingJob->setInputs($dataLabelingJobInputs); - $response = $gapicClient->createDataLabelingJob($formattedParent, $dataLabelingJob); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CreateDataLabelingJob', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getDataLabelingJob(); - $this->assertProtobufEquals($dataLabelingJob, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createDataLabelingJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $dataLabelingJob = new DataLabelingJob(); - $dataLabelingJobDisplayName = 'dataLabelingJobDisplayName708178632'; - $dataLabelingJob->setDisplayName($dataLabelingJobDisplayName); - $dataLabelingJobDatasets = [ - $gapicClient->datasetName('[PROJECT]', '[LOCATION]', '[DATASET]'), - ]; - $dataLabelingJob->setDatasets($dataLabelingJobDatasets); - $dataLabelingJobLabelerCount = 500093453; - $dataLabelingJob->setLabelerCount($dataLabelingJobLabelerCount); - $dataLabelingJobInstructionUri = 'dataLabelingJobInstructionUri-886362173'; - $dataLabelingJob->setInstructionUri($dataLabelingJobInstructionUri); - $dataLabelingJobInputsSchemaUri = 'dataLabelingJobInputsSchemaUri-1486933251'; - $dataLabelingJob->setInputsSchemaUri($dataLabelingJobInputsSchemaUri); - $dataLabelingJobInputs = new Value(); - $dataLabelingJob->setInputs($dataLabelingJobInputs); - try { - $gapicClient->createDataLabelingJob($formattedParent, $dataLabelingJob); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createHyperparameterTuningJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $maxTrialCount = 445994933; - $parallelTrialCount = 1813795950; - $maxFailedTrialCount = 887662497; - $expectedResponse = new HyperparameterTuningJob(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setMaxTrialCount($maxTrialCount); - $expectedResponse->setParallelTrialCount($parallelTrialCount); - $expectedResponse->setMaxFailedTrialCount($maxFailedTrialCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $hyperparameterTuningJob = new HyperparameterTuningJob(); - $hyperparameterTuningJobDisplayName = 'hyperparameterTuningJobDisplayName279209698'; - $hyperparameterTuningJob->setDisplayName($hyperparameterTuningJobDisplayName); - $hyperparameterTuningJobStudySpec = new StudySpec(); - $studySpecMetrics = []; - $hyperparameterTuningJobStudySpec->setMetrics($studySpecMetrics); - $studySpecParameters = []; - $hyperparameterTuningJobStudySpec->setParameters($studySpecParameters); - $hyperparameterTuningJob->setStudySpec($hyperparameterTuningJobStudySpec); - $hyperparameterTuningJobMaxTrialCount = 1019368622; - $hyperparameterTuningJob->setMaxTrialCount($hyperparameterTuningJobMaxTrialCount); - $hyperparameterTuningJobParallelTrialCount = 1531269397; - $hyperparameterTuningJob->setParallelTrialCount($hyperparameterTuningJobParallelTrialCount); - $hyperparameterTuningJobTrialJobSpec = new CustomJobSpec(); - $trialJobSpecWorkerPoolSpecs = []; - $hyperparameterTuningJobTrialJobSpec->setWorkerPoolSpecs($trialJobSpecWorkerPoolSpecs); - $hyperparameterTuningJob->setTrialJobSpec($hyperparameterTuningJobTrialJobSpec); - $response = $gapicClient->createHyperparameterTuningJob($formattedParent, $hyperparameterTuningJob); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CreateHyperparameterTuningJob', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getHyperparameterTuningJob(); - $this->assertProtobufEquals($hyperparameterTuningJob, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createHyperparameterTuningJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $hyperparameterTuningJob = new HyperparameterTuningJob(); - $hyperparameterTuningJobDisplayName = 'hyperparameterTuningJobDisplayName279209698'; - $hyperparameterTuningJob->setDisplayName($hyperparameterTuningJobDisplayName); - $hyperparameterTuningJobStudySpec = new StudySpec(); - $studySpecMetrics = []; - $hyperparameterTuningJobStudySpec->setMetrics($studySpecMetrics); - $studySpecParameters = []; - $hyperparameterTuningJobStudySpec->setParameters($studySpecParameters); - $hyperparameterTuningJob->setStudySpec($hyperparameterTuningJobStudySpec); - $hyperparameterTuningJobMaxTrialCount = 1019368622; - $hyperparameterTuningJob->setMaxTrialCount($hyperparameterTuningJobMaxTrialCount); - $hyperparameterTuningJobParallelTrialCount = 1531269397; - $hyperparameterTuningJob->setParallelTrialCount($hyperparameterTuningJobParallelTrialCount); - $hyperparameterTuningJobTrialJobSpec = new CustomJobSpec(); - $trialJobSpecWorkerPoolSpecs = []; - $hyperparameterTuningJobTrialJobSpec->setWorkerPoolSpecs($trialJobSpecWorkerPoolSpecs); - $hyperparameterTuningJob->setTrialJobSpec($hyperparameterTuningJobTrialJobSpec); - try { - $gapicClient->createHyperparameterTuningJob($formattedParent, $hyperparameterTuningJob); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createModelDeploymentMonitoringJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $endpoint = 'endpoint1741102485'; - $predictInstanceSchemaUri = 'predictInstanceSchemaUri1705398098'; - $analysisInstanceSchemaUri = 'analysisInstanceSchemaUri1555410389'; - $enableMonitoringPipelineLogs = false; - $expectedResponse = new ModelDeploymentMonitoringJob(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEndpoint($endpoint); - $expectedResponse->setPredictInstanceSchemaUri($predictInstanceSchemaUri); - $expectedResponse->setAnalysisInstanceSchemaUri($analysisInstanceSchemaUri); - $expectedResponse->setEnableMonitoringPipelineLogs($enableMonitoringPipelineLogs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $modelDeploymentMonitoringJob = new ModelDeploymentMonitoringJob(); - $modelDeploymentMonitoringJobDisplayName = 'modelDeploymentMonitoringJobDisplayName-563611194'; - $modelDeploymentMonitoringJob->setDisplayName($modelDeploymentMonitoringJobDisplayName); - $modelDeploymentMonitoringJobEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $modelDeploymentMonitoringJob->setEndpoint($modelDeploymentMonitoringJobEndpoint); - $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = []; - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs($modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = new ModelDeploymentMonitoringScheduleConfig(); - $modelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration(); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval($modelDeploymentMonitoringScheduleConfigMonitorInterval); - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig($modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig); - $modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy(); - $modelDeploymentMonitoringJob->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy); - $response = $gapicClient->createModelDeploymentMonitoringJob($formattedParent, $modelDeploymentMonitoringJob); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CreateModelDeploymentMonitoringJob', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getModelDeploymentMonitoringJob(); - $this->assertProtobufEquals($modelDeploymentMonitoringJob, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createModelDeploymentMonitoringJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $modelDeploymentMonitoringJob = new ModelDeploymentMonitoringJob(); - $modelDeploymentMonitoringJobDisplayName = 'modelDeploymentMonitoringJobDisplayName-563611194'; - $modelDeploymentMonitoringJob->setDisplayName($modelDeploymentMonitoringJobDisplayName); - $modelDeploymentMonitoringJobEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $modelDeploymentMonitoringJob->setEndpoint($modelDeploymentMonitoringJobEndpoint); - $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = []; - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs($modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = new ModelDeploymentMonitoringScheduleConfig(); - $modelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration(); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval($modelDeploymentMonitoringScheduleConfigMonitorInterval); - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig($modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig); - $modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy(); - $modelDeploymentMonitoringJob->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy); - try { - $gapicClient->createModelDeploymentMonitoringJob($formattedParent, $modelDeploymentMonitoringJob); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createNasJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $enableRestrictedImageTraining = true; - $expectedResponse = new NasJob(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEnableRestrictedImageTraining($enableRestrictedImageTraining); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $nasJob = new NasJob(); - $nasJobDisplayName = 'nasJobDisplayName-279570512'; - $nasJob->setDisplayName($nasJobDisplayName); - $nasJobNasJobSpec = new NasJobSpec(); - $nasJob->setNasJobSpec($nasJobNasJobSpec); - $response = $gapicClient->createNasJob($formattedParent, $nasJob); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/CreateNasJob', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getNasJob(); - $this->assertProtobufEquals($nasJob, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createNasJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $nasJob = new NasJob(); - $nasJobDisplayName = 'nasJobDisplayName-279570512'; - $nasJob->setDisplayName($nasJobDisplayName); - $nasJobNasJobSpec = new NasJobSpec(); - $nasJob->setNasJobSpec($nasJobNasJobSpec); - try { - $gapicClient->createNasJob($formattedParent, $nasJob); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteBatchPredictionJobTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteBatchPredictionJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteBatchPredictionJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $response = $gapicClient->deleteBatchPredictionJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/DeleteBatchPredictionJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteBatchPredictionJobTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteBatchPredictionJobExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteBatchPredictionJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $response = $gapicClient->deleteBatchPredictionJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteBatchPredictionJobTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteCustomJobTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteCustomJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteCustomJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $response = $gapicClient->deleteCustomJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/DeleteCustomJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteCustomJobTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteCustomJobExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteCustomJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $response = $gapicClient->deleteCustomJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteCustomJobTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteDataLabelingJobTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteDataLabelingJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteDataLabelingJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $response = $gapicClient->deleteDataLabelingJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/DeleteDataLabelingJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDataLabelingJobTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteDataLabelingJobExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteDataLabelingJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $response = $gapicClient->deleteDataLabelingJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDataLabelingJobTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteHyperparameterTuningJobTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteHyperparameterTuningJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteHyperparameterTuningJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $response = $gapicClient->deleteHyperparameterTuningJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/DeleteHyperparameterTuningJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteHyperparameterTuningJobTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteHyperparameterTuningJobExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteHyperparameterTuningJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $response = $gapicClient->deleteHyperparameterTuningJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteHyperparameterTuningJobTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteModelDeploymentMonitoringJobTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteModelDeploymentMonitoringJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteModelDeploymentMonitoringJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $response = $gapicClient->deleteModelDeploymentMonitoringJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/DeleteModelDeploymentMonitoringJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteModelDeploymentMonitoringJobTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteModelDeploymentMonitoringJobExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteModelDeploymentMonitoringJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $response = $gapicClient->deleteModelDeploymentMonitoringJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteModelDeploymentMonitoringJobTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteNasJobTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteNasJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteNasJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $response = $gapicClient->deleteNasJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/DeleteNasJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNasJobTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteNasJobExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteNasJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $response = $gapicClient->deleteNasJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNasJobTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getBatchPredictionJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $model = 'model104069929'; - $modelVersionId = 'modelVersionId-1385431880'; - $serviceAccount = 'serviceAccount-1948028253'; - $generateExplanation = false; - $disableContainerLogging = true; - $expectedResponse = new BatchPredictionJob(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setModel($model); - $expectedResponse->setModelVersionId($modelVersionId); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setGenerateExplanation($generateExplanation); - $expectedResponse->setDisableContainerLogging($disableContainerLogging); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - $response = $gapicClient->getBatchPredictionJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/GetBatchPredictionJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getBatchPredictionJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]'); - try { - $gapicClient->getBatchPredictionJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getCustomJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $expectedResponse = new CustomJob(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - $response = $gapicClient->getCustomJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/GetCustomJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getCustomJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]'); - try { - $gapicClient->getCustomJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDataLabelingJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $labelerCount = 1457777167; - $instructionUri = 'instructionUri1537272379'; - $inputsSchemaUri = 'inputsSchemaUri990382564'; - $labelingProgress = 685978914; - $expectedResponse = new DataLabelingJob(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setLabelerCount($labelerCount); - $expectedResponse->setInstructionUri($instructionUri); - $expectedResponse->setInputsSchemaUri($inputsSchemaUri); - $expectedResponse->setLabelingProgress($labelingProgress); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - $response = $gapicClient->getDataLabelingJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/GetDataLabelingJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDataLabelingJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->dataLabelingJobName('[PROJECT]', '[LOCATION]', '[DATA_LABELING_JOB]'); - try { - $gapicClient->getDataLabelingJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getHyperparameterTuningJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $maxTrialCount = 445994933; - $parallelTrialCount = 1813795950; - $maxFailedTrialCount = 887662497; - $expectedResponse = new HyperparameterTuningJob(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setMaxTrialCount($maxTrialCount); - $expectedResponse->setParallelTrialCount($parallelTrialCount); - $expectedResponse->setMaxFailedTrialCount($maxFailedTrialCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - $response = $gapicClient->getHyperparameterTuningJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/GetHyperparameterTuningJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getHyperparameterTuningJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->hyperparameterTuningJobName('[PROJECT]', '[LOCATION]', '[HYPERPARAMETER_TUNING_JOB]'); - try { - $gapicClient->getHyperparameterTuningJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getModelDeploymentMonitoringJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $endpoint = 'endpoint1741102485'; - $predictInstanceSchemaUri = 'predictInstanceSchemaUri1705398098'; - $analysisInstanceSchemaUri = 'analysisInstanceSchemaUri1555410389'; - $enableMonitoringPipelineLogs = false; - $expectedResponse = new ModelDeploymentMonitoringJob(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEndpoint($endpoint); - $expectedResponse->setPredictInstanceSchemaUri($predictInstanceSchemaUri); - $expectedResponse->setAnalysisInstanceSchemaUri($analysisInstanceSchemaUri); - $expectedResponse->setEnableMonitoringPipelineLogs($enableMonitoringPipelineLogs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $response = $gapicClient->getModelDeploymentMonitoringJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/GetModelDeploymentMonitoringJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getModelDeploymentMonitoringJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - try { - $gapicClient->getModelDeploymentMonitoringJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNasJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $enableRestrictedImageTraining = true; - $expectedResponse = new NasJob(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEnableRestrictedImageTraining($enableRestrictedImageTraining); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $response = $gapicClient->getNasJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/GetNasJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNasJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - try { - $gapicClient->getNasJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNasTrialDetailTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $parameters = 'parameters458736106'; - $expectedResponse = new NasTrialDetail(); - $expectedResponse->setName($name2); - $expectedResponse->setParameters($parameters); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->nasTrialDetailName('[PROJECT]', '[LOCATION]', '[NAS_JOB]', '[NAS_TRIAL_DETAIL]'); - $response = $gapicClient->getNasTrialDetail($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/GetNasTrialDetail', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNasTrialDetailExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->nasTrialDetailName('[PROJECT]', '[LOCATION]', '[NAS_JOB]', '[NAS_TRIAL_DETAIL]'); - try { - $gapicClient->getNasTrialDetail($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBatchPredictionJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $batchPredictionJobsElement = new BatchPredictionJob(); - $batchPredictionJobs = [ - $batchPredictionJobsElement, - ]; - $expectedResponse = new ListBatchPredictionJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setBatchPredictionJobs($batchPredictionJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listBatchPredictionJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getBatchPredictionJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/ListBatchPredictionJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBatchPredictionJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listBatchPredictionJobs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listCustomJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $customJobsElement = new CustomJob(); - $customJobs = [ - $customJobsElement, - ]; - $expectedResponse = new ListCustomJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setCustomJobs($customJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listCustomJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getCustomJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/ListCustomJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listCustomJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listCustomJobs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDataLabelingJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $dataLabelingJobsElement = new DataLabelingJob(); - $dataLabelingJobs = [ - $dataLabelingJobsElement, - ]; - $expectedResponse = new ListDataLabelingJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDataLabelingJobs($dataLabelingJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listDataLabelingJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDataLabelingJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/ListDataLabelingJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDataLabelingJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listDataLabelingJobs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listHyperparameterTuningJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $hyperparameterTuningJobsElement = new HyperparameterTuningJob(); - $hyperparameterTuningJobs = [ - $hyperparameterTuningJobsElement, - ]; - $expectedResponse = new ListHyperparameterTuningJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setHyperparameterTuningJobs($hyperparameterTuningJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listHyperparameterTuningJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getHyperparameterTuningJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/ListHyperparameterTuningJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listHyperparameterTuningJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listHyperparameterTuningJobs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelDeploymentMonitoringJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $modelDeploymentMonitoringJobsElement = new ModelDeploymentMonitoringJob(); - $modelDeploymentMonitoringJobs = [ - $modelDeploymentMonitoringJobsElement, - ]; - $expectedResponse = new ListModelDeploymentMonitoringJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setModelDeploymentMonitoringJobs($modelDeploymentMonitoringJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listModelDeploymentMonitoringJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getModelDeploymentMonitoringJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/ListModelDeploymentMonitoringJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelDeploymentMonitoringJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listModelDeploymentMonitoringJobs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNasJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $nasJobsElement = new NasJob(); - $nasJobs = [ - $nasJobsElement, - ]; - $expectedResponse = new ListNasJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setNasJobs($nasJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listNasJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNasJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/ListNasJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNasJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listNasJobs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNasTrialDetailsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $nasTrialDetailsElement = new NasTrialDetail(); - $nasTrialDetails = [ - $nasTrialDetailsElement, - ]; - $expectedResponse = new ListNasTrialDetailsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setNasTrialDetails($nasTrialDetails); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - $response = $gapicClient->listNasTrialDetails($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNasTrialDetails()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/ListNasTrialDetails', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNasTrialDetailsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]'); - try { - $gapicClient->listNasTrialDetails($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pauseModelDeploymentMonitoringJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $gapicClient->pauseModelDeploymentMonitoringJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/PauseModelDeploymentMonitoringJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pauseModelDeploymentMonitoringJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - try { - $gapicClient->pauseModelDeploymentMonitoringJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function resumeModelDeploymentMonitoringJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $gapicClient->resumeModelDeploymentMonitoringJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/ResumeModelDeploymentMonitoringJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function resumeModelDeploymentMonitoringJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - try { - $gapicClient->resumeModelDeploymentMonitoringJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchModelDeploymentMonitoringStatsAnomaliesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $monitoringStatsElement = new ModelMonitoringStatsAnomalies(); - $monitoringStats = [ - $monitoringStatsElement, - ]; - $expectedResponse = new SearchModelDeploymentMonitoringStatsAnomaliesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setMonitoringStats($monitoringStats); - $transport->addResponse($expectedResponse); - // Mock request - $formattedModelDeploymentMonitoringJob = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $deployedModelId = 'deployedModelId866642506'; - $objectives = []; - $response = $gapicClient->searchModelDeploymentMonitoringStatsAnomalies($formattedModelDeploymentMonitoringJob, $deployedModelId, $objectives); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getMonitoringStats()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/SearchModelDeploymentMonitoringStatsAnomalies', $actualFuncCall); - $actualValue = $actualRequestObject->getModelDeploymentMonitoringJob(); - $this->assertProtobufEquals($formattedModelDeploymentMonitoringJob, $actualValue); - $actualValue = $actualRequestObject->getDeployedModelId(); - $this->assertProtobufEquals($deployedModelId, $actualValue); - $actualValue = $actualRequestObject->getObjectives(); - $this->assertProtobufEquals($objectives, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchModelDeploymentMonitoringStatsAnomaliesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedModelDeploymentMonitoringJob = $gapicClient->modelDeploymentMonitoringJobName('[PROJECT]', '[LOCATION]', '[MODEL_DEPLOYMENT_MONITORING_JOB]'); - $deployedModelId = 'deployedModelId866642506'; - $objectives = []; - try { - $gapicClient->searchModelDeploymentMonitoringStatsAnomalies($formattedModelDeploymentMonitoringJob, $deployedModelId, $objectives); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateModelDeploymentMonitoringJobTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateModelDeploymentMonitoringJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $endpoint = 'endpoint1741102485'; - $predictInstanceSchemaUri = 'predictInstanceSchemaUri1705398098'; - $analysisInstanceSchemaUri = 'analysisInstanceSchemaUri1555410389'; - $enableMonitoringPipelineLogs = false; - $expectedResponse = new ModelDeploymentMonitoringJob(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEndpoint($endpoint); - $expectedResponse->setPredictInstanceSchemaUri($predictInstanceSchemaUri); - $expectedResponse->setAnalysisInstanceSchemaUri($analysisInstanceSchemaUri); - $expectedResponse->setEnableMonitoringPipelineLogs($enableMonitoringPipelineLogs); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateModelDeploymentMonitoringJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $modelDeploymentMonitoringJob = new ModelDeploymentMonitoringJob(); - $modelDeploymentMonitoringJobDisplayName = 'modelDeploymentMonitoringJobDisplayName-563611194'; - $modelDeploymentMonitoringJob->setDisplayName($modelDeploymentMonitoringJobDisplayName); - $modelDeploymentMonitoringJobEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $modelDeploymentMonitoringJob->setEndpoint($modelDeploymentMonitoringJobEndpoint); - $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = []; - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs($modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = new ModelDeploymentMonitoringScheduleConfig(); - $modelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration(); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval($modelDeploymentMonitoringScheduleConfigMonitorInterval); - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig($modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig); - $modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy(); - $modelDeploymentMonitoringJob->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy); - $updateMask = new FieldMask(); - $response = $gapicClient->updateModelDeploymentMonitoringJob($modelDeploymentMonitoringJob, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.JobService/UpdateModelDeploymentMonitoringJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getModelDeploymentMonitoringJob(); - $this->assertProtobufEquals($modelDeploymentMonitoringJob, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateModelDeploymentMonitoringJobTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateModelDeploymentMonitoringJobExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateModelDeploymentMonitoringJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $modelDeploymentMonitoringJob = new ModelDeploymentMonitoringJob(); - $modelDeploymentMonitoringJobDisplayName = 'modelDeploymentMonitoringJobDisplayName-563611194'; - $modelDeploymentMonitoringJob->setDisplayName($modelDeploymentMonitoringJobDisplayName); - $modelDeploymentMonitoringJobEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $modelDeploymentMonitoringJob->setEndpoint($modelDeploymentMonitoringJobEndpoint); - $modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = []; - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringObjectiveConfigs($modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = new ModelDeploymentMonitoringScheduleConfig(); - $modelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration(); - $modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig->setMonitorInterval($modelDeploymentMonitoringScheduleConfigMonitorInterval); - $modelDeploymentMonitoringJob->setModelDeploymentMonitoringScheduleConfig($modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig); - $modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy(); - $modelDeploymentMonitoringJob->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy); - $updateMask = new FieldMask(); - $response = $gapicClient->updateModelDeploymentMonitoringJob($modelDeploymentMonitoringJob, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateModelDeploymentMonitoringJobTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/LlmUtilityServiceClientTest.php b/AiPlatform/tests/Unit/V1/LlmUtilityServiceClientTest.php deleted file mode 100644 index cb9ce55f8ac4..000000000000 --- a/AiPlatform/tests/Unit/V1/LlmUtilityServiceClientTest.php +++ /dev/null @@ -1,512 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return LlmUtilityServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new LlmUtilityServiceClient($options); - } - - /** @test */ - public function computeTokensTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ComputeTokensResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $instances = []; - $response = $gapicClient->computeTokens($formattedEndpoint, $instances); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.LlmUtilityService/ComputeTokens', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $actualValue = $actualRequestObject->getInstances(); - $this->assertProtobufEquals($instances, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function computeTokensExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $instances = []; - try { - $gapicClient->computeTokens($formattedEndpoint, $instances); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function countTokensTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $totalTokens = 730673909; - $totalBillableCharacters = 1242495501; - $expectedResponse = new CountTokensResponse(); - $expectedResponse->setTotalTokens($totalTokens); - $expectedResponse->setTotalBillableCharacters($totalBillableCharacters); - $transport->addResponse($expectedResponse); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $model = 'model104069929'; - $instances = []; - $contents = []; - $response = $gapicClient->countTokens($formattedEndpoint, $model, $instances, $contents); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.LlmUtilityService/CountTokens', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $actualValue = $actualRequestObject->getModel(); - $this->assertProtobufEquals($model, $actualValue); - $actualValue = $actualRequestObject->getInstances(); - $this->assertProtobufEquals($instances, $actualValue); - $actualValue = $actualRequestObject->getContents(); - $this->assertProtobufEquals($contents, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function countTokensExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $model = 'model104069929'; - $instances = []; - $contents = []; - try { - $gapicClient->countTokens($formattedEndpoint, $model, $instances, $contents); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/MatchServiceClientTest.php b/AiPlatform/tests/Unit/V1/MatchServiceClientTest.php deleted file mode 100644 index 367f4a932854..000000000000 --- a/AiPlatform/tests/Unit/V1/MatchServiceClientTest.php +++ /dev/null @@ -1,492 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return MatchServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new MatchServiceClient($options); - } - - /** @test */ - public function findNeighborsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new FindNeighborsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $response = $gapicClient->findNeighbors($formattedIndexEndpoint); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MatchService/FindNeighbors', $actualFuncCall); - $actualValue = $actualRequestObject->getIndexEndpoint(); - $this->assertProtobufEquals($formattedIndexEndpoint, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function findNeighborsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - try { - $gapicClient->findNeighbors($formattedIndexEndpoint); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readIndexDatapointsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ReadIndexDatapointsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - $response = $gapicClient->readIndexDatapoints($formattedIndexEndpoint); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MatchService/ReadIndexDatapoints', $actualFuncCall); - $actualValue = $actualRequestObject->getIndexEndpoint(); - $this->assertProtobufEquals($formattedIndexEndpoint, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readIndexDatapointsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedIndexEndpoint = $gapicClient->indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]'); - try { - $gapicClient->readIndexDatapoints($formattedIndexEndpoint); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/MetadataServiceClientTest.php b/AiPlatform/tests/Unit/V1/MetadataServiceClientTest.php deleted file mode 100644 index 0a7c3885b884..000000000000 --- a/AiPlatform/tests/Unit/V1/MetadataServiceClientTest.php +++ /dev/null @@ -1,2955 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return MetadataServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new MetadataServiceClient($options); - } - - /** @test */ - public function addContextArtifactsAndExecutionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new AddContextArtifactsAndExecutionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $response = $gapicClient->addContextArtifactsAndExecutions($formattedContext); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/AddContextArtifactsAndExecutions', $actualFuncCall); - $actualValue = $actualRequestObject->getContext(); - $this->assertProtobufEquals($formattedContext, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function addContextArtifactsAndExecutionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - try { - $gapicClient->addContextArtifactsAndExecutions($formattedContext); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function addContextChildrenTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new AddContextChildrenResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $response = $gapicClient->addContextChildren($formattedContext); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/AddContextChildren', $actualFuncCall); - $actualValue = $actualRequestObject->getContext(); - $this->assertProtobufEquals($formattedContext, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function addContextChildrenExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - try { - $gapicClient->addContextChildren($formattedContext); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function addExecutionEventsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new AddExecutionEventsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedExecution = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $response = $gapicClient->addExecutionEvents($formattedExecution); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/AddExecutionEvents', $actualFuncCall); - $actualValue = $actualRequestObject->getExecution(); - $this->assertProtobufEquals($formattedExecution, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function addExecutionEventsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedExecution = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - try { - $gapicClient->addExecutionEvents($formattedExecution); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createArtifactTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $uri = 'uri116076'; - $etag = 'etag3123477'; - $schemaTitle = 'schemaTitle-1260306886'; - $schemaVersion = 'schemaVersion1684719674'; - $description = 'description-1724546052'; - $expectedResponse = new Artifact(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setUri($uri); - $expectedResponse->setEtag($etag); - $expectedResponse->setSchemaTitle($schemaTitle); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $artifact = new Artifact(); - $response = $gapicClient->createArtifact($formattedParent, $artifact); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/CreateArtifact', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getArtifact(); - $this->assertProtobufEquals($artifact, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createArtifactExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $artifact = new Artifact(); - try { - $gapicClient->createArtifact($formattedParent, $artifact); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createContextTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $etag = 'etag3123477'; - $schemaTitle = 'schemaTitle-1260306886'; - $schemaVersion = 'schemaVersion1684719674'; - $description = 'description-1724546052'; - $expectedResponse = new Context(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEtag($etag); - $expectedResponse->setSchemaTitle($schemaTitle); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $context = new Context(); - $response = $gapicClient->createContext($formattedParent, $context); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/CreateContext', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getContext(); - $this->assertProtobufEquals($context, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createContextExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $context = new Context(); - try { - $gapicClient->createContext($formattedParent, $context); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createExecutionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $etag = 'etag3123477'; - $schemaTitle = 'schemaTitle-1260306886'; - $schemaVersion = 'schemaVersion1684719674'; - $description = 'description-1724546052'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEtag($etag); - $expectedResponse->setSchemaTitle($schemaTitle); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $execution = new Execution(); - $response = $gapicClient->createExecution($formattedParent, $execution); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/CreateExecution', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getExecution(); - $this->assertProtobufEquals($execution, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createExecutionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $execution = new Execution(); - try { - $gapicClient->createExecution($formattedParent, $execution); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createMetadataSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $schemaVersion = 'schemaVersion1684719674'; - $schema = 'schema-907987551'; - $description = 'description-1724546052'; - $expectedResponse = new MetadataSchema(); - $expectedResponse->setName($name); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setSchema($schema); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $metadataSchema = new MetadataSchema(); - $metadataSchemaSchema = 'metadataSchemaSchema-249734287'; - $metadataSchema->setSchema($metadataSchemaSchema); - $response = $gapicClient->createMetadataSchema($formattedParent, $metadataSchema); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/CreateMetadataSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getMetadataSchema(); - $this->assertProtobufEquals($metadataSchema, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createMetadataSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $metadataSchema = new MetadataSchema(); - $metadataSchemaSchema = 'metadataSchemaSchema-249734287'; - $metadataSchema->setSchema($metadataSchemaSchema); - try { - $gapicClient->createMetadataSchema($formattedParent, $metadataSchema); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createMetadataStoreTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createMetadataStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $expectedResponse = new MetadataStore(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createMetadataStoreTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $metadataStore = new MetadataStore(); - $response = $gapicClient->createMetadataStore($formattedParent, $metadataStore); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/CreateMetadataStore', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getMetadataStore(); - $this->assertProtobufEquals($metadataStore, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createMetadataStoreTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createMetadataStoreExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createMetadataStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $metadataStore = new MetadataStore(); - $response = $gapicClient->createMetadataStore($formattedParent, $metadataStore); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createMetadataStoreTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteArtifactTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteArtifactTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteArtifactTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $response = $gapicClient->deleteArtifact($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/DeleteArtifact', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteArtifactTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteArtifactExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteArtifactTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $response = $gapicClient->deleteArtifact($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteArtifactTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteContextTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteContextTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteContextTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $response = $gapicClient->deleteContext($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/DeleteContext', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteContextTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteContextExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteContextTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $response = $gapicClient->deleteContext($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteContextTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExecutionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteExecutionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteExecutionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $response = $gapicClient->deleteExecution($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/DeleteExecution', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteExecutionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExecutionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteExecutionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $response = $gapicClient->deleteExecution($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteExecutionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteMetadataStoreTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteMetadataStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteMetadataStoreTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $response = $gapicClient->deleteMetadataStore($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/DeleteMetadataStore', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteMetadataStoreTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteMetadataStoreExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteMetadataStoreTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $response = $gapicClient->deleteMetadataStore($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteMetadataStoreTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getArtifactTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $uri = 'uri116076'; - $etag = 'etag3123477'; - $schemaTitle = 'schemaTitle-1260306886'; - $schemaVersion = 'schemaVersion1684719674'; - $description = 'description-1724546052'; - $expectedResponse = new Artifact(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setUri($uri); - $expectedResponse->setEtag($etag); - $expectedResponse->setSchemaTitle($schemaTitle); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $response = $gapicClient->getArtifact($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/GetArtifact', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getArtifactExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - try { - $gapicClient->getArtifact($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getContextTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $etag = 'etag3123477'; - $schemaTitle = 'schemaTitle-1260306886'; - $schemaVersion = 'schemaVersion1684719674'; - $description = 'description-1724546052'; - $expectedResponse = new Context(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEtag($etag); - $expectedResponse->setSchemaTitle($schemaTitle); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $response = $gapicClient->getContext($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/GetContext', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getContextExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - try { - $gapicClient->getContext($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExecutionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $etag = 'etag3123477'; - $schemaTitle = 'schemaTitle-1260306886'; - $schemaVersion = 'schemaVersion1684719674'; - $description = 'description-1724546052'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEtag($etag); - $expectedResponse->setSchemaTitle($schemaTitle); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $response = $gapicClient->getExecution($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/GetExecution', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExecutionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - try { - $gapicClient->getExecution($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getMetadataSchemaTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $schemaVersion = 'schemaVersion1684719674'; - $schema = 'schema-907987551'; - $description = 'description-1724546052'; - $expectedResponse = new MetadataSchema(); - $expectedResponse->setName($name2); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setSchema($schema); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->metadataSchemaName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[METADATA_SCHEMA]'); - $response = $gapicClient->getMetadataSchema($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/GetMetadataSchema', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getMetadataSchemaExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->metadataSchemaName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[METADATA_SCHEMA]'); - try { - $gapicClient->getMetadataSchema($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getMetadataStoreTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $expectedResponse = new MetadataStore(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $response = $gapicClient->getMetadataStore($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/GetMetadataStore', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getMetadataStoreExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - try { - $gapicClient->getMetadataStore($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listArtifactsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $artifactsElement = new Artifact(); - $artifacts = [ - $artifactsElement, - ]; - $expectedResponse = new ListArtifactsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setArtifacts($artifacts); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $response = $gapicClient->listArtifacts($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getArtifacts()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/ListArtifacts', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listArtifactsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - try { - $gapicClient->listArtifacts($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listContextsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $contextsElement = new Context(); - $contexts = [ - $contextsElement, - ]; - $expectedResponse = new ListContextsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setContexts($contexts); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $response = $gapicClient->listContexts($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getContexts()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/ListContexts', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listContextsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - try { - $gapicClient->listContexts($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExecutionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $executionsElement = new Execution(); - $executions = [ - $executionsElement, - ]; - $expectedResponse = new ListExecutionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setExecutions($executions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $response = $gapicClient->listExecutions($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getExecutions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/ListExecutions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExecutionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - try { - $gapicClient->listExecutions($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listMetadataSchemasTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $metadataSchemasElement = new MetadataSchema(); - $metadataSchemas = [ - $metadataSchemasElement, - ]; - $expectedResponse = new ListMetadataSchemasResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setMetadataSchemas($metadataSchemas); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $response = $gapicClient->listMetadataSchemas($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getMetadataSchemas()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/ListMetadataSchemas', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listMetadataSchemasExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - try { - $gapicClient->listMetadataSchemas($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listMetadataStoresTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $metadataStoresElement = new MetadataStore(); - $metadataStores = [ - $metadataStoresElement, - ]; - $expectedResponse = new ListMetadataStoresResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setMetadataStores($metadataStores); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listMetadataStores($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getMetadataStores()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/ListMetadataStores', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listMetadataStoresExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listMetadataStores($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function purgeArtifactsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/purgeArtifactsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $purgeCount = 575305851; - $expectedResponse = new PurgeArtifactsResponse(); - $expectedResponse->setPurgeCount($purgeCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/purgeArtifactsTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $filter = 'filter-1274492040'; - $response = $gapicClient->purgeArtifacts($formattedParent, $filter); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/PurgeArtifacts', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFilter(); - $this->assertProtobufEquals($filter, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/purgeArtifactsTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function purgeArtifactsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/purgeArtifactsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $filter = 'filter-1274492040'; - $response = $gapicClient->purgeArtifacts($formattedParent, $filter); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/purgeArtifactsTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function purgeContextsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/purgeContextsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $purgeCount = 575305851; - $expectedResponse = new PurgeContextsResponse(); - $expectedResponse->setPurgeCount($purgeCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/purgeContextsTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $filter = 'filter-1274492040'; - $response = $gapicClient->purgeContexts($formattedParent, $filter); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/PurgeContexts', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFilter(); - $this->assertProtobufEquals($filter, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/purgeContextsTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function purgeContextsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/purgeContextsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $filter = 'filter-1274492040'; - $response = $gapicClient->purgeContexts($formattedParent, $filter); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/purgeContextsTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function purgeExecutionsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/purgeExecutionsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $purgeCount = 575305851; - $expectedResponse = new PurgeExecutionsResponse(); - $expectedResponse->setPurgeCount($purgeCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/purgeExecutionsTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $filter = 'filter-1274492040'; - $response = $gapicClient->purgeExecutions($formattedParent, $filter); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/PurgeExecutions', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFilter(); - $this->assertProtobufEquals($filter, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/purgeExecutionsTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function purgeExecutionsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/purgeExecutionsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->metadataStoreName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]'); - $filter = 'filter-1274492040'; - $response = $gapicClient->purgeExecutions($formattedParent, $filter); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/purgeExecutionsTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function queryArtifactLineageSubgraphTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new LineageSubgraph(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedArtifact = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - $response = $gapicClient->queryArtifactLineageSubgraph($formattedArtifact); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/QueryArtifactLineageSubgraph', $actualFuncCall); - $actualValue = $actualRequestObject->getArtifact(); - $this->assertProtobufEquals($formattedArtifact, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function queryArtifactLineageSubgraphExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedArtifact = $gapicClient->artifactName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[ARTIFACT]'); - try { - $gapicClient->queryArtifactLineageSubgraph($formattedArtifact); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function queryContextLineageSubgraphTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new LineageSubgraph(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $response = $gapicClient->queryContextLineageSubgraph($formattedContext); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/QueryContextLineageSubgraph', $actualFuncCall); - $actualValue = $actualRequestObject->getContext(); - $this->assertProtobufEquals($formattedContext, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function queryContextLineageSubgraphExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - try { - $gapicClient->queryContextLineageSubgraph($formattedContext); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function queryExecutionInputsAndOutputsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new LineageSubgraph(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedExecution = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - $response = $gapicClient->queryExecutionInputsAndOutputs($formattedExecution); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/QueryExecutionInputsAndOutputs', $actualFuncCall); - $actualValue = $actualRequestObject->getExecution(); - $this->assertProtobufEquals($formattedExecution, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function queryExecutionInputsAndOutputsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedExecution = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[EXECUTION]'); - try { - $gapicClient->queryExecutionInputsAndOutputs($formattedExecution); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function removeContextChildrenTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new RemoveContextChildrenResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - $response = $gapicClient->removeContextChildren($formattedContext); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/RemoveContextChildren', $actualFuncCall); - $actualValue = $actualRequestObject->getContext(); - $this->assertProtobufEquals($formattedContext, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function removeContextChildrenExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedContext = $gapicClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]'); - try { - $gapicClient->removeContextChildren($formattedContext); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateArtifactTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $uri = 'uri116076'; - $etag = 'etag3123477'; - $schemaTitle = 'schemaTitle-1260306886'; - $schemaVersion = 'schemaVersion1684719674'; - $description = 'description-1724546052'; - $expectedResponse = new Artifact(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setUri($uri); - $expectedResponse->setEtag($etag); - $expectedResponse->setSchemaTitle($schemaTitle); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $artifact = new Artifact(); - $response = $gapicClient->updateArtifact($artifact); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/UpdateArtifact', $actualFuncCall); - $actualValue = $actualRequestObject->getArtifact(); - $this->assertProtobufEquals($artifact, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateArtifactExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $artifact = new Artifact(); - try { - $gapicClient->updateArtifact($artifact); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateContextTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $etag = 'etag3123477'; - $schemaTitle = 'schemaTitle-1260306886'; - $schemaVersion = 'schemaVersion1684719674'; - $description = 'description-1724546052'; - $expectedResponse = new Context(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEtag($etag); - $expectedResponse->setSchemaTitle($schemaTitle); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $context = new Context(); - $response = $gapicClient->updateContext($context); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/UpdateContext', $actualFuncCall); - $actualValue = $actualRequestObject->getContext(); - $this->assertProtobufEquals($context, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateContextExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $context = new Context(); - try { - $gapicClient->updateContext($context); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateExecutionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $etag = 'etag3123477'; - $schemaTitle = 'schemaTitle-1260306886'; - $schemaVersion = 'schemaVersion1684719674'; - $description = 'description-1724546052'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setEtag($etag); - $expectedResponse->setSchemaTitle($schemaTitle); - $expectedResponse->setSchemaVersion($schemaVersion); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $execution = new Execution(); - $response = $gapicClient->updateExecution($execution); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MetadataService/UpdateExecution', $actualFuncCall); - $actualValue = $actualRequestObject->getExecution(); - $this->assertProtobufEquals($execution, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateExecutionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $execution = new Execution(); - try { - $gapicClient->updateExecution($execution); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/MigrationServiceClientTest.php b/AiPlatform/tests/Unit/V1/MigrationServiceClientTest.php deleted file mode 100644 index d5581592ab67..000000000000 --- a/AiPlatform/tests/Unit/V1/MigrationServiceClientTest.php +++ /dev/null @@ -1,570 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return MigrationServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new MigrationServiceClient($options); - } - - /** @test */ - public function batchMigrateResourcesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchMigrateResourcesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new BatchMigrateResourcesResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/batchMigrateResourcesTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $migrateResourceRequests = []; - $response = $gapicClient->batchMigrateResources($formattedParent, $migrateResourceRequests); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MigrationService/BatchMigrateResources', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getMigrateResourceRequests(); - $this->assertProtobufEquals($migrateResourceRequests, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchMigrateResourcesTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function batchMigrateResourcesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchMigrateResourcesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $migrateResourceRequests = []; - $response = $gapicClient->batchMigrateResources($formattedParent, $migrateResourceRequests); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchMigrateResourcesTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function searchMigratableResourcesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $migratableResourcesElement = new MigratableResource(); - $migratableResources = [ - $migratableResourcesElement, - ]; - $expectedResponse = new SearchMigratableResourcesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setMigratableResources($migratableResources); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->searchMigratableResources($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getMigratableResources()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.MigrationService/SearchMigratableResources', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchMigratableResourcesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->searchMigratableResources($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/ModelGardenServiceClientTest.php b/AiPlatform/tests/Unit/V1/ModelGardenServiceClientTest.php deleted file mode 100644 index 9ecba3aaf8c1..000000000000 --- a/AiPlatform/tests/Unit/V1/ModelGardenServiceClientTest.php +++ /dev/null @@ -1,439 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ModelGardenServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ModelGardenServiceClient($options); - } - - /** @test */ - public function getPublisherModelTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $versionId = 'versionId-670497310'; - $publisherModelTemplate = 'publisherModelTemplate-215968397'; - $expectedResponse = new PublisherModel(); - $expectedResponse->setName($name2); - $expectedResponse->setVersionId($versionId); - $expectedResponse->setPublisherModelTemplate($publisherModelTemplate); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->publisherModelName('[PUBLISHER]', '[MODEL]'); - $response = $gapicClient->getPublisherModel($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelGardenService/GetPublisherModel', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getPublisherModelExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->publisherModelName('[PUBLISHER]', '[MODEL]'); - try { - $gapicClient->getPublisherModel($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/ModelServiceClientTest.php b/AiPlatform/tests/Unit/V1/ModelServiceClientTest.php deleted file mode 100644 index b7efa891c512..000000000000 --- a/AiPlatform/tests/Unit/V1/ModelServiceClientTest.php +++ /dev/null @@ -1,1972 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ModelServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ModelServiceClient($options); - } - - /** @test */ - public function batchImportEvaluatedAnnotationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $importedEvaluatedAnnotationsCount = 765638363; - $expectedResponse = new BatchImportEvaluatedAnnotationsResponse(); - $expectedResponse->setImportedEvaluatedAnnotationsCount($importedEvaluatedAnnotationsCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); - $evaluatedAnnotations = []; - $response = $gapicClient->batchImportEvaluatedAnnotations($formattedParent, $evaluatedAnnotations); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/BatchImportEvaluatedAnnotations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getEvaluatedAnnotations(); - $this->assertProtobufEquals($evaluatedAnnotations, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchImportEvaluatedAnnotationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); - $evaluatedAnnotations = []; - try { - $gapicClient->batchImportEvaluatedAnnotations($formattedParent, $evaluatedAnnotations); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchImportModelEvaluationSlicesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new BatchImportModelEvaluationSlicesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - $modelEvaluationSlices = []; - $response = $gapicClient->batchImportModelEvaluationSlices($formattedParent, $modelEvaluationSlices); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/BatchImportModelEvaluationSlices', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getModelEvaluationSlices(); - $this->assertProtobufEquals($modelEvaluationSlices, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchImportModelEvaluationSlicesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - $modelEvaluationSlices = []; - try { - $gapicClient->batchImportModelEvaluationSlices($formattedParent, $modelEvaluationSlices); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function copyModelTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/copyModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $model = 'model104069929'; - $modelVersionId = 'modelVersionId-1385431880'; - $expectedResponse = new CopyModelResponse(); - $expectedResponse->setModel($model); - $expectedResponse->setModelVersionId($modelVersionId); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/copyModelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedSourceModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->copyModel($formattedParent, $formattedSourceModel); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/CopyModel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getSourceModel(); - $this->assertProtobufEquals($formattedSourceModel, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/copyModelTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function copyModelExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/copyModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedSourceModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->copyModel($formattedParent, $formattedSourceModel); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/copyModelTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteModelTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteModelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->deleteModel($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/DeleteModel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteModelTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteModelExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->deleteModel($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteModelTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteModelVersionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteModelVersionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteModelVersionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->deleteModelVersion($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/DeleteModelVersion', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteModelVersionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteModelVersionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteModelVersionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->deleteModelVersion($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteModelVersionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function exportModelTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/exportModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new ExportModelResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/exportModelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $outputConfig = new OutputConfig(); - $response = $gapicClient->exportModel($formattedName, $outputConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/ExportModel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualApiRequestObject->getOutputConfig(); - $this->assertProtobufEquals($outputConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/exportModelTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function exportModelExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/exportModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $outputConfig = new OutputConfig(); - $response = $gapicClient->exportModel($formattedName, $outputConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/exportModelTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getModelTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $versionId = 'versionId-670497310'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $versionDescription = 'versionDescription1423604501'; - $metadataSchemaUri = 'metadataSchemaUri-152319778'; - $trainingPipeline = 'trainingPipeline-2026166169'; - $pipelineJob = 'pipelineJob361059488'; - $artifactUri = 'artifactUri-671891073'; - $etag = 'etag3123477'; - $metadataArtifact = 'metadataArtifact2087706850'; - $expectedResponse = new Model(); - $expectedResponse->setName($name2); - $expectedResponse->setVersionId($versionId); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setVersionDescription($versionDescription); - $expectedResponse->setMetadataSchemaUri($metadataSchemaUri); - $expectedResponse->setTrainingPipeline($trainingPipeline); - $expectedResponse->setPipelineJob($pipelineJob); - $expectedResponse->setArtifactUri($artifactUri); - $expectedResponse->setEtag($etag); - $expectedResponse->setMetadataArtifact($metadataArtifact); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->getModel($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/GetModel', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getModelExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - try { - $gapicClient->getModel($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getModelEvaluationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $metricsSchemaUri = 'metricsSchemaUri981925578'; - $dataItemSchemaUri = 'dataItemSchemaUri2052678629'; - $annotationSchemaUri = 'annotationSchemaUri669210846'; - $expectedResponse = new ModelEvaluation(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setMetricsSchemaUri($metricsSchemaUri); - $expectedResponse->setDataItemSchemaUri($dataItemSchemaUri); - $expectedResponse->setAnnotationSchemaUri($annotationSchemaUri); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - $response = $gapicClient->getModelEvaluation($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/GetModelEvaluation', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getModelEvaluationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - try { - $gapicClient->getModelEvaluation($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getModelEvaluationSliceTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $metricsSchemaUri = 'metricsSchemaUri981925578'; - $expectedResponse = new ModelEvaluationSlice(); - $expectedResponse->setName($name2); - $expectedResponse->setMetricsSchemaUri($metricsSchemaUri); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); - $response = $gapicClient->getModelEvaluationSlice($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/GetModelEvaluationSlice', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getModelEvaluationSliceExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelEvaluationSliceName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]', '[SLICE]'); - try { - $gapicClient->getModelEvaluationSlice($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function importModelEvaluationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $metricsSchemaUri = 'metricsSchemaUri981925578'; - $dataItemSchemaUri = 'dataItemSchemaUri2052678629'; - $annotationSchemaUri = 'annotationSchemaUri669210846'; - $expectedResponse = new ModelEvaluation(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setMetricsSchemaUri($metricsSchemaUri); - $expectedResponse->setDataItemSchemaUri($dataItemSchemaUri); - $expectedResponse->setAnnotationSchemaUri($annotationSchemaUri); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $modelEvaluation = new ModelEvaluation(); - $response = $gapicClient->importModelEvaluation($formattedParent, $modelEvaluation); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/ImportModelEvaluation', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getModelEvaluation(); - $this->assertProtobufEquals($modelEvaluation, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function importModelEvaluationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $modelEvaluation = new ModelEvaluation(); - try { - $gapicClient->importModelEvaluation($formattedParent, $modelEvaluation); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelEvaluationSlicesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $modelEvaluationSlicesElement = new ModelEvaluationSlice(); - $modelEvaluationSlices = [ - $modelEvaluationSlicesElement, - ]; - $expectedResponse = new ListModelEvaluationSlicesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setModelEvaluationSlices($modelEvaluationSlices); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - $response = $gapicClient->listModelEvaluationSlices($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getModelEvaluationSlices()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/ListModelEvaluationSlices', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelEvaluationSlicesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->modelEvaluationName('[PROJECT]', '[LOCATION]', '[MODEL]', '[EVALUATION]'); - try { - $gapicClient->listModelEvaluationSlices($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelEvaluationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $modelEvaluationsElement = new ModelEvaluation(); - $modelEvaluations = [ - $modelEvaluationsElement, - ]; - $expectedResponse = new ListModelEvaluationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setModelEvaluations($modelEvaluations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->listModelEvaluations($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getModelEvaluations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/ListModelEvaluations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelEvaluationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - try { - $gapicClient->listModelEvaluations($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelVersionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $modelsElement = new Model(); - $models = [ - $modelsElement, - ]; - $expectedResponse = new ListModelVersionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setModels($models); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->listModelVersions($formattedName); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getModels()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/ListModelVersions', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelVersionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - try { - $gapicClient->listModelVersions($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $modelsElement = new Model(); - $models = [ - $modelsElement, - ]; - $expectedResponse = new ListModelsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setModels($models); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listModels($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getModels()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/ListModels', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listModelsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listModels($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function mergeVersionAliasesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $versionId = 'versionId-670497310'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $versionDescription = 'versionDescription1423604501'; - $metadataSchemaUri = 'metadataSchemaUri-152319778'; - $trainingPipeline = 'trainingPipeline-2026166169'; - $pipelineJob = 'pipelineJob361059488'; - $artifactUri = 'artifactUri-671891073'; - $etag = 'etag3123477'; - $metadataArtifact = 'metadataArtifact2087706850'; - $expectedResponse = new Model(); - $expectedResponse->setName($name2); - $expectedResponse->setVersionId($versionId); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setVersionDescription($versionDescription); - $expectedResponse->setMetadataSchemaUri($metadataSchemaUri); - $expectedResponse->setTrainingPipeline($trainingPipeline); - $expectedResponse->setPipelineJob($pipelineJob); - $expectedResponse->setArtifactUri($artifactUri); - $expectedResponse->setEtag($etag); - $expectedResponse->setMetadataArtifact($metadataArtifact); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $versionAliases = []; - $response = $gapicClient->mergeVersionAliases($formattedName, $versionAliases); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/MergeVersionAliases', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualRequestObject->getVersionAliases(); - $this->assertProtobufEquals($versionAliases, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function mergeVersionAliasesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $versionAliases = []; - try { - $gapicClient->mergeVersionAliases($formattedName, $versionAliases); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateExplanationDatasetTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateExplanationDatasetTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new UpdateExplanationDatasetResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateExplanationDatasetTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->updateExplanationDataset($formattedModel); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/UpdateExplanationDataset', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getModel(); - $this->assertProtobufEquals($formattedModel, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateExplanationDatasetTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExplanationDatasetExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateExplanationDatasetTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedModel = $gapicClient->modelName('[PROJECT]', '[LOCATION]', '[MODEL]'); - $response = $gapicClient->updateExplanationDataset($formattedModel); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateExplanationDatasetTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateModelTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $versionId = 'versionId-670497310'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $versionDescription = 'versionDescription1423604501'; - $metadataSchemaUri = 'metadataSchemaUri-152319778'; - $trainingPipeline = 'trainingPipeline-2026166169'; - $pipelineJob = 'pipelineJob361059488'; - $artifactUri = 'artifactUri-671891073'; - $etag = 'etag3123477'; - $metadataArtifact = 'metadataArtifact2087706850'; - $expectedResponse = new Model(); - $expectedResponse->setName($name); - $expectedResponse->setVersionId($versionId); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setVersionDescription($versionDescription); - $expectedResponse->setMetadataSchemaUri($metadataSchemaUri); - $expectedResponse->setTrainingPipeline($trainingPipeline); - $expectedResponse->setPipelineJob($pipelineJob); - $expectedResponse->setArtifactUri($artifactUri); - $expectedResponse->setEtag($etag); - $expectedResponse->setMetadataArtifact($metadataArtifact); - $transport->addResponse($expectedResponse); - // Mock request - $model = new Model(); - $modelDisplayName = 'modelDisplayName1578770308'; - $model->setDisplayName($modelDisplayName); - $updateMask = new FieldMask(); - $response = $gapicClient->updateModel($model, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/UpdateModel', $actualFuncCall); - $actualValue = $actualRequestObject->getModel(); - $this->assertProtobufEquals($model, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateModelExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $model = new Model(); - $modelDisplayName = 'modelDisplayName1578770308'; - $model->setDisplayName($modelDisplayName); - $updateMask = new FieldMask(); - try { - $gapicClient->updateModel($model, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function uploadModelTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/uploadModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $model2 = 'model21226956956'; - $modelVersionId = 'modelVersionId-1385431880'; - $expectedResponse = new UploadModelResponse(); - $expectedResponse->setModel($model2); - $expectedResponse->setModelVersionId($modelVersionId); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/uploadModelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $model = new Model(); - $modelDisplayName = 'modelDisplayName1578770308'; - $model->setDisplayName($modelDisplayName); - $response = $gapicClient->uploadModel($formattedParent, $model); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ModelService/UploadModel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getModel(); - $this->assertProtobufEquals($model, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/uploadModelTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function uploadModelExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/uploadModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $model = new Model(); - $modelDisplayName = 'modelDisplayName1578770308'; - $model->setDisplayName($modelDisplayName); - $response = $gapicClient->uploadModel($formattedParent, $model); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/uploadModelTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/NotebookServiceClientTest.php b/AiPlatform/tests/Unit/V1/NotebookServiceClientTest.php deleted file mode 100644 index 2f7d3bec4f1a..000000000000 --- a/AiPlatform/tests/Unit/V1/NotebookServiceClientTest.php +++ /dev/null @@ -1,1506 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NotebookServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NotebookServiceClient($options); - } - - /** @test */ - public function assignNotebookRuntimeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/assignNotebookRuntimeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $runtimeUser = 'runtimeUser1935670226'; - $proxyUri = 'proxyUri-475670501'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $serviceAccount = 'serviceAccount-1948028253'; - $isUpgradable = true; - $version = 'version351608024'; - $satisfiesPzs = false; - $satisfiesPzi = false; - $expectedResponse = new NotebookRuntime(); - $expectedResponse->setName($name); - $expectedResponse->setRuntimeUser($runtimeUser); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setIsUpgradable($isUpgradable); - $expectedResponse->setVersion($version); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/assignNotebookRuntimeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNotebookRuntimeTemplate = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - $notebookRuntime = new NotebookRuntime(); - $notebookRuntimeRuntimeUser = 'notebookRuntimeRuntimeUser825639430'; - $notebookRuntime->setRuntimeUser($notebookRuntimeRuntimeUser); - $notebookRuntimeDisplayName = 'notebookRuntimeDisplayName1784911024'; - $notebookRuntime->setDisplayName($notebookRuntimeDisplayName); - $response = $gapicClient->assignNotebookRuntime($formattedParent, $formattedNotebookRuntimeTemplate, $notebookRuntime); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/AssignNotebookRuntime', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getNotebookRuntimeTemplate(); - $this->assertProtobufEquals($formattedNotebookRuntimeTemplate, $actualValue); - $actualValue = $actualApiRequestObject->getNotebookRuntime(); - $this->assertProtobufEquals($notebookRuntime, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/assignNotebookRuntimeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function assignNotebookRuntimeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/assignNotebookRuntimeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNotebookRuntimeTemplate = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - $notebookRuntime = new NotebookRuntime(); - $notebookRuntimeRuntimeUser = 'notebookRuntimeRuntimeUser825639430'; - $notebookRuntime->setRuntimeUser($notebookRuntimeRuntimeUser); - $notebookRuntimeDisplayName = 'notebookRuntimeDisplayName1784911024'; - $notebookRuntime->setDisplayName($notebookRuntimeDisplayName); - $response = $gapicClient->assignNotebookRuntime($formattedParent, $formattedNotebookRuntimeTemplate, $notebookRuntime); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/assignNotebookRuntimeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createNotebookRuntimeTemplateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createNotebookRuntimeTemplateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $isDefault = true; - $serviceAccount = 'serviceAccount-1948028253'; - $etag = 'etag3123477'; - $expectedResponse = new NotebookRuntimeTemplate(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setIsDefault($isDefault); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createNotebookRuntimeTemplateTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $notebookRuntimeTemplate = new NotebookRuntimeTemplate(); - $notebookRuntimeTemplateDisplayName = 'notebookRuntimeTemplateDisplayName-1609642794'; - $notebookRuntimeTemplate->setDisplayName($notebookRuntimeTemplateDisplayName); - $response = $gapicClient->createNotebookRuntimeTemplate($formattedParent, $notebookRuntimeTemplate); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/CreateNotebookRuntimeTemplate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getNotebookRuntimeTemplate(); - $this->assertProtobufEquals($notebookRuntimeTemplate, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createNotebookRuntimeTemplateTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createNotebookRuntimeTemplateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createNotebookRuntimeTemplateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $notebookRuntimeTemplate = new NotebookRuntimeTemplate(); - $notebookRuntimeTemplateDisplayName = 'notebookRuntimeTemplateDisplayName-1609642794'; - $notebookRuntimeTemplate->setDisplayName($notebookRuntimeTemplateDisplayName); - $response = $gapicClient->createNotebookRuntimeTemplate($formattedParent, $notebookRuntimeTemplate); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createNotebookRuntimeTemplateTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteNotebookRuntimeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteNotebookRuntimeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteNotebookRuntimeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $response = $gapicClient->deleteNotebookRuntime($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookRuntime', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNotebookRuntimeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteNotebookRuntimeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteNotebookRuntimeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $response = $gapicClient->deleteNotebookRuntime($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNotebookRuntimeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteNotebookRuntimeTemplateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteNotebookRuntimeTemplateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteNotebookRuntimeTemplateTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - $response = $gapicClient->deleteNotebookRuntimeTemplate($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookRuntimeTemplate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNotebookRuntimeTemplateTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteNotebookRuntimeTemplateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteNotebookRuntimeTemplateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - $response = $gapicClient->deleteNotebookRuntimeTemplate($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNotebookRuntimeTemplateTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getNotebookRuntimeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $runtimeUser = 'runtimeUser1935670226'; - $proxyUri = 'proxyUri-475670501'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $serviceAccount = 'serviceAccount-1948028253'; - $isUpgradable = true; - $version = 'version351608024'; - $satisfiesPzs = false; - $satisfiesPzi = false; - $expectedResponse = new NotebookRuntime(); - $expectedResponse->setName($name2); - $expectedResponse->setRuntimeUser($runtimeUser); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setIsUpgradable($isUpgradable); - $expectedResponse->setVersion($version); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $response = $gapicClient->getNotebookRuntime($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/GetNotebookRuntime', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNotebookRuntimeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - try { - $gapicClient->getNotebookRuntime($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNotebookRuntimeTemplateTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $isDefault = true; - $serviceAccount = 'serviceAccount-1948028253'; - $etag = 'etag3123477'; - $expectedResponse = new NotebookRuntimeTemplate(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setIsDefault($isDefault); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - $response = $gapicClient->getNotebookRuntimeTemplate($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/GetNotebookRuntimeTemplate', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNotebookRuntimeTemplateExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->notebookRuntimeTemplateName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME_TEMPLATE]'); - try { - $gapicClient->getNotebookRuntimeTemplate($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNotebookRuntimeTemplatesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $notebookRuntimeTemplatesElement = new NotebookRuntimeTemplate(); - $notebookRuntimeTemplates = [ - $notebookRuntimeTemplatesElement, - ]; - $expectedResponse = new ListNotebookRuntimeTemplatesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setNotebookRuntimeTemplates($notebookRuntimeTemplates); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listNotebookRuntimeTemplates($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNotebookRuntimeTemplates()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/ListNotebookRuntimeTemplates', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNotebookRuntimeTemplatesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listNotebookRuntimeTemplates($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNotebookRuntimesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $notebookRuntimesElement = new NotebookRuntime(); - $notebookRuntimes = [ - $notebookRuntimesElement, - ]; - $expectedResponse = new ListNotebookRuntimesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setNotebookRuntimes($notebookRuntimes); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listNotebookRuntimes($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNotebookRuntimes()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/ListNotebookRuntimes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNotebookRuntimesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listNotebookRuntimes($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function startNotebookRuntimeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/startNotebookRuntimeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new StartNotebookRuntimeResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/startNotebookRuntimeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $response = $gapicClient->startNotebookRuntime($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/StartNotebookRuntime', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startNotebookRuntimeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function startNotebookRuntimeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/startNotebookRuntimeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $response = $gapicClient->startNotebookRuntime($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startNotebookRuntimeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateNotebookRuntimeTemplateTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $isDefault = true; - $serviceAccount = 'serviceAccount-1948028253'; - $etag = 'etag3123477'; - $expectedResponse = new NotebookRuntimeTemplate(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setIsDefault($isDefault); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $notebookRuntimeTemplate = new NotebookRuntimeTemplate(); - $notebookRuntimeTemplateDisplayName = 'notebookRuntimeTemplateDisplayName-1609642794'; - $notebookRuntimeTemplate->setDisplayName($notebookRuntimeTemplateDisplayName); - $updateMask = new FieldMask(); - $response = $gapicClient->updateNotebookRuntimeTemplate($notebookRuntimeTemplate, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/UpdateNotebookRuntimeTemplate', $actualFuncCall); - $actualValue = $actualRequestObject->getNotebookRuntimeTemplate(); - $this->assertProtobufEquals($notebookRuntimeTemplate, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateNotebookRuntimeTemplateExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $notebookRuntimeTemplate = new NotebookRuntimeTemplate(); - $notebookRuntimeTemplateDisplayName = 'notebookRuntimeTemplateDisplayName-1609642794'; - $notebookRuntimeTemplate->setDisplayName($notebookRuntimeTemplateDisplayName); - $updateMask = new FieldMask(); - try { - $gapicClient->updateNotebookRuntimeTemplate($notebookRuntimeTemplate, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function upgradeNotebookRuntimeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/upgradeNotebookRuntimeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new UpgradeNotebookRuntimeResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/upgradeNotebookRuntimeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $response = $gapicClient->upgradeNotebookRuntime($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.NotebookService/UpgradeNotebookRuntime', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/upgradeNotebookRuntimeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function upgradeNotebookRuntimeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/upgradeNotebookRuntimeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->notebookRuntimeName('[PROJECT]', '[LOCATION]', '[NOTEBOOK_RUNTIME]'); - $response = $gapicClient->upgradeNotebookRuntime($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/upgradeNotebookRuntimeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/PersistentResourceServiceClientTest.php b/AiPlatform/tests/Unit/V1/PersistentResourceServiceClientTest.php deleted file mode 100644 index f7ae0cc14d43..000000000000 --- a/AiPlatform/tests/Unit/V1/PersistentResourceServiceClientTest.php +++ /dev/null @@ -1,1020 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return PersistentResourceServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new PersistentResourceServiceClient($options); - } - - /** @test */ - public function createPersistentResourceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createPersistentResourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $network = 'network1843485230'; - $expectedResponse = new PersistentResource(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNetwork($network); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createPersistentResourceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $persistentResource = new PersistentResource(); - $persistentResourceResourcePools = []; - $persistentResource->setResourcePools($persistentResourceResourcePools); - $persistentResourceId = 'persistentResourceId661736772'; - $response = $gapicClient->createPersistentResource($formattedParent, $persistentResource, $persistentResourceId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/CreatePersistentResource', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getPersistentResource(); - $this->assertProtobufEquals($persistentResource, $actualValue); - $actualValue = $actualApiRequestObject->getPersistentResourceId(); - $this->assertProtobufEquals($persistentResourceId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createPersistentResourceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createPersistentResourceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createPersistentResourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $persistentResource = new PersistentResource(); - $persistentResourceResourcePools = []; - $persistentResource->setResourcePools($persistentResourceResourcePools); - $persistentResourceId = 'persistentResourceId661736772'; - $response = $gapicClient->createPersistentResource($formattedParent, $persistentResource, $persistentResourceId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createPersistentResourceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deletePersistentResourceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deletePersistentResourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deletePersistentResourceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $response = $gapicClient->deletePersistentResource($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/DeletePersistentResource', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deletePersistentResourceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deletePersistentResourceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deletePersistentResourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $response = $gapicClient->deletePersistentResource($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deletePersistentResourceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getPersistentResourceTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $network = 'network1843485230'; - $expectedResponse = new PersistentResource(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNetwork($network); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $response = $gapicClient->getPersistentResource($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/GetPersistentResource', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getPersistentResourceExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - try { - $gapicClient->getPersistentResource($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPersistentResourcesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $persistentResourcesElement = new PersistentResource(); - $persistentResources = [ - $persistentResourcesElement, - ]; - $expectedResponse = new ListPersistentResourcesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setPersistentResources($persistentResources); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listPersistentResources($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getPersistentResources()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/ListPersistentResources', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPersistentResourcesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listPersistentResources($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rebootPersistentResourceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/rebootPersistentResourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $network = 'network1843485230'; - $expectedResponse = new PersistentResource(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNetwork($network); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/rebootPersistentResourceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $response = $gapicClient->rebootPersistentResource($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/RebootPersistentResource', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/rebootPersistentResourceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function rebootPersistentResourceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/rebootPersistentResourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->persistentResourceName('[PROJECT]', '[LOCATION]', '[PERSISTENT_RESOURCE]'); - $response = $gapicClient->rebootPersistentResource($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/rebootPersistentResourceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updatePersistentResourceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updatePersistentResourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $network = 'network1843485230'; - $expectedResponse = new PersistentResource(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNetwork($network); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updatePersistentResourceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $persistentResource = new PersistentResource(); - $persistentResourceResourcePools = []; - $persistentResource->setResourcePools($persistentResourceResourcePools); - $updateMask = new FieldMask(); - $response = $gapicClient->updatePersistentResource($persistentResource, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PersistentResourceService/UpdatePersistentResource', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getPersistentResource(); - $this->assertProtobufEquals($persistentResource, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updatePersistentResourceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updatePersistentResourceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updatePersistentResourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $persistentResource = new PersistentResource(); - $persistentResourceResourcePools = []; - $persistentResource->setResourcePools($persistentResourceResourcePools); - $updateMask = new FieldMask(); - $response = $gapicClient->updatePersistentResource($persistentResource, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updatePersistentResourceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/PipelineServiceClientTest.php b/AiPlatform/tests/Unit/V1/PipelineServiceClientTest.php deleted file mode 100644 index 08a898d8bb12..000000000000 --- a/AiPlatform/tests/Unit/V1/PipelineServiceClientTest.php +++ /dev/null @@ -1,1416 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return PipelineServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new PipelineServiceClient($options); - } - - /** @test */ - public function batchCancelPipelineJobsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchCancelPipelineJobsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new BatchCancelPipelineJobsResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/batchCancelPipelineJobsTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNames = [ - $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - ]; - $response = $gapicClient->batchCancelPipelineJobs($formattedParent, $formattedNames); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/BatchCancelPipelineJobs', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getNames(); - $this->assertProtobufEquals($formattedNames, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchCancelPipelineJobsTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function batchCancelPipelineJobsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchCancelPipelineJobsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNames = [ - $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - ]; - $response = $gapicClient->batchCancelPipelineJobs($formattedParent, $formattedNames); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchCancelPipelineJobsTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function batchDeletePipelineJobsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchDeletePipelineJobsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new BatchDeletePipelineJobsResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/batchDeletePipelineJobsTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNames = [ - $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - ]; - $response = $gapicClient->batchDeletePipelineJobs($formattedParent, $formattedNames); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/BatchDeletePipelineJobs', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getNames(); - $this->assertProtobufEquals($formattedNames, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchDeletePipelineJobsTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function batchDeletePipelineJobsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchDeletePipelineJobsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $formattedNames = [ - $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'), - ]; - $response = $gapicClient->batchDeletePipelineJobs($formattedParent, $formattedNames); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchDeletePipelineJobsTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function cancelPipelineJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $gapicClient->cancelPipelineJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/CancelPipelineJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelPipelineJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - try { - $gapicClient->cancelPipelineJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelTrainingPipelineTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $gapicClient->cancelTrainingPipeline($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/CancelTrainingPipeline', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelTrainingPipelineExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - try { - $gapicClient->cancelTrainingPipeline($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createPipelineJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $serviceAccount = 'serviceAccount-1948028253'; - $network = 'network1843485230'; - $templateUri = 'templateUri-975637465'; - $scheduleName = 'scheduleName1677633331'; - $expectedResponse = new PipelineJob(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setNetwork($network); - $expectedResponse->setTemplateUri($templateUri); - $expectedResponse->setScheduleName($scheduleName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $pipelineJob = new PipelineJob(); - $response = $gapicClient->createPipelineJob($formattedParent, $pipelineJob); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/CreatePipelineJob', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPipelineJob(); - $this->assertProtobufEquals($pipelineJob, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createPipelineJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $pipelineJob = new PipelineJob(); - try { - $gapicClient->createPipelineJob($formattedParent, $pipelineJob); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTrainingPipelineTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $trainingTaskDefinition = 'trainingTaskDefinition-1916695832'; - $modelId = 'modelId-619038223'; - $parentModel = 'parentModel1400422228'; - $expectedResponse = new TrainingPipeline(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setTrainingTaskDefinition($trainingTaskDefinition); - $expectedResponse->setModelId($modelId); - $expectedResponse->setParentModel($parentModel); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $trainingPipeline = new TrainingPipeline(); - $trainingPipelineDisplayName = 'trainingPipelineDisplayName-236550351'; - $trainingPipeline->setDisplayName($trainingPipelineDisplayName); - $trainingPipelineTrainingTaskDefinition = 'trainingPipelineTrainingTaskDefinition2032083182'; - $trainingPipeline->setTrainingTaskDefinition($trainingPipelineTrainingTaskDefinition); - $trainingPipelineTrainingTaskInputs = new Value(); - $trainingPipeline->setTrainingTaskInputs($trainingPipelineTrainingTaskInputs); - $response = $gapicClient->createTrainingPipeline($formattedParent, $trainingPipeline); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/CreateTrainingPipeline', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getTrainingPipeline(); - $this->assertProtobufEquals($trainingPipeline, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTrainingPipelineExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $trainingPipeline = new TrainingPipeline(); - $trainingPipelineDisplayName = 'trainingPipelineDisplayName-236550351'; - $trainingPipeline->setDisplayName($trainingPipelineDisplayName); - $trainingPipelineTrainingTaskDefinition = 'trainingPipelineTrainingTaskDefinition2032083182'; - $trainingPipeline->setTrainingTaskDefinition($trainingPipelineTrainingTaskDefinition); - $trainingPipelineTrainingTaskInputs = new Value(); - $trainingPipeline->setTrainingTaskInputs($trainingPipelineTrainingTaskInputs); - try { - $gapicClient->createTrainingPipeline($formattedParent, $trainingPipeline); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deletePipelineJobTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deletePipelineJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deletePipelineJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $response = $gapicClient->deletePipelineJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/DeletePipelineJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deletePipelineJobTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deletePipelineJobExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deletePipelineJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $response = $gapicClient->deletePipelineJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deletePipelineJobTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteTrainingPipelineTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTrainingPipelineTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteTrainingPipelineTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $response = $gapicClient->deleteTrainingPipeline($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/DeleteTrainingPipeline', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTrainingPipelineTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteTrainingPipelineExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTrainingPipelineTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $response = $gapicClient->deleteTrainingPipeline($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTrainingPipelineTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getPipelineJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $serviceAccount = 'serviceAccount-1948028253'; - $network = 'network1843485230'; - $templateUri = 'templateUri-975637465'; - $scheduleName = 'scheduleName1677633331'; - $expectedResponse = new PipelineJob(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setNetwork($network); - $expectedResponse->setTemplateUri($templateUri); - $expectedResponse->setScheduleName($scheduleName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - $response = $gapicClient->getPipelineJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/GetPipelineJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getPipelineJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->pipelineJobName('[PROJECT]', '[LOCATION]', '[PIPELINE_JOB]'); - try { - $gapicClient->getPipelineJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTrainingPipelineTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $trainingTaskDefinition = 'trainingTaskDefinition-1916695832'; - $modelId = 'modelId-619038223'; - $parentModel = 'parentModel1400422228'; - $expectedResponse = new TrainingPipeline(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setTrainingTaskDefinition($trainingTaskDefinition); - $expectedResponse->setModelId($modelId); - $expectedResponse->setParentModel($parentModel); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - $response = $gapicClient->getTrainingPipeline($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/GetTrainingPipeline', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTrainingPipelineExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->trainingPipelineName('[PROJECT]', '[LOCATION]', '[TRAINING_PIPELINE]'); - try { - $gapicClient->getTrainingPipeline($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPipelineJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $pipelineJobsElement = new PipelineJob(); - $pipelineJobs = [ - $pipelineJobsElement, - ]; - $expectedResponse = new ListPipelineJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setPipelineJobs($pipelineJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listPipelineJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getPipelineJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/ListPipelineJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPipelineJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listPipelineJobs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTrainingPipelinesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $trainingPipelinesElement = new TrainingPipeline(); - $trainingPipelines = [ - $trainingPipelinesElement, - ]; - $expectedResponse = new ListTrainingPipelinesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTrainingPipelines($trainingPipelines); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listTrainingPipelines($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTrainingPipelines()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PipelineService/ListTrainingPipelines', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTrainingPipelinesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listTrainingPipelines($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/PredictionServiceClientTest.php b/AiPlatform/tests/Unit/V1/PredictionServiceClientTest.php deleted file mode 100644 index 3caec78ade36..000000000000 --- a/AiPlatform/tests/Unit/V1/PredictionServiceClientTest.php +++ /dev/null @@ -1,1380 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return PredictionServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new PredictionServiceClient($options); - } - - /** @test */ - public function directPredictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new DirectPredictResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $response = $gapicClient->directPredict($formattedEndpoint); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/DirectPredict', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function directPredictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - try { - $gapicClient->directPredict($formattedEndpoint); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function directRawPredictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $output = '1'; - $expectedResponse = new DirectRawPredictResponse(); - $expectedResponse->setOutput($output); - $transport->addResponse($expectedResponse); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $response = $gapicClient->directRawPredict($formattedEndpoint); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/DirectRawPredict', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function directRawPredictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - try { - $gapicClient->directRawPredict($formattedEndpoint); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function explainTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $deployedModelId2 = 'deployedModelId2-380204163'; - $expectedResponse = new ExplainResponse(); - $expectedResponse->setDeployedModelId($deployedModelId2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $instances = []; - $response = $gapicClient->explain($formattedEndpoint, $instances); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/Explain', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $actualValue = $actualRequestObject->getInstances(); - $this->assertProtobufEquals($instances, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function explainExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $instances = []; - try { - $gapicClient->explain($formattedEndpoint, $instances); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateContentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GenerateContentResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $model = 'model104069929'; - $contents = []; - $response = $gapicClient->generateContent($model, $contents); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/GenerateContent', $actualFuncCall); - $actualValue = $actualRequestObject->getModel(); - $this->assertProtobufEquals($model, $actualValue); - $actualValue = $actualRequestObject->getContents(); - $this->assertProtobufEquals($contents, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateContentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $model = 'model104069929'; - $contents = []; - try { - $gapicClient->generateContent($model, $contents); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function predictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $deployedModelId = 'deployedModelId866642506'; - $model = 'model104069929'; - $modelVersionId = 'modelVersionId-1385431880'; - $modelDisplayName = 'modelDisplayName1757732158'; - $expectedResponse = new PredictResponse(); - $expectedResponse->setDeployedModelId($deployedModelId); - $expectedResponse->setModel($model); - $expectedResponse->setModelVersionId($modelVersionId); - $expectedResponse->setModelDisplayName($modelDisplayName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $instances = []; - $response = $gapicClient->predict($formattedEndpoint, $instances); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/Predict', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $actualValue = $actualRequestObject->getInstances(); - $this->assertProtobufEquals($instances, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function predictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $instances = []; - try { - $gapicClient->predict($formattedEndpoint, $instances); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rawPredictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $contentType = 'contentType831846208'; - $data = '-86'; - $expectedResponse = new HttpBody(); - $expectedResponse->setContentType($contentType); - $expectedResponse->setData($data); - $transport->addResponse($expectedResponse); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $response = $gapicClient->rawPredict($formattedEndpoint); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/RawPredict', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rawPredictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - try { - $gapicClient->rawPredict($formattedEndpoint); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function serverStreamingPredictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new StreamingPredictResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new StreamingPredictResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new StreamingPredictResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $serverStream = $gapicClient->serverStreamingPredict($formattedEndpoint); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/ServerStreamingPredict', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function serverStreamingPredictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $serverStream = $gapicClient->serverStreamingPredict($formattedEndpoint); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamDirectPredictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new StreamDirectPredictResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new StreamDirectPredictResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new StreamDirectPredictResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = new StreamDirectPredictRequest(); - $request->setEndpoint($formattedEndpoint); - $formattedEndpoint2 = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request2 = new StreamDirectPredictRequest(); - $request2->setEndpoint($formattedEndpoint2); - $formattedEndpoint3 = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request3 = new StreamDirectPredictRequest(); - $request3->setEndpoint($formattedEndpoint3); - $bidi = $gapicClient->streamDirectPredict(); - $this->assertInstanceOf(BidiStream::class, $bidi); - $bidi->write($request); - $responses = []; - $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); - foreach ($bidi->closeWriteAndReadAll() as $response) { - $responses[] = $response; - } - - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $createStreamRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($createStreamRequests)); - $streamFuncCall = $createStreamRequests[0]->getFuncCall(); - $streamRequestObject = $createStreamRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/StreamDirectPredict', $streamFuncCall); - $this->assertNull($streamRequestObject); - $callObjects = $transport->popCallObjects(); - $this->assertSame(1, count($callObjects)); - $bidiCall = $callObjects[0]; - $writeRequests = $bidiCall->popReceivedCalls(); - $expectedRequests = []; - $expectedRequests[] = $request; - $expectedRequests[] = $request2; - $expectedRequests[] = $request3; - $this->assertEquals($expectedRequests, $writeRequests); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamDirectPredictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - $bidi = $gapicClient->streamDirectPredict(); - $results = $bidi->closeWriteAndReadAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamDirectRawPredictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $output = '1'; - $expectedResponse = new StreamDirectRawPredictResponse(); - $expectedResponse->setOutput($output); - $transport->addResponse($expectedResponse); - $output2 = '116'; - $expectedResponse2 = new StreamDirectRawPredictResponse(); - $expectedResponse2->setOutput($output2); - $transport->addResponse($expectedResponse2); - $output3 = '117'; - $expectedResponse3 = new StreamDirectRawPredictResponse(); - $expectedResponse3->setOutput($output3); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = new StreamDirectRawPredictRequest(); - $request->setEndpoint($formattedEndpoint); - $formattedEndpoint2 = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request2 = new StreamDirectRawPredictRequest(); - $request2->setEndpoint($formattedEndpoint2); - $formattedEndpoint3 = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request3 = new StreamDirectRawPredictRequest(); - $request3->setEndpoint($formattedEndpoint3); - $bidi = $gapicClient->streamDirectRawPredict(); - $this->assertInstanceOf(BidiStream::class, $bidi); - $bidi->write($request); - $responses = []; - $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); - foreach ($bidi->closeWriteAndReadAll() as $response) { - $responses[] = $response; - } - - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $createStreamRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($createStreamRequests)); - $streamFuncCall = $createStreamRequests[0]->getFuncCall(); - $streamRequestObject = $createStreamRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/StreamDirectRawPredict', $streamFuncCall); - $this->assertNull($streamRequestObject); - $callObjects = $transport->popCallObjects(); - $this->assertSame(1, count($callObjects)); - $bidiCall = $callObjects[0]; - $writeRequests = $bidiCall->popReceivedCalls(); - $expectedRequests = []; - $expectedRequests[] = $request; - $expectedRequests[] = $request2; - $expectedRequests[] = $request3; - $this->assertEquals($expectedRequests, $writeRequests); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamDirectRawPredictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - $bidi = $gapicClient->streamDirectRawPredict(); - $results = $bidi->closeWriteAndReadAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamGenerateContentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GenerateContentResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new GenerateContentResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new GenerateContentResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $model = 'model104069929'; - $contents = []; - $serverStream = $gapicClient->streamGenerateContent($model, $contents); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/StreamGenerateContent', $actualFuncCall); - $actualValue = $actualRequestObject->getModel(); - $this->assertProtobufEquals($model, $actualValue); - $actualValue = $actualRequestObject->getContents(); - $this->assertProtobufEquals($contents, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamGenerateContentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $model = 'model104069929'; - $contents = []; - $serverStream = $gapicClient->streamGenerateContent($model, $contents); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamRawPredictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $contentType = 'contentType831846208'; - $data = '-86'; - $expectedResponse = new HttpBody(); - $expectedResponse->setContentType($contentType); - $expectedResponse->setData($data); - $transport->addResponse($expectedResponse); - $contentType2 = 'contentType2540291827'; - $data2 = '-35'; - $expectedResponse2 = new HttpBody(); - $expectedResponse2->setContentType($contentType2); - $expectedResponse2->setData($data2); - $transport->addResponse($expectedResponse2); - $contentType3 = 'contentType3540291828'; - $data3 = '-34'; - $expectedResponse3 = new HttpBody(); - $expectedResponse3->setContentType($contentType3); - $expectedResponse3->setData($data3); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $serverStream = $gapicClient->streamRawPredict($formattedEndpoint); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/StreamRawPredict', $actualFuncCall); - $actualValue = $actualRequestObject->getEndpoint(); - $this->assertProtobufEquals($formattedEndpoint, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamRawPredictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $serverStream = $gapicClient->streamRawPredict($formattedEndpoint); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingPredictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new StreamingPredictResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new StreamingPredictResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new StreamingPredictResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = new StreamingPredictRequest(); - $request->setEndpoint($formattedEndpoint); - $formattedEndpoint2 = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request2 = new StreamingPredictRequest(); - $request2->setEndpoint($formattedEndpoint2); - $formattedEndpoint3 = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request3 = new StreamingPredictRequest(); - $request3->setEndpoint($formattedEndpoint3); - $bidi = $gapicClient->streamingPredict(); - $this->assertInstanceOf(BidiStream::class, $bidi); - $bidi->write($request); - $responses = []; - $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); - foreach ($bidi->closeWriteAndReadAll() as $response) { - $responses[] = $response; - } - - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $createStreamRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($createStreamRequests)); - $streamFuncCall = $createStreamRequests[0]->getFuncCall(); - $streamRequestObject = $createStreamRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/StreamingPredict', $streamFuncCall); - $this->assertNull($streamRequestObject); - $callObjects = $transport->popCallObjects(); - $this->assertSame(1, count($callObjects)); - $bidiCall = $callObjects[0]; - $writeRequests = $bidiCall->popReceivedCalls(); - $expectedRequests = []; - $expectedRequests[] = $request; - $expectedRequests[] = $request2; - $expectedRequests[] = $request3; - $this->assertEquals($expectedRequests, $writeRequests); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingPredictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - $bidi = $gapicClient->streamingPredict(); - $results = $bidi->closeWriteAndReadAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingRawPredictTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $output = '1'; - $expectedResponse = new StreamingRawPredictResponse(); - $expectedResponse->setOutput($output); - $transport->addResponse($expectedResponse); - $output2 = '116'; - $expectedResponse2 = new StreamingRawPredictResponse(); - $expectedResponse2->setOutput($output2); - $transport->addResponse($expectedResponse2); - $output3 = '117'; - $expectedResponse3 = new StreamingRawPredictResponse(); - $expectedResponse3->setOutput($output3); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedEndpoint = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request = new StreamingRawPredictRequest(); - $request->setEndpoint($formattedEndpoint); - $formattedEndpoint2 = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request2 = new StreamingRawPredictRequest(); - $request2->setEndpoint($formattedEndpoint2); - $formattedEndpoint3 = $gapicClient->endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]'); - $request3 = new StreamingRawPredictRequest(); - $request3->setEndpoint($formattedEndpoint3); - $bidi = $gapicClient->streamingRawPredict(); - $this->assertInstanceOf(BidiStream::class, $bidi); - $bidi->write($request); - $responses = []; - $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); - foreach ($bidi->closeWriteAndReadAll() as $response) { - $responses[] = $response; - } - - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $createStreamRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($createStreamRequests)); - $streamFuncCall = $createStreamRequests[0]->getFuncCall(); - $streamRequestObject = $createStreamRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.PredictionService/StreamingRawPredict', $streamFuncCall); - $this->assertNull($streamRequestObject); - $callObjects = $transport->popCallObjects(); - $this->assertSame(1, count($callObjects)); - $bidiCall = $callObjects[0]; - $writeRequests = $bidiCall->popReceivedCalls(); - $expectedRequests = []; - $expectedRequests[] = $request; - $expectedRequests[] = $request2; - $expectedRequests[] = $request3; - $this->assertEquals($expectedRequests, $writeRequests); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingRawPredictExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - $bidi = $gapicClient->streamingRawPredict(); - $results = $bidi->closeWriteAndReadAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/ScheduleServiceClientTest.php b/AiPlatform/tests/Unit/V1/ScheduleServiceClientTest.php deleted file mode 100644 index 5aea66e620e7..000000000000 --- a/AiPlatform/tests/Unit/V1/ScheduleServiceClientTest.php +++ /dev/null @@ -1,927 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ScheduleServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ScheduleServiceClient($options); - } - - /** @test */ - public function createScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $cron = 'cron3062414'; - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $maxRunCount = 845001408; - $startedRunCount = 479303651; - $maxConcurrentRunCount = 1478623794; - $allowQueueing = false; - $catchUp = false; - $expectedResponse = new Schedule(); - $expectedResponse->setCron($cron); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setMaxRunCount($maxRunCount); - $expectedResponse->setStartedRunCount($startedRunCount); - $expectedResponse->setMaxConcurrentRunCount($maxConcurrentRunCount); - $expectedResponse->setAllowQueueing($allowQueueing); - $expectedResponse->setCatchUp($catchUp); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $schedule = new Schedule(); - $scheduleDisplayName = 'scheduleDisplayName-242731178'; - $schedule->setDisplayName($scheduleDisplayName); - $scheduleMaxConcurrentRunCount = 423065016; - $schedule->setMaxConcurrentRunCount($scheduleMaxConcurrentRunCount); - $response = $gapicClient->createSchedule($formattedParent, $schedule); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ScheduleService/CreateSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getSchedule(); - $this->assertProtobufEquals($schedule, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $schedule = new Schedule(); - $scheduleDisplayName = 'scheduleDisplayName-242731178'; - $schedule->setDisplayName($scheduleDisplayName); - $scheduleMaxConcurrentRunCount = 423065016; - $schedule->setMaxConcurrentRunCount($scheduleMaxConcurrentRunCount); - try { - $gapicClient->createSchedule($formattedParent, $schedule); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteScheduleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteScheduleTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteScheduleTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $response = $gapicClient->deleteSchedule($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ScheduleService/DeleteSchedule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteScheduleTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteScheduleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteScheduleTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $response = $gapicClient->deleteSchedule($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteScheduleTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $cron = 'cron3062414'; - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $maxRunCount = 845001408; - $startedRunCount = 479303651; - $maxConcurrentRunCount = 1478623794; - $allowQueueing = false; - $catchUp = false; - $expectedResponse = new Schedule(); - $expectedResponse->setCron($cron); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setMaxRunCount($maxRunCount); - $expectedResponse->setStartedRunCount($startedRunCount); - $expectedResponse->setMaxConcurrentRunCount($maxConcurrentRunCount); - $expectedResponse->setAllowQueueing($allowQueueing); - $expectedResponse->setCatchUp($catchUp); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $response = $gapicClient->getSchedule($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ScheduleService/GetSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - try { - $gapicClient->getSchedule($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchedulesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $schedulesElement = new Schedule(); - $schedules = [ - $schedulesElement, - ]; - $expectedResponse = new ListSchedulesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSchedules($schedules); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listSchedules($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSchedules()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ScheduleService/ListSchedules', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSchedulesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listSchedules($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pauseScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $gapicClient->pauseSchedule($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ScheduleService/PauseSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pauseScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - try { - $gapicClient->pauseSchedule($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function resumeScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - $gapicClient->resumeSchedule($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ScheduleService/ResumeSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function resumeScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]'); - try { - $gapicClient->resumeSchedule($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $cron = 'cron3062414'; - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $maxRunCount = 845001408; - $startedRunCount = 479303651; - $maxConcurrentRunCount = 1478623794; - $allowQueueing = false; - $catchUp = false; - $expectedResponse = new Schedule(); - $expectedResponse->setCron($cron); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setMaxRunCount($maxRunCount); - $expectedResponse->setStartedRunCount($startedRunCount); - $expectedResponse->setMaxConcurrentRunCount($maxConcurrentRunCount); - $expectedResponse->setAllowQueueing($allowQueueing); - $expectedResponse->setCatchUp($catchUp); - $transport->addResponse($expectedResponse); - // Mock request - $schedule = new Schedule(); - $scheduleDisplayName = 'scheduleDisplayName-242731178'; - $schedule->setDisplayName($scheduleDisplayName); - $scheduleMaxConcurrentRunCount = 423065016; - $schedule->setMaxConcurrentRunCount($scheduleMaxConcurrentRunCount); - $updateMask = new FieldMask(); - $response = $gapicClient->updateSchedule($schedule, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.ScheduleService/UpdateSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getSchedule(); - $this->assertProtobufEquals($schedule, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $schedule = new Schedule(); - $scheduleDisplayName = 'scheduleDisplayName-242731178'; - $schedule->setDisplayName($scheduleDisplayName); - $scheduleMaxConcurrentRunCount = 423065016; - $schedule->setMaxConcurrentRunCount($scheduleMaxConcurrentRunCount); - $updateMask = new FieldMask(); - try { - $gapicClient->updateSchedule($schedule, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/SpecialistPoolServiceClientTest.php b/AiPlatform/tests/Unit/V1/SpecialistPoolServiceClientTest.php deleted file mode 100644 index be94044b74d3..000000000000 --- a/AiPlatform/tests/Unit/V1/SpecialistPoolServiceClientTest.php +++ /dev/null @@ -1,901 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SpecialistPoolServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SpecialistPoolServiceClient($options); - } - - /** @test */ - public function createSpecialistPoolTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createSpecialistPoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $specialistManagersCount = 984151356; - $expectedResponse = new SpecialistPool(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setSpecialistManagersCount($specialistManagersCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createSpecialistPoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $specialistPool = new SpecialistPool(); - $specialistPoolName = 'specialistPoolName-1068552936'; - $specialistPool->setName($specialistPoolName); - $specialistPoolDisplayName = 'specialistPoolDisplayName703175488'; - $specialistPool->setDisplayName($specialistPoolDisplayName); - $response = $gapicClient->createSpecialistPool($formattedParent, $specialistPool); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.SpecialistPoolService/CreateSpecialistPool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getSpecialistPool(); - $this->assertProtobufEquals($specialistPool, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createSpecialistPoolTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createSpecialistPoolExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createSpecialistPoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $specialistPool = new SpecialistPool(); - $specialistPoolName = 'specialistPoolName-1068552936'; - $specialistPool->setName($specialistPoolName); - $specialistPoolDisplayName = 'specialistPoolDisplayName703175488'; - $specialistPool->setDisplayName($specialistPoolDisplayName); - $response = $gapicClient->createSpecialistPool($formattedParent, $specialistPool); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createSpecialistPoolTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteSpecialistPoolTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteSpecialistPoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteSpecialistPoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - $response = $gapicClient->deleteSpecialistPool($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.SpecialistPoolService/DeleteSpecialistPool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteSpecialistPoolTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteSpecialistPoolExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteSpecialistPoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - $response = $gapicClient->deleteSpecialistPool($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteSpecialistPoolTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getSpecialistPoolTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $specialistManagersCount = 984151356; - $expectedResponse = new SpecialistPool(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setSpecialistManagersCount($specialistManagersCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - $response = $gapicClient->getSpecialistPool($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.SpecialistPoolService/GetSpecialistPool', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSpecialistPoolExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->specialistPoolName('[PROJECT]', '[LOCATION]', '[SPECIALIST_POOL]'); - try { - $gapicClient->getSpecialistPool($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSpecialistPoolsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $specialistPoolsElement = new SpecialistPool(); - $specialistPools = [ - $specialistPoolsElement, - ]; - $expectedResponse = new ListSpecialistPoolsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSpecialistPools($specialistPools); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listSpecialistPools($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSpecialistPools()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.SpecialistPoolService/ListSpecialistPools', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSpecialistPoolsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listSpecialistPools($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSpecialistPoolTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateSpecialistPoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $specialistManagersCount = 984151356; - $expectedResponse = new SpecialistPool(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setSpecialistManagersCount($specialistManagersCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateSpecialistPoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $specialistPool = new SpecialistPool(); - $specialistPoolName = 'specialistPoolName-1068552936'; - $specialistPool->setName($specialistPoolName); - $specialistPoolDisplayName = 'specialistPoolDisplayName703175488'; - $specialistPool->setDisplayName($specialistPoolDisplayName); - $updateMask = new FieldMask(); - $response = $gapicClient->updateSpecialistPool($specialistPool, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.SpecialistPoolService/UpdateSpecialistPool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getSpecialistPool(); - $this->assertProtobufEquals($specialistPool, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateSpecialistPoolTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateSpecialistPoolExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateSpecialistPoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $specialistPool = new SpecialistPool(); - $specialistPoolName = 'specialistPoolName-1068552936'; - $specialistPool->setName($specialistPoolName); - $specialistPoolDisplayName = 'specialistPoolDisplayName703175488'; - $specialistPool->setDisplayName($specialistPoolDisplayName); - $updateMask = new FieldMask(); - $response = $gapicClient->updateSpecialistPool($specialistPool, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateSpecialistPoolTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/TensorboardServiceClientTest.php b/AiPlatform/tests/Unit/V1/TensorboardServiceClientTest.php deleted file mode 100644 index 03dfdab5b747..000000000000 --- a/AiPlatform/tests/Unit/V1/TensorboardServiceClientTest.php +++ /dev/null @@ -1,2783 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TensorboardServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TensorboardServiceClient($options); - } - - /** @test */ - public function batchCreateTensorboardRunsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new BatchCreateTensorboardRunsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $requests = []; - $response = $gapicClient->batchCreateTensorboardRuns($formattedParent, $requests); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardRuns', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getRequests(); - $this->assertProtobufEquals($requests, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchCreateTensorboardRunsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $requests = []; - try { - $gapicClient->batchCreateTensorboardRuns($formattedParent, $requests); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchCreateTensorboardTimeSeriesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new BatchCreateTensorboardTimeSeriesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $requests = []; - $response = $gapicClient->batchCreateTensorboardTimeSeries($formattedParent, $requests); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardTimeSeries', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getRequests(); - $this->assertProtobufEquals($requests, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchCreateTensorboardTimeSeriesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $requests = []; - try { - $gapicClient->batchCreateTensorboardTimeSeries($formattedParent, $requests); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchReadTensorboardTimeSeriesDataTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new BatchReadTensorboardTimeSeriesDataResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $formattedTimeSeries = [ - $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'), - ]; - $response = $gapicClient->batchReadTensorboardTimeSeriesData($formattedTensorboard, $formattedTimeSeries); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/BatchReadTensorboardTimeSeriesData', $actualFuncCall); - $actualValue = $actualRequestObject->getTensorboard(); - $this->assertProtobufEquals($formattedTensorboard, $actualValue); - $actualValue = $actualRequestObject->getTimeSeries(); - $this->assertProtobufEquals($formattedTimeSeries, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchReadTensorboardTimeSeriesDataExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $formattedTimeSeries = [ - $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'), - ]; - try { - $gapicClient->batchReadTensorboardTimeSeriesData($formattedTensorboard, $formattedTimeSeries); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTensorboardTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createTensorboardTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $blobStoragePathPrefix = 'blobStoragePathPrefix566154374'; - $runCount = 485221797; - $etag = 'etag3123477'; - $isDefault = true; - $expectedResponse = new Tensorboard(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setBlobStoragePathPrefix($blobStoragePathPrefix); - $expectedResponse->setRunCount($runCount); - $expectedResponse->setEtag($etag); - $expectedResponse->setIsDefault($isDefault); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createTensorboardTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $tensorboard = new Tensorboard(); - $tensorboardDisplayName = 'tensorboardDisplayName-448676352'; - $tensorboard->setDisplayName($tensorboardDisplayName); - $response = $gapicClient->createTensorboard($formattedParent, $tensorboard); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboard', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getTensorboard(); - $this->assertProtobufEquals($tensorboard, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createTensorboardTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createTensorboardExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createTensorboardTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $tensorboard = new Tensorboard(); - $tensorboardDisplayName = 'tensorboardDisplayName-448676352'; - $tensorboard->setDisplayName($tensorboardDisplayName); - $response = $gapicClient->createTensorboard($formattedParent, $tensorboard); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createTensorboardTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createTensorboardExperimentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $source = 'source-896505829'; - $expectedResponse = new TensorboardExperiment(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setSource($source); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $tensorboardExperimentId = 'tensorboardExperimentId932137483'; - $response = $gapicClient->createTensorboardExperiment($formattedParent, $tensorboardExperimentId); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardExperiment', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getTensorboardExperimentId(); - $this->assertProtobufEquals($tensorboardExperimentId, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTensorboardExperimentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $tensorboardExperimentId = 'tensorboardExperimentId932137483'; - try { - $gapicClient->createTensorboardExperiment($formattedParent, $tensorboardExperimentId); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTensorboardRunTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $expectedResponse = new TensorboardRun(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $tensorboardRun = new TensorboardRun(); - $tensorboardRunDisplayName = 'tensorboardRunDisplayName-996156817'; - $tensorboardRun->setDisplayName($tensorboardRunDisplayName); - $tensorboardRunId = 'tensorboardRunId1793766817'; - $response = $gapicClient->createTensorboardRun($formattedParent, $tensorboardRun, $tensorboardRunId); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardRun', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getTensorboardRun(); - $this->assertProtobufEquals($tensorboardRun, $actualValue); - $actualValue = $actualRequestObject->getTensorboardRunId(); - $this->assertProtobufEquals($tensorboardRunId, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTensorboardRunExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $tensorboardRun = new TensorboardRun(); - $tensorboardRunDisplayName = 'tensorboardRunDisplayName-996156817'; - $tensorboardRun->setDisplayName($tensorboardRunDisplayName); - $tensorboardRunId = 'tensorboardRunId1793766817'; - try { - $gapicClient->createTensorboardRun($formattedParent, $tensorboardRun, $tensorboardRunId); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTensorboardTimeSeriesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $pluginName = 'pluginName897272855'; - $pluginData = '54'; - $expectedResponse = new TensorboardTimeSeries(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setPluginName($pluginName); - $expectedResponse->setPluginData($pluginData); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $tensorboardTimeSeries = new TensorboardTimeSeries(); - $tensorboardTimeSeriesDisplayName = 'tensorboardTimeSeriesDisplayName1084140540'; - $tensorboardTimeSeries->setDisplayName($tensorboardTimeSeriesDisplayName); - $tensorboardTimeSeriesValueType = ValueType::VALUE_TYPE_UNSPECIFIED; - $tensorboardTimeSeries->setValueType($tensorboardTimeSeriesValueType); - $response = $gapicClient->createTensorboardTimeSeries($formattedParent, $tensorboardTimeSeries); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardTimeSeries', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getTensorboardTimeSeries(); - $this->assertProtobufEquals($tensorboardTimeSeries, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTensorboardTimeSeriesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $tensorboardTimeSeries = new TensorboardTimeSeries(); - $tensorboardTimeSeriesDisplayName = 'tensorboardTimeSeriesDisplayName1084140540'; - $tensorboardTimeSeries->setDisplayName($tensorboardTimeSeriesDisplayName); - $tensorboardTimeSeriesValueType = ValueType::VALUE_TYPE_UNSPECIFIED; - $tensorboardTimeSeries->setValueType($tensorboardTimeSeriesValueType); - try { - $gapicClient->createTensorboardTimeSeries($formattedParent, $tensorboardTimeSeries); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTensorboardTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTensorboardTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteTensorboardTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $response = $gapicClient->deleteTensorboard($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboard', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTensorboardTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteTensorboardExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTensorboardTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $response = $gapicClient->deleteTensorboard($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTensorboardTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteTensorboardExperimentTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTensorboardExperimentTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteTensorboardExperimentTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $response = $gapicClient->deleteTensorboardExperiment($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardExperiment', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTensorboardExperimentTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteTensorboardExperimentExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTensorboardExperimentTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $response = $gapicClient->deleteTensorboardExperiment($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTensorboardExperimentTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteTensorboardRunTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTensorboardRunTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteTensorboardRunTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $response = $gapicClient->deleteTensorboardRun($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardRun', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTensorboardRunTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteTensorboardRunExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTensorboardRunTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $response = $gapicClient->deleteTensorboardRun($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTensorboardRunTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteTensorboardTimeSeriesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTensorboardTimeSeriesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteTensorboardTimeSeriesTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $response = $gapicClient->deleteTensorboardTimeSeries($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardTimeSeries', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTensorboardTimeSeriesTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteTensorboardTimeSeriesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteTensorboardTimeSeriesTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $response = $gapicClient->deleteTensorboardTimeSeries($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTensorboardTimeSeriesTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function exportTensorboardTimeSeriesDataTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $timeSeriesDataPointsElement = new TimeSeriesDataPoint(); - $timeSeriesDataPoints = [ - $timeSeriesDataPointsElement, - ]; - $expectedResponse = new ExportTensorboardTimeSeriesDataResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTimeSeriesDataPoints($timeSeriesDataPoints); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $response = $gapicClient->exportTensorboardTimeSeriesData($formattedTensorboardTimeSeries); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTimeSeriesDataPoints()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ExportTensorboardTimeSeriesData', $actualFuncCall); - $actualValue = $actualRequestObject->getTensorboardTimeSeries(); - $this->assertProtobufEquals($formattedTensorboardTimeSeries, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function exportTensorboardTimeSeriesDataExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - try { - $gapicClient->exportTensorboardTimeSeriesData($formattedTensorboardTimeSeries); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorboardTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $blobStoragePathPrefix = 'blobStoragePathPrefix566154374'; - $runCount = 485221797; - $etag = 'etag3123477'; - $isDefault = true; - $expectedResponse = new Tensorboard(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setBlobStoragePathPrefix($blobStoragePathPrefix); - $expectedResponse->setRunCount($runCount); - $expectedResponse->setEtag($etag); - $expectedResponse->setIsDefault($isDefault); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $response = $gapicClient->getTensorboard($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/GetTensorboard', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorboardExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - try { - $gapicClient->getTensorboard($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorboardExperimentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $source = 'source-896505829'; - $expectedResponse = new TensorboardExperiment(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setSource($source); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $response = $gapicClient->getTensorboardExperiment($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardExperiment', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorboardExperimentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - try { - $gapicClient->getTensorboardExperiment($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorboardRunTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $expectedResponse = new TensorboardRun(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $response = $gapicClient->getTensorboardRun($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardRun', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorboardRunExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - try { - $gapicClient->getTensorboardRun($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorboardTimeSeriesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $pluginName = 'pluginName897272855'; - $pluginData = '54'; - $expectedResponse = new TensorboardTimeSeries(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setPluginName($pluginName); - $expectedResponse->setPluginData($pluginData); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $response = $gapicClient->getTensorboardTimeSeries($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardTimeSeries', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorboardTimeSeriesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - try { - $gapicClient->getTensorboardTimeSeries($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorboardExperimentsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $tensorboardExperimentsElement = new TensorboardExperiment(); - $tensorboardExperiments = [ - $tensorboardExperimentsElement, - ]; - $expectedResponse = new ListTensorboardExperimentsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTensorboardExperiments($tensorboardExperiments); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $response = $gapicClient->listTensorboardExperiments($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTensorboardExperiments()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardExperiments', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorboardExperimentsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - try { - $gapicClient->listTensorboardExperiments($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorboardRunsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $tensorboardRunsElement = new TensorboardRun(); - $tensorboardRuns = [ - $tensorboardRunsElement, - ]; - $expectedResponse = new ListTensorboardRunsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTensorboardRuns($tensorboardRuns); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $response = $gapicClient->listTensorboardRuns($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTensorboardRuns()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardRuns', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorboardRunsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - try { - $gapicClient->listTensorboardRuns($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorboardTimeSeriesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $tensorboardTimeSeriesElement = new TensorboardTimeSeries(); - $tensorboardTimeSeries = [ - $tensorboardTimeSeriesElement, - ]; - $expectedResponse = new ListTensorboardTimeSeriesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTensorboardTimeSeries($tensorboardTimeSeries); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $response = $gapicClient->listTensorboardTimeSeries($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTensorboardTimeSeries()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardTimeSeries', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorboardTimeSeriesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - try { - $gapicClient->listTensorboardTimeSeries($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorboardsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $tensorboardsElement = new Tensorboard(); - $tensorboards = [ - $tensorboardsElement, - ]; - $expectedResponse = new ListTensorboardsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTensorboards($tensorboards); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listTensorboards($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTensorboards()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ListTensorboards', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorboardsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listTensorboards($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTensorboardBlobDataTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ReadTensorboardBlobDataResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new ReadTensorboardBlobDataResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new ReadTensorboardBlobDataResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $serverStream = $gapicClient->readTensorboardBlobData($formattedTimeSeries); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardBlobData', $actualFuncCall); - $actualValue = $actualRequestObject->getTimeSeries(); - $this->assertProtobufEquals($formattedTimeSeries, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTensorboardBlobDataExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $serverStream = $gapicClient->readTensorboardBlobData($formattedTimeSeries); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTensorboardSizeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $storageSizeByte = 126045758; - $expectedResponse = new ReadTensorboardSizeResponse(); - $expectedResponse->setStorageSizeByte($storageSizeByte); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $response = $gapicClient->readTensorboardSize($formattedTensorboard); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardSize', $actualFuncCall); - $actualValue = $actualRequestObject->getTensorboard(); - $this->assertProtobufEquals($formattedTensorboard, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTensorboardSizeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - try { - $gapicClient->readTensorboardSize($formattedTensorboard); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTensorboardTimeSeriesDataTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ReadTensorboardTimeSeriesDataResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - $response = $gapicClient->readTensorboardTimeSeriesData($formattedTensorboardTimeSeries); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardTimeSeriesData', $actualFuncCall); - $actualValue = $actualRequestObject->getTensorboardTimeSeries(); - $this->assertProtobufEquals($formattedTensorboardTimeSeries, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTensorboardTimeSeriesDataExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTensorboardTimeSeries = $gapicClient->tensorboardTimeSeriesName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]', '[TIME_SERIES]'); - try { - $gapicClient->readTensorboardTimeSeriesData($formattedTensorboardTimeSeries); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTensorboardUsageTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ReadTensorboardUsageResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - $response = $gapicClient->readTensorboardUsage($formattedTensorboard); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardUsage', $actualFuncCall); - $actualValue = $actualRequestObject->getTensorboard(); - $this->assertProtobufEquals($formattedTensorboard, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTensorboardUsageExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTensorboard = $gapicClient->tensorboardName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]'); - try { - $gapicClient->readTensorboardUsage($formattedTensorboard); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTensorboardTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateTensorboardTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $blobStoragePathPrefix = 'blobStoragePathPrefix566154374'; - $runCount = 485221797; - $etag = 'etag3123477'; - $isDefault = true; - $expectedResponse = new Tensorboard(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setBlobStoragePathPrefix($blobStoragePathPrefix); - $expectedResponse->setRunCount($runCount); - $expectedResponse->setEtag($etag); - $expectedResponse->setIsDefault($isDefault); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateTensorboardTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $updateMask = new FieldMask(); - $tensorboard = new Tensorboard(); - $tensorboardDisplayName = 'tensorboardDisplayName-448676352'; - $tensorboard->setDisplayName($tensorboardDisplayName); - $response = $gapicClient->updateTensorboard($updateMask, $tensorboard); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboard', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualApiRequestObject->getTensorboard(); - $this->assertProtobufEquals($tensorboard, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateTensorboardTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateTensorboardExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateTensorboardTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $updateMask = new FieldMask(); - $tensorboard = new Tensorboard(); - $tensorboardDisplayName = 'tensorboardDisplayName-448676352'; - $tensorboard->setDisplayName($tensorboardDisplayName); - $response = $gapicClient->updateTensorboard($updateMask, $tensorboard); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateTensorboardTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateTensorboardExperimentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $source = 'source-896505829'; - $expectedResponse = new TensorboardExperiment(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setSource($source); - $transport->addResponse($expectedResponse); - // Mock request - $updateMask = new FieldMask(); - $tensorboardExperiment = new TensorboardExperiment(); - $response = $gapicClient->updateTensorboardExperiment($updateMask, $tensorboardExperiment); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardExperiment', $actualFuncCall); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualRequestObject->getTensorboardExperiment(); - $this->assertProtobufEquals($tensorboardExperiment, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTensorboardExperimentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $updateMask = new FieldMask(); - $tensorboardExperiment = new TensorboardExperiment(); - try { - $gapicClient->updateTensorboardExperiment($updateMask, $tensorboardExperiment); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTensorboardRunTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $expectedResponse = new TensorboardRun(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $updateMask = new FieldMask(); - $tensorboardRun = new TensorboardRun(); - $tensorboardRunDisplayName = 'tensorboardRunDisplayName-996156817'; - $tensorboardRun->setDisplayName($tensorboardRunDisplayName); - $response = $gapicClient->updateTensorboardRun($updateMask, $tensorboardRun); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardRun', $actualFuncCall); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualRequestObject->getTensorboardRun(); - $this->assertProtobufEquals($tensorboardRun, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTensorboardRunExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $updateMask = new FieldMask(); - $tensorboardRun = new TensorboardRun(); - $tensorboardRunDisplayName = 'tensorboardRunDisplayName-996156817'; - $tensorboardRun->setDisplayName($tensorboardRunDisplayName); - try { - $gapicClient->updateTensorboardRun($updateMask, $tensorboardRun); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTensorboardTimeSeriesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $pluginName = 'pluginName897272855'; - $pluginData = '54'; - $expectedResponse = new TensorboardTimeSeries(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setPluginName($pluginName); - $expectedResponse->setPluginData($pluginData); - $transport->addResponse($expectedResponse); - // Mock request - $updateMask = new FieldMask(); - $tensorboardTimeSeries = new TensorboardTimeSeries(); - $tensorboardTimeSeriesDisplayName = 'tensorboardTimeSeriesDisplayName1084140540'; - $tensorboardTimeSeries->setDisplayName($tensorboardTimeSeriesDisplayName); - $tensorboardTimeSeriesValueType = ValueType::VALUE_TYPE_UNSPECIFIED; - $tensorboardTimeSeries->setValueType($tensorboardTimeSeriesValueType); - $response = $gapicClient->updateTensorboardTimeSeries($updateMask, $tensorboardTimeSeries); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardTimeSeries', $actualFuncCall); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualRequestObject->getTensorboardTimeSeries(); - $this->assertProtobufEquals($tensorboardTimeSeries, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTensorboardTimeSeriesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $updateMask = new FieldMask(); - $tensorboardTimeSeries = new TensorboardTimeSeries(); - $tensorboardTimeSeriesDisplayName = 'tensorboardTimeSeriesDisplayName1084140540'; - $tensorboardTimeSeries->setDisplayName($tensorboardTimeSeriesDisplayName); - $tensorboardTimeSeriesValueType = ValueType::VALUE_TYPE_UNSPECIFIED; - $tensorboardTimeSeries->setValueType($tensorboardTimeSeriesValueType); - try { - $gapicClient->updateTensorboardTimeSeries($updateMask, $tensorboardTimeSeries); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function writeTensorboardExperimentDataTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new WriteTensorboardExperimentDataResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTensorboardExperiment = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $writeRunDataRequests = []; - $response = $gapicClient->writeTensorboardExperimentData($formattedTensorboardExperiment, $writeRunDataRequests); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardExperimentData', $actualFuncCall); - $actualValue = $actualRequestObject->getTensorboardExperiment(); - $this->assertProtobufEquals($formattedTensorboardExperiment, $actualValue); - $actualValue = $actualRequestObject->getWriteRunDataRequests(); - $this->assertProtobufEquals($writeRunDataRequests, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function writeTensorboardExperimentDataExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTensorboardExperiment = $gapicClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]'); - $writeRunDataRequests = []; - try { - $gapicClient->writeTensorboardExperimentData($formattedTensorboardExperiment, $writeRunDataRequests); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function writeTensorboardRunDataTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new WriteTensorboardRunDataResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTensorboardRun = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $timeSeriesData = []; - $response = $gapicClient->writeTensorboardRunData($formattedTensorboardRun, $timeSeriesData); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardRunData', $actualFuncCall); - $actualValue = $actualRequestObject->getTensorboardRun(); - $this->assertProtobufEquals($formattedTensorboardRun, $actualValue); - $actualValue = $actualRequestObject->getTimeSeriesData(); - $this->assertProtobufEquals($timeSeriesData, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function writeTensorboardRunDataExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTensorboardRun = $gapicClient->tensorboardRunName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]', '[RUN]'); - $timeSeriesData = []; - try { - $gapicClient->writeTensorboardRunData($formattedTensorboardRun, $timeSeriesData); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/AiPlatform/tests/Unit/V1/VizierServiceClientTest.php b/AiPlatform/tests/Unit/V1/VizierServiceClientTest.php deleted file mode 100644 index fd86fd1d03be..000000000000 --- a/AiPlatform/tests/Unit/V1/VizierServiceClientTest.php +++ /dev/null @@ -1,1504 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return VizierServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new VizierServiceClient($options); - } - - /** @test */ - public function addTrialMeasurementTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $id = 'id3355'; - $clientId = 'clientId-1904089585'; - $infeasibleReason = 'infeasibleReason1225702715'; - $customJob = 'customJob-1581369873'; - $expectedResponse = new Trial(); - $expectedResponse->setName($name); - $expectedResponse->setId($id); - $expectedResponse->setClientId($clientId); - $expectedResponse->setInfeasibleReason($infeasibleReason); - $expectedResponse->setCustomJob($customJob); - $transport->addResponse($expectedResponse); - // Mock request - $formattedTrialName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $measurement = new Measurement(); - $response = $gapicClient->addTrialMeasurement($formattedTrialName, $measurement); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/AddTrialMeasurement', $actualFuncCall); - $actualValue = $actualRequestObject->getTrialName(); - $this->assertProtobufEquals($formattedTrialName, $actualValue); - $actualValue = $actualRequestObject->getMeasurement(); - $this->assertProtobufEquals($measurement, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function addTrialMeasurementExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedTrialName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $measurement = new Measurement(); - try { - $gapicClient->addTrialMeasurement($formattedTrialName, $measurement); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function checkTrialEarlyStoppingStateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/checkTrialEarlyStoppingStateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $shouldStop = true; - $expectedResponse = new CheckTrialEarlyStoppingStateResponse(); - $expectedResponse->setShouldStop($shouldStop); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/checkTrialEarlyStoppingStateTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedTrialName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $response = $gapicClient->checkTrialEarlyStoppingState($formattedTrialName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/CheckTrialEarlyStoppingState', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getTrialName(); - $this->assertProtobufEquals($formattedTrialName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/checkTrialEarlyStoppingStateTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function checkTrialEarlyStoppingStateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/checkTrialEarlyStoppingStateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedTrialName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $response = $gapicClient->checkTrialEarlyStoppingState($formattedTrialName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/checkTrialEarlyStoppingStateTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function completeTrialTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $id = 'id3355'; - $clientId = 'clientId-1904089585'; - $infeasibleReason2 = 'infeasibleReason21079273006'; - $customJob = 'customJob-1581369873'; - $expectedResponse = new Trial(); - $expectedResponse->setName($name2); - $expectedResponse->setId($id); - $expectedResponse->setClientId($clientId); - $expectedResponse->setInfeasibleReason($infeasibleReason2); - $expectedResponse->setCustomJob($customJob); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $response = $gapicClient->completeTrial($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/CompleteTrial', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function completeTrialExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - try { - $gapicClient->completeTrial($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createStudyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $inactiveReason = 'inactiveReason-1468304232'; - $expectedResponse = new Study(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setInactiveReason($inactiveReason); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $study = new Study(); - $studyDisplayName = 'studyDisplayName-569693980'; - $study->setDisplayName($studyDisplayName); - $studyStudySpec = new StudySpec(); - $studySpecMetrics = []; - $studyStudySpec->setMetrics($studySpecMetrics); - $studySpecParameters = []; - $studyStudySpec->setParameters($studySpecParameters); - $study->setStudySpec($studyStudySpec); - $response = $gapicClient->createStudy($formattedParent, $study); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/CreateStudy', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getStudy(); - $this->assertProtobufEquals($study, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createStudyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $study = new Study(); - $studyDisplayName = 'studyDisplayName-569693980'; - $study->setDisplayName($studyDisplayName); - $studyStudySpec = new StudySpec(); - $studySpecMetrics = []; - $studyStudySpec->setMetrics($studySpecMetrics); - $studySpecParameters = []; - $studyStudySpec->setParameters($studySpecParameters); - $study->setStudySpec($studyStudySpec); - try { - $gapicClient->createStudy($formattedParent, $study); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTrialTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $id = 'id3355'; - $clientId = 'clientId-1904089585'; - $infeasibleReason = 'infeasibleReason1225702715'; - $customJob = 'customJob-1581369873'; - $expectedResponse = new Trial(); - $expectedResponse->setName($name); - $expectedResponse->setId($id); - $expectedResponse->setClientId($clientId); - $expectedResponse->setInfeasibleReason($infeasibleReason); - $expectedResponse->setCustomJob($customJob); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $trial = new Trial(); - $response = $gapicClient->createTrial($formattedParent, $trial); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/CreateTrial', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getTrial(); - $this->assertProtobufEquals($trial, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createTrialExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $trial = new Trial(); - try { - $gapicClient->createTrial($formattedParent, $trial); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteStudyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $gapicClient->deleteStudy($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/DeleteStudy', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteStudyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - try { - $gapicClient->deleteStudy($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTrialTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $gapicClient->deleteTrial($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/DeleteTrial', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTrialExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - try { - $gapicClient->deleteTrial($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getStudyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $inactiveReason = 'inactiveReason-1468304232'; - $expectedResponse = new Study(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setInactiveReason($inactiveReason); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $response = $gapicClient->getStudy($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/GetStudy', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getStudyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - try { - $gapicClient->getStudy($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTrialTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $id = 'id3355'; - $clientId = 'clientId-1904089585'; - $infeasibleReason = 'infeasibleReason1225702715'; - $customJob = 'customJob-1581369873'; - $expectedResponse = new Trial(); - $expectedResponse->setName($name2); - $expectedResponse->setId($id); - $expectedResponse->setClientId($clientId); - $expectedResponse->setInfeasibleReason($infeasibleReason); - $expectedResponse->setCustomJob($customJob); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $response = $gapicClient->getTrial($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/GetTrial', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTrialExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - try { - $gapicClient->getTrial($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listOptimalTrialsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ListOptimalTrialsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $response = $gapicClient->listOptimalTrials($formattedParent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/ListOptimalTrials', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listOptimalTrialsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - try { - $gapicClient->listOptimalTrials($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listStudiesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $studiesElement = new Study(); - $studies = [ - $studiesElement, - ]; - $expectedResponse = new ListStudiesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setStudies($studies); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listStudies($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getStudies()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/ListStudies', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listStudiesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listStudies($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTrialsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $trialsElement = new Trial(); - $trials = [ - $trialsElement, - ]; - $expectedResponse = new ListTrialsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTrials($trials); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $response = $gapicClient->listTrials($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTrials()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/ListTrials', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTrialsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - try { - $gapicClient->listTrials($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function lookupStudyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName2 = 'displayName21615000987'; - $inactiveReason = 'inactiveReason-1468304232'; - $expectedResponse = new Study(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName2); - $expectedResponse->setInactiveReason($inactiveReason); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $displayName = 'displayName1615086568'; - $response = $gapicClient->lookupStudy($formattedParent, $displayName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/LookupStudy', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getDisplayName(); - $this->assertProtobufEquals($displayName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function lookupStudyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $displayName = 'displayName1615086568'; - try { - $gapicClient->lookupStudy($formattedParent, $displayName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function stopTrialTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $id = 'id3355'; - $clientId = 'clientId-1904089585'; - $infeasibleReason = 'infeasibleReason1225702715'; - $customJob = 'customJob-1581369873'; - $expectedResponse = new Trial(); - $expectedResponse->setName($name2); - $expectedResponse->setId($id); - $expectedResponse->setClientId($clientId); - $expectedResponse->setInfeasibleReason($infeasibleReason); - $expectedResponse->setCustomJob($customJob); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - $response = $gapicClient->stopTrial($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/StopTrial', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function stopTrialExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->trialName('[PROJECT]', '[LOCATION]', '[STUDY]', '[TRIAL]'); - try { - $gapicClient->stopTrial($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function suggestTrialsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/suggestTrialsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new SuggestTrialsResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/suggestTrialsTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $suggestionCount = 390130452; - $clientId = 'clientId-1904089585'; - $response = $gapicClient->suggestTrials($formattedParent, $suggestionCount, $clientId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.aiplatform.v1.VizierService/SuggestTrials', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getSuggestionCount(); - $this->assertProtobufEquals($suggestionCount, $actualValue); - $actualValue = $actualApiRequestObject->getClientId(); - $this->assertProtobufEquals($clientId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/suggestTrialsTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function suggestTrialsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/suggestTrialsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->studyName('[PROJECT]', '[LOCATION]', '[STUDY]'); - $suggestionCount = 390130452; - $clientId = 'clientId-1904089585'; - $response = $gapicClient->suggestTrials($formattedParent, $suggestionCount, $clientId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/suggestTrialsTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -}