From a41ca10ed074c494f3c100d2b2f574663fd9a1d8 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 27 Jun 2024 11:17:30 -0700 Subject: [PATCH] chore!: promote GkeMultiCloud, GSuiteAddOns, Run, StorageInsights, VideoLiveStream, VideoStitcher, VmwareEngine APIs to v1 (#7465) --- .repo-metadata-full.json | 14 +- GSuiteAddOns/.OwlBot.yaml | 4 +- GSuiteAddOns/owlbot.py | 41 +- GSuiteAddOns/src/V1/AddOns.php | 16 +- GSuiteAddOns/src/V1/Authorization.php | 6 +- .../src/V1/Client/GSuiteAddOnsClient.php | 6 +- .../src/V1/CreateDeploymentRequest.php | 6 +- .../src/V1/DeleteDeploymentRequest.php | 4 +- GSuiteAddOns/src/V1/Deployment.php | 6 +- GSuiteAddOns/src/V1/GSuiteAddOnsClient.php | 34 - .../src/V1/Gapic/GSuiteAddOnsGapicClient.php | 887 -- .../src/V1/GetAuthorizationRequest.php | 2 +- GSuiteAddOns/src/V1/GetDeploymentRequest.php | 2 +- .../src/V1/GetInstallStatusRequest.php | 2 +- .../src/V1/InstallDeploymentRequest.php | 2 +- GSuiteAddOns/src/V1/InstallStatus.php | 8 +- .../src/V1/ListDeploymentsRequest.php | 6 +- .../src/V1/ListDeploymentsResponse.php | 2 +- .../src/V1/ReplaceDeploymentRequest.php | 2 +- .../src/V1/UninstallDeploymentRequest.php | 2 +- .../Unit/V1/Client/GSuiteAddOnsClientTest.php | 193 +- .../tests/Unit/V1/GSuiteAddOnsClientTest.php | 622 -- GkeMultiCloud/.OwlBot.yaml | 4 +- GkeMultiCloud/README.md | 5 +- GkeMultiCloud/owlbot.py | 41 +- GkeMultiCloud/src/V1/AttachedCluster.php | 40 +- GkeMultiCloud/src/V1/AttachedClusterError.php | 2 +- GkeMultiCloud/src/V1/AttachedClusterGroup.php | 2 +- GkeMultiCloud/src/V1/AttachedClusterUser.php | 2 +- .../src/V1/AttachedClustersClient.php | 34 - .../src/V1/AttachedClustersGrpcClient.php | 181 - GkeMultiCloud/src/V1/AttachedOidcConfig.php | 4 +- .../src/V1/AttachedPlatformVersionInfo.php | 2 +- GkeMultiCloud/src/V1/AttachedProxyConfig.php | 2 +- GkeMultiCloud/src/V1/AttachedServerConfig.php | 2 +- .../AwsAutoscalingGroupMetricsCollection.php | 2 +- GkeMultiCloud/src/V1/AwsCluster.php | 38 +- GkeMultiCloud/src/V1/AwsClusterError.php | 2 +- GkeMultiCloud/src/V1/AwsClusterGroup.php | 2 +- GkeMultiCloud/src/V1/AwsClusterNetworking.php | 4 +- GkeMultiCloud/src/V1/AwsClusterUser.php | 2 +- GkeMultiCloud/src/V1/AwsClustersClient.php | 34 - .../src/V1/AwsClustersGrpcClient.php | 246 - GkeMultiCloud/src/V1/AwsConfigEncryption.php | 2 +- GkeMultiCloud/src/V1/AwsControlPlane.php | 22 +- .../src/V1/AwsDatabaseEncryption.php | 2 +- GkeMultiCloud/src/V1/AwsInstancePlacement.php | 2 +- GkeMultiCloud/src/V1/AwsK8sVersionInfo.php | 10 +- GkeMultiCloud/src/V1/AwsNodeConfig.php | 20 +- GkeMultiCloud/src/V1/AwsNodeManagement.php | 2 +- GkeMultiCloud/src/V1/AwsNodePool.php | 28 +- .../src/V1/AwsNodePoolAutoscaling.php | 4 +- GkeMultiCloud/src/V1/AwsNodePoolError.php | 2 +- GkeMultiCloud/src/V1/AwsOpenIdConfig.php | 4 +- GkeMultiCloud/src/V1/AwsProxyConfig.php | 4 +- GkeMultiCloud/src/V1/AwsServerConfig.php | 2 +- .../src/V1/AwsServicesAuthentication.php | 4 +- GkeMultiCloud/src/V1/AwsSshConfig.php | 2 +- GkeMultiCloud/src/V1/AwsVolumeTemplate.php | 10 +- GkeMultiCloud/src/V1/AzureClient.php | 16 +- GkeMultiCloud/src/V1/AzureCluster.php | 44 +- GkeMultiCloud/src/V1/AzureClusterError.php | 2 +- GkeMultiCloud/src/V1/AzureClusterGroup.php | 2 +- .../src/V1/AzureClusterNetworking.php | 4 +- .../src/V1/AzureClusterResources.php | 4 +- GkeMultiCloud/src/V1/AzureClusterUser.php | 2 +- GkeMultiCloud/src/V1/AzureClustersClient.php | 34 - .../src/V1/AzureClustersGrpcClient.php | 326 - .../src/V1/AzureConfigEncryption.php | 4 +- GkeMultiCloud/src/V1/AzureControlPlane.php | 20 +- .../src/V1/AzureDatabaseEncryption.php | 2 +- GkeMultiCloud/src/V1/AzureDiskTemplate.php | 2 +- GkeMultiCloud/src/V1/AzureK8sVersionInfo.php | 10 +- GkeMultiCloud/src/V1/AzureNodeConfig.php | 20 +- GkeMultiCloud/src/V1/AzureNodeManagement.php | 2 +- GkeMultiCloud/src/V1/AzureNodePool.php | 28 +- .../src/V1/AzureNodePoolAutoscaling.php | 4 +- GkeMultiCloud/src/V1/AzureNodePoolError.php | 2 +- GkeMultiCloud/src/V1/AzureOpenIdConfig.php | 4 +- GkeMultiCloud/src/V1/AzureProxyConfig.php | 4 +- GkeMultiCloud/src/V1/AzureServerConfig.php | 2 +- .../src/V1/AzureServicesAuthentication.php | 4 +- GkeMultiCloud/src/V1/AzureSshConfig.php | 2 +- GkeMultiCloud/src/V1/BinaryAuthorization.php | 2 +- .../src/V1/Client/AttachedClustersClient.php | 79 +- .../src/V1/Client/AwsClustersClient.php | 57 +- .../src/V1/Client/AzureClustersClient.php | 63 +- .../src/V1/CreateAttachedClusterRequest.php | 8 +- .../src/V1/CreateAwsClusterRequest.php | 8 +- .../src/V1/CreateAwsNodePoolRequest.php | 8 +- .../src/V1/CreateAzureClientRequest.php | 8 +- .../src/V1/CreateAzureClusterRequest.php | 8 +- .../src/V1/CreateAzureNodePoolRequest.php | 8 +- .../src/V1/DeleteAttachedClusterRequest.php | 10 +- .../src/V1/DeleteAwsClusterRequest.php | 10 +- .../src/V1/DeleteAwsNodePoolRequest.php | 10 +- .../src/V1/DeleteAzureClientRequest.php | 6 +- .../src/V1/DeleteAzureClusterRequest.php | 10 +- .../src/V1/DeleteAzureNodePoolRequest.php | 10 +- GkeMultiCloud/src/V1/Fleet.php | 4 +- .../V1/Gapic/AttachedClustersGapicClient.php | 1255 --- .../src/V1/Gapic/AwsClustersGapicClient.php | 1861 ---- .../src/V1/Gapic/AzureClustersGapicClient.php | 2140 ----- ...nerateAttachedClusterAgentTokenRequest.php | 18 +- ...erateAttachedClusterAgentTokenResponse.php | 6 +- ...eAttachedClusterInstallManifestRequest.php | 8 +- ...AttachedClusterInstallManifestResponse.php | 2 +- .../src/V1/GenerateAwsAccessTokenRequest.php | 2 +- .../src/V1/GenerateAwsAccessTokenResponse.php | 4 +- .../GenerateAwsClusterAgentTokenRequest.php | 20 +- .../GenerateAwsClusterAgentTokenResponse.php | 6 +- .../V1/GenerateAzureAccessTokenRequest.php | 2 +- .../V1/GenerateAzureAccessTokenResponse.php | 4 +- .../GenerateAzureClusterAgentTokenRequest.php | 20 +- ...GenerateAzureClusterAgentTokenResponse.php | 6 +- .../src/V1/GetAttachedClusterRequest.php | 2 +- .../src/V1/GetAttachedServerConfigRequest.php | 2 +- GkeMultiCloud/src/V1/GetAwsClusterRequest.php | 2 +- .../src/V1/GetAwsJsonWebKeysRequest.php | 2 +- .../src/V1/GetAwsNodePoolRequest.php | 2 +- .../src/V1/GetAwsOpenIdConfigRequest.php | 2 +- .../src/V1/GetAwsServerConfigRequest.php | 2 +- .../src/V1/GetAzureClientRequest.php | 2 +- .../src/V1/GetAzureClusterRequest.php | 2 +- .../src/V1/GetAzureJsonWebKeysRequest.php | 2 +- .../src/V1/GetAzureNodePoolRequest.php | 2 +- .../src/V1/GetAzureOpenIdConfigRequest.php | 2 +- .../src/V1/GetAzureServerConfigRequest.php | 2 +- .../src/V1/ImportAttachedClusterRequest.php | 12 +- GkeMultiCloud/src/V1/Jwk.php | 18 +- GkeMultiCloud/src/V1/KubernetesSecret.php | 4 +- .../src/V1/ListAttachedClustersRequest.php | 6 +- .../src/V1/ListAttachedClustersResponse.php | 2 +- .../src/V1/ListAwsClustersRequest.php | 6 +- .../src/V1/ListAwsClustersResponse.php | 2 +- .../src/V1/ListAwsNodePoolsRequest.php | 6 +- .../src/V1/ListAwsNodePoolsResponse.php | 2 +- .../src/V1/ListAzureClientsRequest.php | 6 +- .../src/V1/ListAzureClientsResponse.php | 2 +- .../src/V1/ListAzureClustersRequest.php | 6 +- .../src/V1/ListAzureClustersResponse.php | 2 +- .../src/V1/ListAzureNodePoolsRequest.php | 6 +- .../src/V1/ListAzureNodePoolsResponse.php | 2 +- GkeMultiCloud/src/V1/LoggingConfig.php | 2 +- .../src/V1/ManagedPrometheusConfig.php | 2 +- GkeMultiCloud/src/V1/MaxPodsConstraint.php | 2 +- GkeMultiCloud/src/V1/MonitoringConfig.php | 2 +- GkeMultiCloud/src/V1/NodeTaint.php | 6 +- GkeMultiCloud/src/V1/OperationMetadata.php | 14 +- GkeMultiCloud/src/V1/ReplicaPlacement.php | 4 +- .../V1/RollbackAwsNodePoolUpdateRequest.php | 4 +- GkeMultiCloud/src/V1/SurgeSettings.php | 4 +- .../src/V1/UpdateAttachedClusterRequest.php | 6 +- .../src/V1/UpdateAwsClusterRequest.php | 6 +- .../src/V1/UpdateAwsNodePoolRequest.php | 6 +- .../src/V1/UpdateAzureClusterRequest.php | 6 +- .../src/V1/UpdateAzureNodePoolRequest.php | 6 +- GkeMultiCloud/src/V1/UpdateSettings.php | 2 +- .../src/V1/WorkloadIdentityConfig.php | 6 +- .../Unit/V1/AttachedClustersClientTest.php | 1007 -- .../tests/Unit/V1/AwsClustersClientTest.php | 1824 ---- .../tests/Unit/V1/AzureClustersClientTest.php | 2065 ---- .../V1/Client/AttachedClustersClientTest.php | 181 +- .../Unit/V1/Client/AwsClustersClientTest.php | 338 +- .../V1/Client/AzureClustersClientTest.php | 432 +- Run/.OwlBot.yaml | 4 +- Run/README.md | 5 +- Run/owlbot.py | 41 +- Run/src/V2/BinaryAuthorization.php | 2 +- Run/src/V2/CancelExecutionRequest.php | 6 +- Run/src/V2/Client/ExecutionsClient.php | 31 +- Run/src/V2/Client/JobsClient.php | 37 +- Run/src/V2/Client/RevisionsClient.php | 31 +- Run/src/V2/Client/ServicesClient.php | 37 +- Run/src/V2/Client/TasksClient.php | 15 +- Run/src/V2/Condition.php | 10 +- Run/src/V2/Container.php | 12 +- Run/src/V2/ContainerPort.php | 4 +- Run/src/V2/CreateJobRequest.php | 8 +- Run/src/V2/CreateServiceRequest.php | 8 +- Run/src/V2/DeleteExecutionRequest.php | 6 +- Run/src/V2/DeleteJobRequest.php | 6 +- Run/src/V2/DeleteRevisionRequest.php | 6 +- Run/src/V2/DeleteServiceRequest.php | 6 +- Run/src/V2/EmptyDirVolumeSource.php | 4 +- Run/src/V2/EnvVar.php | 2 +- Run/src/V2/EnvVarSource.php | 2 +- Run/src/V2/Execution.php | 48 +- Run/src/V2/ExecutionReference.php | 6 +- Run/src/V2/ExecutionTemplate.php | 6 +- Run/src/V2/ExecutionsClient.php | 34 - Run/src/V2/ExecutionsGrpcClient.php | 80 - Run/src/V2/GCSVolumeSource.php | 4 +- Run/src/V2/GRPCAction.php | 4 +- Run/src/V2/Gapic/ExecutionsGapicClient.php | 687 -- Run/src/V2/Gapic/JobsGapicClient.php | 1233 --- Run/src/V2/Gapic/RevisionsGapicClient.php | 598 -- Run/src/V2/Gapic/ServicesGapicClient.php | 1148 --- Run/src/V2/Gapic/TasksGapicClient.php | 446 - Run/src/V2/GetExecutionRequest.php | 2 +- Run/src/V2/GetJobRequest.php | 2 +- Run/src/V2/GetRevisionRequest.php | 2 +- Run/src/V2/GetServiceRequest.php | 2 +- Run/src/V2/GetTaskRequest.php | 2 +- Run/src/V2/HTTPGetAction.php | 4 +- Run/src/V2/HTTPHeader.php | 4 +- Run/src/V2/Job.php | 42 +- Run/src/V2/JobsClient.php | 34 - Run/src/V2/JobsGrpcClient.php | 174 - Run/src/V2/ListExecutionsRequest.php | 8 +- Run/src/V2/ListExecutionsResponse.php | 2 +- Run/src/V2/ListJobsRequest.php | 8 +- Run/src/V2/ListJobsResponse.php | 2 +- Run/src/V2/ListRevisionsRequest.php | 8 +- Run/src/V2/ListRevisionsResponse.php | 2 +- Run/src/V2/ListServicesRequest.php | 8 +- Run/src/V2/ListServicesResponse.php | 2 +- Run/src/V2/ListTasksRequest.php | 8 +- Run/src/V2/ListTasksResponse.php | 2 +- Run/src/V2/NFSVolumeSource.php | 6 +- Run/src/V2/Probe.php | 8 +- Run/src/V2/ResourceRequirements.php | 4 +- Run/src/V2/Revision.php | 50 +- Run/src/V2/RevisionScaling.php | 4 +- Run/src/V2/RevisionScalingStatus.php | 2 +- Run/src/V2/RevisionTemplate.php | 20 +- Run/src/V2/RevisionsClient.php | 34 - Run/src/V2/RevisionsGrpcClient.php | 80 - Run/src/V2/RunJobRequest.php | 8 +- Run/src/V2/RunJobRequest/Overrides.php | 4 +- .../Overrides/ContainerOverride.php | 4 +- Run/src/V2/SecretKeySelector.php | 4 +- Run/src/V2/SecretVolumeSource.php | 4 +- Run/src/V2/Service.php | 52 +- Run/src/V2/ServiceScaling.php | 2 +- Run/src/V2/ServicesClient.php | 34 - Run/src/V2/ServicesGrpcClient.php | 161 - Run/src/V2/TCPSocketAction.php | 2 +- Run/src/V2/Task.php | 52 +- Run/src/V2/TaskAttemptResult.php | 4 +- Run/src/V2/TaskTemplate.php | 10 +- Run/src/V2/TasksClient.php | 34 - Run/src/V2/TasksGrpcClient.php | 65 - Run/src/V2/TrafficTarget.php | 8 +- Run/src/V2/TrafficTargetStatus.php | 10 +- Run/src/V2/UpdateJobRequest.php | 6 +- Run/src/V2/UpdateServiceRequest.php | 6 +- Run/src/V2/VersionToPath.php | 6 +- Run/src/V2/Volume.php | 2 +- Run/src/V2/VolumeMount.php | 4 +- Run/src/V2/VpcAccess.php | 4 +- Run/src/V2/VpcAccess/NetworkInterface.php | 4 +- .../Unit/V2/Client/ExecutionsClientTest.php | 99 +- Run/tests/Unit/V2/Client/JobsClientTest.php | 199 +- .../Unit/V2/Client/RevisionsClientTest.php | 78 +- .../Unit/V2/Client/ServicesClientTest.php | 178 +- Run/tests/Unit/V2/Client/TasksClientTest.php | 55 +- Run/tests/Unit/V2/ExecutionsClientTest.php | 522 -- Run/tests/Unit/V2/JobsClientTest.php | 1007 -- Run/tests/Unit/V2/RevisionsClientTest.php | 361 - Run/tests/Unit/V2/ServicesClientTest.php | 880 -- Run/tests/Unit/V2/TasksClientTest.php | 218 - StorageInsights/README.md | 3 +- StorageInsights/owlbot.py | 13 +- .../src/V1/Client/StorageInsightsClient.php | 14 +- .../V1/Gapic/StorageInsightsGapicClient.php | 986 -- .../src/V1/StorageInsightsClient.php | 34 - .../V1/Client/StorageInsightsClientTest.php | 217 +- .../Unit/V1/StorageInsightsClientTest.php | 639 -- VideoLiveStream/.OwlBot.yaml | 4 +- VideoLiveStream/README.md | 5 +- VideoLiveStream/owlbot.py | 40 +- VideoLiveStream/src/V1/Asset.php | 12 +- VideoLiveStream/src/V1/Asset/ImageAsset.php | 2 +- VideoLiveStream/src/V1/Asset/VideoAsset.php | 2 +- VideoLiveStream/src/V1/AudioFormat.php | 4 +- VideoLiveStream/src/V1/AudioStream.php | 10 +- .../src/V1/AudioStream/AudioMapping.php | 10 +- .../src/V1/AudioStreamProperty.php | 4 +- VideoLiveStream/src/V1/Channel.php | 20 +- VideoLiveStream/src/V1/Channel/Output.php | 2 +- .../src/V1/Client/LivestreamServiceClient.php | 31 +- VideoLiveStream/src/V1/CreateAssetRequest.php | 8 +- .../src/V1/CreateChannelRequest.php | 8 +- VideoLiveStream/src/V1/CreateEventRequest.php | 8 +- VideoLiveStream/src/V1/CreateInputRequest.php | 8 +- VideoLiveStream/src/V1/DeleteAssetRequest.php | 4 +- .../src/V1/DeleteChannelRequest.php | 6 +- VideoLiveStream/src/V1/DeleteEventRequest.php | 4 +- VideoLiveStream/src/V1/DeleteInputRequest.php | 4 +- VideoLiveStream/src/V1/ElementaryStream.php | 2 +- VideoLiveStream/src/V1/Encryption.php | 4 +- .../src/V1/Encryption/DrmSystems.php | 8 +- .../V1/Encryption/MpegCommonEncryption.php | 2 +- .../src/V1/Encryption/SecretManagerSource.php | 2 +- VideoLiveStream/src/V1/Event.php | 14 +- VideoLiveStream/src/V1/Event/AdBreakTask.php | 2 +- .../src/V1/Event/InputSwitchTask.php | 2 +- VideoLiveStream/src/V1/Event/MuteTask.php | 2 +- VideoLiveStream/src/V1/Event/SlateTask.php | 4 +- .../V1/Gapic/LivestreamServiceGapicClient.php | 2607 ------ VideoLiveStream/src/V1/GetAssetRequest.php | 2 +- VideoLiveStream/src/V1/GetChannelRequest.php | 2 +- VideoLiveStream/src/V1/GetEventRequest.php | 2 +- VideoLiveStream/src/V1/GetInputRequest.php | 2 +- VideoLiveStream/src/V1/GetPoolRequest.php | 2 +- VideoLiveStream/src/V1/Input.php | 18 +- VideoLiveStream/src/V1/InputAttachment.php | 6 +- VideoLiveStream/src/V1/InputConfig.php | 2 +- .../src/V1/InputStreamProperty.php | 2 +- VideoLiveStream/src/V1/ListAssetsRequest.php | 10 +- VideoLiveStream/src/V1/ListAssetsResponse.php | 2 +- .../src/V1/ListChannelsRequest.php | 10 +- .../src/V1/ListChannelsResponse.php | 2 +- VideoLiveStream/src/V1/ListEventsRequest.php | 10 +- VideoLiveStream/src/V1/ListEventsResponse.php | 2 +- VideoLiveStream/src/V1/ListInputsRequest.php | 10 +- VideoLiveStream/src/V1/ListInputsResponse.php | 2 +- .../src/V1/LivestreamServiceClient.php | 34 - .../src/V1/LivestreamServiceGrpcClient.php | 282 - VideoLiveStream/src/V1/LogConfig.php | 2 +- VideoLiveStream/src/V1/Manifest.php | 10 +- VideoLiveStream/src/V1/MuxStream.php | 8 +- VideoLiveStream/src/V1/OperationMetadata.php | 12 +- VideoLiveStream/src/V1/Pool.php | 8 +- VideoLiveStream/src/V1/Pool/NetworkConfig.php | 2 +- .../src/V1/PreprocessingConfig.php | 6 +- .../src/V1/PreprocessingConfig/Audio.php | 2 +- .../src/V1/PreprocessingConfig/Crop.php | 8 +- .../src/V1/PreprocessingConfig/Pad.php | 8 +- VideoLiveStream/src/V1/SegmentSettings.php | 2 +- VideoLiveStream/src/V1/SpriteSheet.php | 16 +- .../src/V1/StartChannelRequest.php | 4 +- VideoLiveStream/src/V1/StopChannelRequest.php | 4 +- VideoLiveStream/src/V1/TextStream.php | 2 +- VideoLiveStream/src/V1/TimecodeConfig.php | 2 +- .../src/V1/UpdateChannelRequest.php | 6 +- VideoLiveStream/src/V1/UpdateInputRequest.php | 6 +- VideoLiveStream/src/V1/UpdatePoolRequest.php | 6 +- VideoLiveStream/src/V1/VideoFormat.php | 8 +- .../src/V1/VideoStream/H264CodecSettings.php | 26 +- .../src/V1/VideoStreamProperty.php | 4 +- .../V1/Client/LivestreamServiceClientTest.php | 496 +- .../Unit/V1/LivestreamServiceClientTest.php | 2246 ----- VideoStitcher/.OwlBot.yaml | 4 +- VideoStitcher/README.md | 5 +- VideoStitcher/owlbot.py | 40 +- VideoStitcher/src/V1/AdRequest.php | 6 +- VideoStitcher/src/V1/AdStitchDetail.php | 8 +- VideoStitcher/src/V1/AdTag.php | 67 - VideoStitcher/src/V1/AkamaiCdnKey.php | 2 +- VideoStitcher/src/V1/CdnKey.php | 4 +- .../V1/Client/VideoStitcherServiceClient.php | 67 +- VideoStitcher/src/V1/Companion.php | 16 +- VideoStitcher/src/V1/CompanionAds.php | 2 +- VideoStitcher/src/V1/CreateCdnKeyRequest.php | 6 +- .../src/V1/CreateLiveConfigRequest.php | 8 +- .../src/V1/CreateLiveSessionRequest.php | 4 +- VideoStitcher/src/V1/CreateSlateRequest.php | 8 +- .../src/V1/CreateVodConfigRequest.php | 8 +- .../src/V1/CreateVodSessionRequest.php | 4 +- VideoStitcher/src/V1/DeleteCdnKeyRequest.php | 2 +- .../src/V1/DeleteLiveConfigRequest.php | 2 +- VideoStitcher/src/V1/DeleteSlateRequest.php | 2 +- .../src/V1/DeleteVodConfigRequest.php | 2 +- VideoStitcher/src/V1/Event.php | 8 +- VideoStitcher/src/V1/GamLiveConfig.php | 6 +- VideoStitcher/src/V1/GamVodConfig.php | 2 +- .../Gapic/VideoStitcherServiceGapicClient.php | 2876 ------ VideoStitcher/src/V1/GetCdnKeyRequest.php | 2 +- .../src/V1/GetLiveAdTagDetailRequest.php | 2 +- VideoStitcher/src/V1/GetLiveConfigRequest.php | 2 +- .../src/V1/GetLiveSessionRequest.php | 2 +- VideoStitcher/src/V1/GetSlateRequest.php | 2 +- .../src/V1/GetVodAdTagDetailRequest.php | 2 +- VideoStitcher/src/V1/GetVodConfigRequest.php | 2 +- VideoStitcher/src/V1/GetVodSessionRequest.php | 2 +- .../src/V1/GetVodStitchDetailRequest.php | 2 +- VideoStitcher/src/V1/GoogleCdnKey.php | 4 +- VideoStitcher/src/V1/HtmlAdResource.php | 2 +- VideoStitcher/src/V1/IframeAdResource.php | 2 +- VideoStitcher/src/V1/Interstitials.php | 2 +- VideoStitcher/src/V1/ListCdnKeysRequest.php | 10 +- VideoStitcher/src/V1/ListCdnKeysResponse.php | 2 +- .../src/V1/ListLiveAdTagDetailsRequest.php | 6 +- .../src/V1/ListLiveAdTagDetailsResponse.php | 2 +- .../src/V1/ListLiveConfigsRequest.php | 10 +- .../src/V1/ListLiveConfigsResponse.php | 2 +- VideoStitcher/src/V1/ListSlatesRequest.php | 10 +- VideoStitcher/src/V1/ListSlatesResponse.php | 2 +- .../src/V1/ListVodAdTagDetailsRequest.php | 6 +- .../src/V1/ListVodAdTagDetailsResponse.php | 2 +- .../src/V1/ListVodConfigsRequest.php | 10 +- .../src/V1/ListVodConfigsResponse.php | 2 +- .../src/V1/ListVodStitchDetailsRequest.php | 6 +- .../src/V1/ListVodStitchDetailsResponse.php | 2 +- VideoStitcher/src/V1/LiveAdTagDetail.php | 2 +- VideoStitcher/src/V1/LiveConfig.php | 20 +- VideoStitcher/src/V1/LiveSession.php | 12 +- .../src/V1/LiveSession/GamSettings.php | 2 +- .../V1/LiveSession/GamSettings/GamDash.php | 69 - .../src/V1/LiveSession/GamSettings/GamHls.php | 35 - .../src/V1/LiveSession/StitchingPolicy.php | 63 - VideoStitcher/src/V1/ManifestOptions.php | 2 +- VideoStitcher/src/V1/MediaCdnKey.php | 6 +- .../src/V1/MediaCdnKey/TokenConfig.php | 2 +- VideoStitcher/src/V1/OperationMetadata.php | 8 +- VideoStitcher/src/V1/PrefetchConfig.php | 4 +- VideoStitcher/src/V1/ProgressEvent.php | 2 +- VideoStitcher/src/V1/RenditionFilter.php | 4 +- VideoStitcher/src/V1/RequestMetadata.php | 2 +- VideoStitcher/src/V1/ResponseMetadata.php | 12 +- VideoStitcher/src/V1/Slate.php | 6 +- VideoStitcher/src/V1/Slate/GamSlate.php | 4 +- VideoStitcher/src/V1/StaticAdResource.php | 4 +- VideoStitcher/src/V1/UpdateCdnKeyRequest.php | 4 +- .../src/V1/UpdateLiveConfigRequest.php | 4 +- VideoStitcher/src/V1/UpdateSlateRequest.php | 4 +- .../src/V1/UpdateVodConfigRequest.php | 4 +- .../src/V1/VideoStitcherServiceClient.php | 34 - .../src/V1/VideoStitcherServiceGrpcClient.php | 406 - VideoStitcher/src/V1/VodAdTagDetail.php | 2 +- VideoStitcher/src/V1/VodConfig.php | 12 +- VideoStitcher/src/V1/VodSession.php | 20 +- .../src/V1/VodSession/GamSettings.php | 4 +- VideoStitcher/src/V1/VodSessionAd.php | 4 +- VideoStitcher/src/V1/VodSessionAdBreak.php | 4 +- VideoStitcher/src/V1/VodSessionContent.php | 2 +- VideoStitcher/src/V1/VodStitchDetail.php | 2 +- .../Client/VideoStitcherServiceClientTest.php | 696 +- .../V1/VideoStitcherServiceClientTest.php | 2805 ------ VmwareEngine/.OwlBot.yaml | 4 +- VmwareEngine/owlbot.py | 41 +- .../src/V1/Client/VmwareEngineClient.php | 315 +- VmwareEngine/src/V1/Cluster.php | 14 +- VmwareEngine/src/V1/CreateClusterRequest.php | 10 +- .../V1/CreateExternalAccessRuleRequest.php | 8 +- .../src/V1/CreateExternalAddressRequest.php | 8 +- .../src/V1/CreateHcxActivationKeyRequest.php | 8 +- .../src/V1/CreateLoggingServerRequest.php | 8 +- .../CreateManagementDnsZoneBindingRequest.php | 8 +- .../src/V1/CreateNetworkPeeringRequest.php | 8 +- .../src/V1/CreateNetworkPolicyRequest.php | 8 +- .../src/V1/CreatePrivateCloudRequest.php | 10 +- .../src/V1/CreatePrivateConnectionRequest.php | 8 +- .../V1/CreateVmwareEngineNetworkRequest.php | 8 +- VmwareEngine/src/V1/Credentials.php | 4 +- VmwareEngine/src/V1/DeleteClusterRequest.php | 4 +- .../V1/DeleteExternalAccessRuleRequest.php | 4 +- .../src/V1/DeleteExternalAddressRequest.php | 4 +- .../src/V1/DeleteLoggingServerRequest.php | 4 +- .../DeleteManagementDnsZoneBindingRequest.php | 4 +- .../src/V1/DeleteNetworkPeeringRequest.php | 4 +- .../src/V1/DeleteNetworkPolicyRequest.php | 4 +- .../src/V1/DeletePrivateCloudRequest.php | 8 +- .../src/V1/DeletePrivateConnectionRequest.php | 4 +- .../V1/DeleteVmwareEngineNetworkRequest.php | 6 +- VmwareEngine/src/V1/DnsBindPermission.php | 2 +- VmwareEngine/src/V1/DnsForwarding.php | 6 +- .../src/V1/DnsForwarding/ForwardingRule.php | 2 +- VmwareEngine/src/V1/ExternalAccessRule.php | 18 +- VmwareEngine/src/V1/ExternalAddress.php | 16 +- ...hNetworkPolicyExternalAddressesRequest.php | 6 +- ...NetworkPolicyExternalAddressesResponse.php | 2 +- .../src/V1/Gapic/VmwareEngineGapicClient.php | 8341 ----------------- VmwareEngine/src/V1/GetClusterRequest.php | 2 +- .../src/V1/GetDnsBindPermissionRequest.php | 2 +- .../src/V1/GetDnsForwardingRequest.php | 2 +- .../src/V1/GetExternalAccessRuleRequest.php | 2 +- .../src/V1/GetExternalAddressRequest.php | 2 +- .../src/V1/GetHcxActivationKeyRequest.php | 2 +- .../src/V1/GetLoggingServerRequest.php | 2 +- .../V1/GetManagementDnsZoneBindingRequest.php | 2 +- .../src/V1/GetNetworkPeeringRequest.php | 2 +- .../src/V1/GetNetworkPolicyRequest.php | 2 +- VmwareEngine/src/V1/GetNodeRequest.php | 2 +- VmwareEngine/src/V1/GetNodeTypeRequest.php | 2 +- .../src/V1/GetPrivateCloudRequest.php | 2 +- .../src/V1/GetPrivateConnectionRequest.php | 2 +- VmwareEngine/src/V1/GetSubnetRequest.php | 2 +- .../src/V1/GetVmwareEngineNetworkRequest.php | 2 +- .../src/V1/GrantDnsBindPermissionRequest.php | 6 +- VmwareEngine/src/V1/Hcx.php | 8 +- VmwareEngine/src/V1/HcxActivationKey.php | 10 +- VmwareEngine/src/V1/ListClustersRequest.php | 10 +- VmwareEngine/src/V1/ListClustersResponse.php | 2 +- .../src/V1/ListExternalAccessRulesRequest.php | 10 +- .../V1/ListExternalAccessRulesResponse.php | 2 +- .../src/V1/ListExternalAddressesRequest.php | 10 +- .../src/V1/ListExternalAddressesResponse.php | 2 +- .../src/V1/ListHcxActivationKeysRequest.php | 6 +- .../src/V1/ListHcxActivationKeysResponse.php | 2 +- .../src/V1/ListLoggingServersRequest.php | 10 +- .../src/V1/ListLoggingServersResponse.php | 2 +- .../ListManagementDnsZoneBindingsRequest.php | 10 +- .../ListManagementDnsZoneBindingsResponse.php | 2 +- .../src/V1/ListNetworkPeeringsRequest.php | 10 +- .../src/V1/ListNetworkPeeringsResponse.php | 2 +- .../src/V1/ListNetworkPoliciesRequest.php | 10 +- .../src/V1/ListNetworkPoliciesResponse.php | 2 +- VmwareEngine/src/V1/ListNodeTypesRequest.php | 8 +- VmwareEngine/src/V1/ListNodeTypesResponse.php | 2 +- VmwareEngine/src/V1/ListNodesRequest.php | 6 +- VmwareEngine/src/V1/ListNodesResponse.php | 2 +- .../src/V1/ListPeeringRoutesRequest.php | 8 +- .../src/V1/ListPeeringRoutesResponse.php | 2 +- .../src/V1/ListPrivateCloudsRequest.php | 10 +- .../src/V1/ListPrivateCloudsResponse.php | 2 +- ...tPrivateConnectionPeeringRoutesRequest.php | 6 +- ...PrivateConnectionPeeringRoutesResponse.php | 2 +- .../src/V1/ListPrivateConnectionsRequest.php | 10 +- .../src/V1/ListPrivateConnectionsResponse.php | 2 +- VmwareEngine/src/V1/ListSubnetsRequest.php | 6 +- VmwareEngine/src/V1/ListSubnetsResponse.php | 2 +- .../V1/ListVmwareEngineNetworksRequest.php | 10 +- .../V1/ListVmwareEngineNetworksResponse.php | 2 +- VmwareEngine/src/V1/LoggingServer.php | 16 +- .../src/V1/ManagementDnsZoneBinding.php | 12 +- VmwareEngine/src/V1/NetworkConfig.php | 10 +- VmwareEngine/src/V1/NetworkPeering.php | 32 +- VmwareEngine/src/V1/NetworkPolicy.php | 20 +- .../src/V1/NetworkPolicy/NetworkService.php | 4 +- VmwareEngine/src/V1/Node.php | 14 +- VmwareEngine/src/V1/NodeType.php | 16 +- VmwareEngine/src/V1/NodeTypeConfig.php | 4 +- VmwareEngine/src/V1/Nsx.php | 8 +- VmwareEngine/src/V1/OperationMetadata.php | 14 +- VmwareEngine/src/V1/PeeringRoute.php | 12 +- VmwareEngine/src/V1/PrivateCloud.php | 28 +- .../src/V1/PrivateCloud/ManagementCluster.php | 4 +- VmwareEngine/src/V1/PrivateConnection.php | 26 +- .../RepairManagementDnsZoneBindingRequest.php | 4 +- .../src/V1/ResetNsxCredentialsRequest.php | 4 +- .../src/V1/ResetVcenterCredentialsRequest.php | 6 +- .../src/V1/RevokeDnsBindPermissionRequest.php | 6 +- .../src/V1/ShowNsxCredentialsRequest.php | 2 +- .../src/V1/ShowVcenterCredentialsRequest.php | 4 +- .../src/V1/StretchedClusterConfig.php | 4 +- VmwareEngine/src/V1/Subnet.php | 12 +- .../src/V1/UndeletePrivateCloudRequest.php | 4 +- VmwareEngine/src/V1/UpdateClusterRequest.php | 8 +- .../src/V1/UpdateDnsForwardingRequest.php | 6 +- .../V1/UpdateExternalAccessRuleRequest.php | 6 +- .../src/V1/UpdateExternalAddressRequest.php | 6 +- .../src/V1/UpdateLoggingServerRequest.php | 6 +- .../UpdateManagementDnsZoneBindingRequest.php | 6 +- .../src/V1/UpdateNetworkPeeringRequest.php | 6 +- .../src/V1/UpdateNetworkPolicyRequest.php | 6 +- .../src/V1/UpdatePrivateCloudRequest.php | 6 +- .../src/V1/UpdatePrivateConnectionRequest.php | 6 +- VmwareEngine/src/V1/UpdateSubnetRequest.php | 4 +- .../V1/UpdateVmwareEngineNetworkRequest.php | 6 +- VmwareEngine/src/V1/Vcenter.php | 8 +- VmwareEngine/src/V1/VmwareEngineClient.php | 34 - VmwareEngine/src/V1/VmwareEngineNetwork.php | 16 +- .../src/V1/VmwareEngineNetwork/VpcNetwork.php | 4 +- .../Unit/V1/Client/VmwareEngineClientTest.php | 1871 ++-- .../tests/Unit/V1/VmwareEngineClientTest.php | 7944 ---------------- 558 files changed, 4833 insertions(+), 54159 deletions(-) delete mode 100644 GSuiteAddOns/src/V1/GSuiteAddOnsClient.php delete mode 100644 GSuiteAddOns/src/V1/Gapic/GSuiteAddOnsGapicClient.php delete mode 100644 GSuiteAddOns/tests/Unit/V1/GSuiteAddOnsClientTest.php delete mode 100644 GkeMultiCloud/src/V1/AttachedClustersClient.php delete mode 100644 GkeMultiCloud/src/V1/AttachedClustersGrpcClient.php delete mode 100644 GkeMultiCloud/src/V1/AwsClustersClient.php delete mode 100644 GkeMultiCloud/src/V1/AwsClustersGrpcClient.php delete mode 100644 GkeMultiCloud/src/V1/AzureClustersClient.php delete mode 100644 GkeMultiCloud/src/V1/AzureClustersGrpcClient.php delete mode 100644 GkeMultiCloud/src/V1/Gapic/AttachedClustersGapicClient.php delete mode 100644 GkeMultiCloud/src/V1/Gapic/AwsClustersGapicClient.php delete mode 100644 GkeMultiCloud/src/V1/Gapic/AzureClustersGapicClient.php delete mode 100644 GkeMultiCloud/tests/Unit/V1/AttachedClustersClientTest.php delete mode 100644 GkeMultiCloud/tests/Unit/V1/AwsClustersClientTest.php delete mode 100644 GkeMultiCloud/tests/Unit/V1/AzureClustersClientTest.php delete mode 100644 Run/src/V2/ExecutionsClient.php delete mode 100644 Run/src/V2/ExecutionsGrpcClient.php delete mode 100644 Run/src/V2/Gapic/ExecutionsGapicClient.php delete mode 100644 Run/src/V2/Gapic/JobsGapicClient.php delete mode 100644 Run/src/V2/Gapic/RevisionsGapicClient.php delete mode 100644 Run/src/V2/Gapic/ServicesGapicClient.php delete mode 100644 Run/src/V2/Gapic/TasksGapicClient.php delete mode 100644 Run/src/V2/JobsClient.php delete mode 100644 Run/src/V2/JobsGrpcClient.php delete mode 100644 Run/src/V2/RevisionsClient.php delete mode 100644 Run/src/V2/RevisionsGrpcClient.php delete mode 100644 Run/src/V2/ServicesClient.php delete mode 100644 Run/src/V2/ServicesGrpcClient.php delete mode 100644 Run/src/V2/TasksClient.php delete mode 100644 Run/src/V2/TasksGrpcClient.php delete mode 100644 Run/tests/Unit/V2/ExecutionsClientTest.php delete mode 100644 Run/tests/Unit/V2/JobsClientTest.php delete mode 100644 Run/tests/Unit/V2/RevisionsClientTest.php delete mode 100644 Run/tests/Unit/V2/ServicesClientTest.php delete mode 100644 Run/tests/Unit/V2/TasksClientTest.php delete mode 100644 StorageInsights/src/V1/Gapic/StorageInsightsGapicClient.php delete mode 100644 StorageInsights/src/V1/StorageInsightsClient.php delete mode 100644 StorageInsights/tests/Unit/V1/StorageInsightsClientTest.php delete mode 100644 VideoLiveStream/src/V1/Gapic/LivestreamServiceGapicClient.php delete mode 100644 VideoLiveStream/src/V1/LivestreamServiceClient.php delete mode 100644 VideoLiveStream/src/V1/LivestreamServiceGrpcClient.php delete mode 100644 VideoLiveStream/tests/Unit/V1/LivestreamServiceClientTest.php delete mode 100644 VideoStitcher/src/V1/AdTag.php delete mode 100644 VideoStitcher/src/V1/Gapic/VideoStitcherServiceGapicClient.php delete mode 100644 VideoStitcher/src/V1/LiveSession/GamSettings/GamDash.php delete mode 100644 VideoStitcher/src/V1/LiveSession/GamSettings/GamHls.php delete mode 100644 VideoStitcher/src/V1/LiveSession/StitchingPolicy.php delete mode 100644 VideoStitcher/src/V1/VideoStitcherServiceClient.php delete mode 100644 VideoStitcher/src/V1/VideoStitcherServiceGrpcClient.php delete mode 100644 VideoStitcher/tests/Unit/V1/VideoStitcherServiceClientTest.php delete mode 100644 VmwareEngine/src/V1/Gapic/VmwareEngineGapicClient.php delete mode 100644 VmwareEngine/src/V1/VmwareEngineClient.php delete mode 100644 VmwareEngine/tests/Unit/V1/VmwareEngineClientTest.php diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index d0ccfa394313..abdef5e0ac01 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -688,7 +688,7 @@ "GSuiteAddOns": { "language": "php", "distribution_name": "google/cloud-gsuite-addons", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-gsuite-addons/latest", "library_type": "GAPIC_AUTO", "product_documentation": "https://developers.google.com/workspace/add-ons/overview", @@ -736,7 +736,7 @@ "GkeMultiCloud": { "language": "php", "distribution_name": "google/cloud-gke-multi-cloud", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-gke-multi-cloud/latest", "library_type": "GAPIC_AUTO", "api_shortname": "gkemulticloud" @@ -1138,7 +1138,7 @@ "Run": { "language": "php", "distribution_name": "google/cloud-run", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-run/latest", "library_type": "GAPIC_AUTO", "api_shortname": "run" @@ -1385,7 +1385,7 @@ "StorageInsights": { "language": "php", "distribution_name": "google/cloud-storageinsights", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-storageinsights/latest", "library_type": "GAPIC_AUTO", "api_shortname": "storageinsights" @@ -1473,7 +1473,7 @@ "VideoLiveStream": { "language": "php", "distribution_name": "google/cloud-video-live-stream", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-video-live-stream/latest", "library_type": "GAPIC_AUTO", "api_shortname": "livestream" @@ -1481,7 +1481,7 @@ "VideoStitcher": { "language": "php", "distribution_name": "google/cloud-video-stitcher", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-video-stitcher/latest", "library_type": "GAPIC_AUTO", "api_shortname": "videostitcher" @@ -1513,7 +1513,7 @@ "VmwareEngine": { "language": "php", "distribution_name": "google/cloud-vmware-engine", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-vmware-engine/latest", "library_type": "GAPIC_AUTO", "product_documentation": "https://cloud.google.com/vmware-engine/docs", diff --git a/GSuiteAddOns/.OwlBot.yaml b/GSuiteAddOns/.OwlBot.yaml index 03f0e18bad0c..8569b15258b5 100644 --- a/GSuiteAddOns/.OwlBot.yaml +++ b/GSuiteAddOns/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/gsuiteaddons/v1/.*-php/(.*) - dest: /owl-bot-staging/GSuiteAddOns/v1/$1 + - source: /google/cloud/gsuiteaddons/(v1)/.*-php/(.*) + dest: /owl-bot-staging/GSuiteAddOns/$1/$2 api-name: GSuiteAddOns diff --git a/GSuiteAddOns/owlbot.py b/GSuiteAddOns/owlbot.py index 52aaaadc39d1..23f7b0633746 100644 --- a/GSuiteAddOns/owlbot.py +++ b/GSuiteAddOns/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. @@ -30,14 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php", - src / "**/*GrpcClient.php" - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -48,32 +41,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', @@ -82,8 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) + '--print-width=120']) diff --git a/GSuiteAddOns/src/V1/AddOns.php b/GSuiteAddOns/src/V1/AddOns.php index f7256e4308b5..e03bb68d1fd1 100644 --- a/GSuiteAddOns/src/V1/AddOns.php +++ b/GSuiteAddOns/src/V1/AddOns.php @@ -20,49 +20,49 @@ class AddOns extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.apps.script.type.CommonAddOnManifest common = 1; */ - private $common = null; + protected $common = null; /** * Gmail add-on configuration. * * Generated from protobuf field .google.apps.script.type.gmail.GmailAddOnManifest gmail = 2; */ - private $gmail = null; + protected $gmail = null; /** * Drive add-on configuration. * * Generated from protobuf field .google.apps.script.type.drive.DriveAddOnManifest drive = 5; */ - private $drive = null; + protected $drive = null; /** * Calendar add-on configuration. * * Generated from protobuf field .google.apps.script.type.calendar.CalendarAddOnManifest calendar = 6; */ - private $calendar = null; + protected $calendar = null; /** * Docs add-on configuration. * * Generated from protobuf field .google.apps.script.type.docs.DocsAddOnManifest docs = 7; */ - private $docs = null; + protected $docs = null; /** * Sheets add-on configuration. * * Generated from protobuf field .google.apps.script.type.sheets.SheetsAddOnManifest sheets = 8; */ - private $sheets = null; + protected $sheets = null; /** * Slides add-on configuration. * * Generated from protobuf field .google.apps.script.type.slides.SlidesAddOnManifest slides = 10; */ - private $slides = null; + protected $slides = null; /** * Options for sending requests to add-on HTTP endpoints * * Generated from protobuf field .google.apps.script.type.HttpOptions http_options = 15; */ - private $http_options = null; + protected $http_options = null; /** * Constructor. diff --git a/GSuiteAddOns/src/V1/Authorization.php b/GSuiteAddOns/src/V1/Authorization.php index 2df5b1a267a5..904cb85121ea 100644 --- a/GSuiteAddOns/src/V1/Authorization.php +++ b/GSuiteAddOns/src/V1/Authorization.php @@ -21,21 +21,21 @@ class Authorization extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * The email address of the service account used to authenticate requests to * add-on callback endpoints. * * Generated from protobuf field string service_account_email = 2; */ - private $service_account_email = ''; + protected $service_account_email = ''; /** * The OAuth client ID used to obtain OAuth access tokens for a user on the * add-on's behalf. * * Generated from protobuf field string oauth_client_id = 3; */ - private $oauth_client_id = ''; + protected $oauth_client_id = ''; /** * Constructor. diff --git a/GSuiteAddOns/src/V1/Client/GSuiteAddOnsClient.php b/GSuiteAddOns/src/V1/Client/GSuiteAddOnsClient.php index 5d644a155dd0..6ac57625641d 100644 --- a/GSuiteAddOns/src/V1/Client/GSuiteAddOnsClient.php +++ b/GSuiteAddOns/src/V1/Client/GSuiteAddOnsClient.php @@ -1,6 +1,6 @@ string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The id to use for this deployment. The full name of the created * resource will be `projects//deployments/`. * * Generated from protobuf field string deployment_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployment_id = ''; + protected $deployment_id = ''; /** * Required. The deployment to create (deployment.name cannot be set). * * Generated from protobuf field .google.cloud.gsuiteaddons.v1.Deployment deployment = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployment = null; + protected $deployment = null; /** * @param string $parent Required. Name of the project in which to create the deployment. diff --git a/GSuiteAddOns/src/V1/DeleteDeploymentRequest.php b/GSuiteAddOns/src/V1/DeleteDeploymentRequest.php index 08c497ba7ff6..fd86c02f4bad 100644 --- a/GSuiteAddOns/src/V1/DeleteDeploymentRequest.php +++ b/GSuiteAddOns/src/V1/DeleteDeploymentRequest.php @@ -21,14 +21,14 @@ class DeleteDeploymentRequest 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 etag of the deployment to delete. * If this is provided, it must match the server's etag. * * Generated from protobuf field string etag = 2; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The full resource name of the deployment to delete. diff --git a/GSuiteAddOns/src/V1/Deployment.php b/GSuiteAddOns/src/V1/Deployment.php index 887535e92f68..4eb8c8fefa1d 100644 --- a/GSuiteAddOns/src/V1/Deployment.php +++ b/GSuiteAddOns/src/V1/Deployment.php @@ -21,7 +21,7 @@ class Deployment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * The list of Google OAuth scopes for which to request consent from the end * user before executing an add-on endpoint. @@ -34,7 +34,7 @@ class Deployment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gsuiteaddons.v1.AddOns add_ons = 3; */ - private $add_ons = null; + protected $add_ons = null; /** * This value is computed by the server based on the version of the * deployment in storage, and may be sent on update and delete requests to @@ -42,7 +42,7 @@ class Deployment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 5; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/GSuiteAddOns/src/V1/GSuiteAddOnsClient.php b/GSuiteAddOns/src/V1/GSuiteAddOnsClient.php deleted file mode 100644 index 67b693024ef2..000000000000 --- a/GSuiteAddOns/src/V1/GSuiteAddOnsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -projectName('[PROJECT]'); - * $deploymentId = 'deployment_id'; - * $deployment = new Deployment(); - * $response = $gSuiteAddOnsClient->createDeployment($formattedParent, $deploymentId, $deployment); - * } finally { - * $gSuiteAddOnsClient->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\GSuiteAddOns\V1\Client\GSuiteAddOnsClient}. - */ -class GSuiteAddOnsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.gsuiteaddons.v1.GSuiteAddOns'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'gsuiteaddons.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'gsuiteaddons.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 $authorizationNameTemplate; - - private static $deploymentNameTemplate; - - private static $installStatusNameTemplate; - - private static $projectNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/g_suite_add_ons_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/g_suite_add_ons_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/g_suite_add_ons_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/g_suite_add_ons_rest_client_config.php', - ], - ], - ]; - } - - private static function getAuthorizationNameTemplate() - { - if (self::$authorizationNameTemplate == null) { - self::$authorizationNameTemplate = new PathTemplate( - 'projects/{project}/authorization' - ); - } - - return self::$authorizationNameTemplate; - } - - private static function getDeploymentNameTemplate() - { - if (self::$deploymentNameTemplate == null) { - self::$deploymentNameTemplate = new PathTemplate( - 'projects/{project}/deployments/{deployment}' - ); - } - - return self::$deploymentNameTemplate; - } - - private static function getInstallStatusNameTemplate() - { - if (self::$installStatusNameTemplate == null) { - self::$installStatusNameTemplate = new PathTemplate( - 'projects/{project}/deployments/{deployment}/installStatus' - ); - } - - return self::$installStatusNameTemplate; - } - - 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 = [ - 'authorization' => self::getAuthorizationNameTemplate(), - 'deployment' => self::getDeploymentNameTemplate(), - 'installStatus' => self::getInstallStatusNameTemplate(), - 'project' => self::getProjectNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * authorization resource. - * - * @param string $project - * - * @return string The formatted authorization resource. - */ - public static function authorizationName($project) - { - return self::getAuthorizationNameTemplate()->render([ - 'project' => $project, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a deployment - * resource. - * - * @param string $project - * @param string $deployment - * - * @return string The formatted deployment resource. - */ - public static function deploymentName($project, $deployment) - { - return self::getDeploymentNameTemplate()->render([ - 'project' => $project, - 'deployment' => $deployment, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * install_status resource. - * - * @param string $project - * @param string $deployment - * - * @return string The formatted install_status resource. - */ - public static function installStatusName($project, $deployment) - { - return self::getInstallStatusNameTemplate()->render([ - 'project' => $project, - 'deployment' => $deployment, - ]); - } - - /** - * 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 - * - authorization: projects/{project}/authorization - * - deployment: projects/{project}/deployments/{deployment} - * - installStatus: projects/{project}/deployments/{deployment}/installStatus - * - 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" - ); - } - - /** - * 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 'gsuiteaddons.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); - } - - /** - * Creates a deployment with the specified name and configuration. - * - * Sample code: - * ``` - * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); - * try { - * $formattedParent = $gSuiteAddOnsClient->projectName('[PROJECT]'); - * $deploymentId = 'deployment_id'; - * $deployment = new Deployment(); - * $response = $gSuiteAddOnsClient->createDeployment($formattedParent, $deploymentId, $deployment); - * } finally { - * $gSuiteAddOnsClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the project in which to create the deployment. - * - * Example: `projects/my_project`. - * @param string $deploymentId Required. The id to use for this deployment. The full name of the created - * resource will be `projects//deployments/`. - * @param Deployment $deployment Required. The deployment to create (deployment.name cannot be set). - * @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\GSuiteAddOns\V1\Deployment - * - * @throws ApiException if the remote call fails - */ - public function createDeployment( - $parent, - $deploymentId, - $deployment, - array $optionalArgs = [] - ) { - $request = new CreateDeploymentRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDeploymentId($deploymentId); - $request->setDeployment($deployment); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateDeployment', - Deployment::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes the deployment with the given name. - * - * Sample code: - * ``` - * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); - * try { - * $formattedName = $gSuiteAddOnsClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - * $gSuiteAddOnsClient->deleteDeployment($formattedName); - * } finally { - * $gSuiteAddOnsClient->close(); - * } - * ``` - * - * @param string $name Required. The full resource name of the deployment to delete. - * - * Example: `projects/my_project/deployments/my_deployment`. - * @param array $optionalArgs { - * Optional. - * - * @type string $etag - * The etag of the deployment to delete. - * If this is provided, it must match the server's 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. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteDeployment($name, array $optionalArgs = []) - { - $request = new DeleteDeploymentRequest(); - $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->startCall( - 'DeleteDeployment', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets the authorization information for deployments in a given project. - * - * Sample code: - * ``` - * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); - * try { - * $formattedName = $gSuiteAddOnsClient->authorizationName('[PROJECT]'); - * $response = $gSuiteAddOnsClient->getAuthorization($formattedName); - * } finally { - * $gSuiteAddOnsClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the project for which to get the Google Workspace Add-ons - * authorization information. - * - * Example: `projects/my_project/authorization`. - * @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\GSuiteAddOns\V1\Authorization - * - * @throws ApiException if the remote call fails - */ - public function getAuthorization($name, array $optionalArgs = []) - { - $request = new GetAuthorizationRequest(); - $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( - 'GetAuthorization', - Authorization::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets the deployment with the specified name. - * - * Sample code: - * ``` - * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); - * try { - * $formattedName = $gSuiteAddOnsClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - * $response = $gSuiteAddOnsClient->getDeployment($formattedName); - * } finally { - * $gSuiteAddOnsClient->close(); - * } - * ``` - * - * @param string $name Required. The full resource name of the deployment to get. - * - * Example: `projects/my_project/deployments/my_deployment`. - * @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\GSuiteAddOns\V1\Deployment - * - * @throws ApiException if the remote call fails - */ - public function getDeployment($name, array $optionalArgs = []) - { - $request = new GetDeploymentRequest(); - $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( - 'GetDeployment', - Deployment::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Fetches the install status of a developer mode deployment. - * - * Sample code: - * ``` - * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); - * try { - * $formattedName = $gSuiteAddOnsClient->installStatusName('[PROJECT]', '[DEPLOYMENT]'); - * $response = $gSuiteAddOnsClient->getInstallStatus($formattedName); - * } finally { - * $gSuiteAddOnsClient->close(); - * } - * ``` - * - * @param string $name Required. The full resource name of the deployment. - * - * Example: `projects/my_project/deployments/my_deployment/installStatus`. - * @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\GSuiteAddOns\V1\InstallStatus - * - * @throws ApiException if the remote call fails - */ - public function getInstallStatus($name, array $optionalArgs = []) - { - $request = new GetInstallStatusRequest(); - $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( - 'GetInstallStatus', - InstallStatus::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Installs a deployment in developer mode. - * See: - * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. - * - * Sample code: - * ``` - * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); - * try { - * $formattedName = $gSuiteAddOnsClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - * $gSuiteAddOnsClient->installDeployment($formattedName); - * } finally { - * $gSuiteAddOnsClient->close(); - * } - * ``` - * - * @param string $name Required. The full resource name of the deployment to install. - * - * Example: `projects/my_project/deployments/my_deployment`. - * @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 installDeployment($name, array $optionalArgs = []) - { - $request = new InstallDeploymentRequest(); - $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( - 'InstallDeployment', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists all deployments in a particular project. - * - * Sample code: - * ``` - * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); - * try { - * $formattedParent = $gSuiteAddOnsClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $gSuiteAddOnsClient->listDeployments($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $gSuiteAddOnsClient->listDeployments($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $gSuiteAddOnsClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the project in which to create the deployment. - * - * Example: `projects/my_project`. - * @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 listDeployments($parent, array $optionalArgs = []) - { - $request = new ListDeploymentsRequest(); - $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( - 'ListDeployments', - $optionalArgs, - ListDeploymentsResponse::class, - $request - ); - } - - /** - * Creates or replaces a deployment with the specified name. - * - * Sample code: - * ``` - * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); - * try { - * $deployment = new Deployment(); - * $response = $gSuiteAddOnsClient->replaceDeployment($deployment); - * } finally { - * $gSuiteAddOnsClient->close(); - * } - * ``` - * - * @param Deployment $deployment Required. The deployment to create or replace. - * @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\GSuiteAddOns\V1\Deployment - * - * @throws ApiException if the remote call fails - */ - public function replaceDeployment($deployment, array $optionalArgs = []) - { - $request = new ReplaceDeploymentRequest(); - $requestParamHeaders = []; - $request->setDeployment($deployment); - $requestParamHeaders['deployment.name'] = $deployment->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ReplaceDeployment', - Deployment::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Uninstalls a developer mode deployment. - * See: - * https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons. - * - * Sample code: - * ``` - * $gSuiteAddOnsClient = new GSuiteAddOnsClient(); - * try { - * $formattedName = $gSuiteAddOnsClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - * $gSuiteAddOnsClient->uninstallDeployment($formattedName); - * } finally { - * $gSuiteAddOnsClient->close(); - * } - * ``` - * - * @param string $name Required. The full resource name of the deployment to install. - * - * Example: `projects/my_project/deployments/my_deployment`. - * @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 uninstallDeployment($name, array $optionalArgs = []) - { - $request = new UninstallDeploymentRequest(); - $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( - 'UninstallDeployment', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } -} diff --git a/GSuiteAddOns/src/V1/GetAuthorizationRequest.php b/GSuiteAddOns/src/V1/GetAuthorizationRequest.php index 5467a5d8fa75..431a860fb261 100644 --- a/GSuiteAddOns/src/V1/GetAuthorizationRequest.php +++ b/GSuiteAddOns/src/V1/GetAuthorizationRequest.php @@ -22,7 +22,7 @@ class GetAuthorizationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Name of the project for which to get the Google Workspace Add-ons diff --git a/GSuiteAddOns/src/V1/GetDeploymentRequest.php b/GSuiteAddOns/src/V1/GetDeploymentRequest.php index 2ade5154f4c2..6de539926055 100644 --- a/GSuiteAddOns/src/V1/GetDeploymentRequest.php +++ b/GSuiteAddOns/src/V1/GetDeploymentRequest.php @@ -21,7 +21,7 @@ class GetDeploymentRequest 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 full resource name of the deployment to get. diff --git a/GSuiteAddOns/src/V1/GetInstallStatusRequest.php b/GSuiteAddOns/src/V1/GetInstallStatusRequest.php index 06d33ac3225b..e326d58f39be 100644 --- a/GSuiteAddOns/src/V1/GetInstallStatusRequest.php +++ b/GSuiteAddOns/src/V1/GetInstallStatusRequest.php @@ -21,7 +21,7 @@ class GetInstallStatusRequest 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 full resource name of the deployment. diff --git a/GSuiteAddOns/src/V1/InstallDeploymentRequest.php b/GSuiteAddOns/src/V1/InstallDeploymentRequest.php index 0208f547a132..c0cddef7f5b5 100644 --- a/GSuiteAddOns/src/V1/InstallDeploymentRequest.php +++ b/GSuiteAddOns/src/V1/InstallDeploymentRequest.php @@ -21,7 +21,7 @@ class InstallDeploymentRequest 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 full resource name of the deployment to install. diff --git a/GSuiteAddOns/src/V1/InstallStatus.php b/GSuiteAddOns/src/V1/InstallStatus.php index f8df35273677..d3636bd3028c 100644 --- a/GSuiteAddOns/src/V1/InstallStatus.php +++ b/GSuiteAddOns/src/V1/InstallStatus.php @@ -21,13 +21,13 @@ class InstallStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * True if the deployment is installed for the user * * Generated from protobuf field .google.protobuf.BoolValue installed = 2; */ - private $installed = null; + protected $installed = null; /** * Constructor. @@ -104,7 +104,7 @@ public function clearInstalled() * Generated from protobuf field .google.protobuf.BoolValue installed = 2; * @return bool|null */ - public function getInstalledValue() + public function getInstalledUnwrapped() { return $this->readWrapperValue("installed"); } @@ -133,7 +133,7 @@ public function setInstalled($var) * @param bool|null $var * @return $this */ - public function setInstalledValue($var) + public function setInstalledUnwrapped($var) { $this->writeWrapperValue("installed", $var); return $this;} diff --git a/GSuiteAddOns/src/V1/ListDeploymentsRequest.php b/GSuiteAddOns/src/V1/ListDeploymentsRequest.php index 302288c2a285..0d3789df7934 100644 --- a/GSuiteAddOns/src/V1/ListDeploymentsRequest.php +++ b/GSuiteAddOns/src/V1/ListDeploymentsRequest.php @@ -21,7 +21,7 @@ class ListDeploymentsRequest 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 deployments to return. The service may return fewer * than this value. @@ -30,7 +30,7 @@ class ListDeploymentsRequest 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 `ListDeployments` call. * Provide this to retrieve the subsequent page. @@ -39,7 +39,7 @@ class ListDeploymentsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Name of the project in which to create the deployment. diff --git a/GSuiteAddOns/src/V1/ListDeploymentsResponse.php b/GSuiteAddOns/src/V1/ListDeploymentsResponse.php index 90578d8896d0..4a2b06a63091 100644 --- a/GSuiteAddOns/src/V1/ListDeploymentsResponse.php +++ b/GSuiteAddOns/src/V1/ListDeploymentsResponse.php @@ -27,7 +27,7 @@ class ListDeploymentsResponse 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/GSuiteAddOns/src/V1/ReplaceDeploymentRequest.php b/GSuiteAddOns/src/V1/ReplaceDeploymentRequest.php index d8ce5cb5f0b6..3a79b65b564f 100644 --- a/GSuiteAddOns/src/V1/ReplaceDeploymentRequest.php +++ b/GSuiteAddOns/src/V1/ReplaceDeploymentRequest.php @@ -20,7 +20,7 @@ class ReplaceDeploymentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gsuiteaddons.v1.Deployment deployment = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $deployment = null; + protected $deployment = null; /** * @param \Google\Cloud\GSuiteAddOns\V1\Deployment $deployment Required. The deployment to create or replace. diff --git a/GSuiteAddOns/src/V1/UninstallDeploymentRequest.php b/GSuiteAddOns/src/V1/UninstallDeploymentRequest.php index 776c7a1618f8..92f1cbe2a500 100644 --- a/GSuiteAddOns/src/V1/UninstallDeploymentRequest.php +++ b/GSuiteAddOns/src/V1/UninstallDeploymentRequest.php @@ -21,7 +21,7 @@ class UninstallDeploymentRequest 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 full resource name of the deployment to install. diff --git a/GSuiteAddOns/tests/Unit/V1/Client/GSuiteAddOnsClientTest.php b/GSuiteAddOns/tests/Unit/V1/Client/GSuiteAddOnsClientTest.php index bee744fc1009..895af783c9cc 100644 --- a/GSuiteAddOns/tests/Unit/V1/Client/GSuiteAddOnsClientTest.php +++ b/GSuiteAddOns/tests/Unit/V1/Client/GSuiteAddOnsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return GSuiteAddOnsClient */ @@ -122,12 +124,15 @@ public function createDeploymentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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]'); @@ -163,8 +168,7 @@ public function deleteDeploymentTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new DeleteDeploymentRequest()) - ->setName($formattedName); + $request = (new DeleteDeploymentRequest())->setName($formattedName); $gapicClient->deleteDeployment($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -187,17 +191,19 @@ public function deleteDeploymentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new DeleteDeploymentRequest()) - ->setName($formattedName); + $request = (new DeleteDeploymentRequest())->setName($formattedName); try { $gapicClient->deleteDeployment($request); // If the $gapicClient method call did not throw, fail the test @@ -230,8 +236,7 @@ public function getAuthorizationTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->authorizationName('[PROJECT]'); - $request = (new GetAuthorizationRequest()) - ->setName($formattedName); + $request = (new GetAuthorizationRequest())->setName($formattedName); $response = $gapicClient->getAuthorization($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -255,17 +260,19 @@ public function getAuthorizationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->authorizationName('[PROJECT]'); - $request = (new GetAuthorizationRequest()) - ->setName($formattedName); + $request = (new GetAuthorizationRequest())->setName($formattedName); try { $gapicClient->getAuthorization($request); // If the $gapicClient method call did not throw, fail the test @@ -296,8 +303,7 @@ public function getDeploymentTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new GetDeploymentRequest()) - ->setName($formattedName); + $request = (new GetDeploymentRequest())->setName($formattedName); $response = $gapicClient->getDeployment($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -321,17 +327,19 @@ public function getDeploymentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new GetDeploymentRequest()) - ->setName($formattedName); + $request = (new GetDeploymentRequest())->setName($formattedName); try { $gapicClient->getDeployment($request); // If the $gapicClient method call did not throw, fail the test @@ -360,8 +368,7 @@ public function getInstallStatusTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->installStatusName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new GetInstallStatusRequest()) - ->setName($formattedName); + $request = (new GetInstallStatusRequest())->setName($formattedName); $response = $gapicClient->getInstallStatus($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -385,17 +392,19 @@ public function getInstallStatusExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->installStatusName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new GetInstallStatusRequest()) - ->setName($formattedName); + $request = (new GetInstallStatusRequest())->setName($formattedName); try { $gapicClient->getInstallStatus($request); // If the $gapicClient method call did not throw, fail the test @@ -422,8 +431,7 @@ public function installDeploymentTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new InstallDeploymentRequest()) - ->setName($formattedName); + $request = (new InstallDeploymentRequest())->setName($formattedName); $gapicClient->installDeployment($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -446,17 +454,19 @@ public function installDeploymentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new InstallDeploymentRequest()) - ->setName($formattedName); + $request = (new InstallDeploymentRequest())->setName($formattedName); try { $gapicClient->installDeployment($request); // If the $gapicClient method call did not throw, fail the test @@ -481,17 +491,14 @@ public function listDeploymentsTest() // Mock response $nextPageToken = ''; $deploymentsElement = new Deployment(); - $deployments = [ - $deploymentsElement, - ]; + $deployments = [$deploymentsElement]; $expectedResponse = new ListDeploymentsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDeployments($deployments); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListDeploymentsRequest()) - ->setParent($formattedParent); + $request = (new ListDeploymentsRequest())->setParent($formattedParent); $response = $gapicClient->listDeployments($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -518,17 +525,19 @@ public function listDeploymentsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListDeploymentsRequest()) - ->setParent($formattedParent); + $request = (new ListDeploymentsRequest())->setParent($formattedParent); try { $gapicClient->listDeployments($request); // If the $gapicClient method call did not throw, fail the test @@ -559,8 +568,7 @@ public function replaceDeploymentTest() $transport->addResponse($expectedResponse); // Mock request $deployment = new Deployment(); - $request = (new ReplaceDeploymentRequest()) - ->setDeployment($deployment); + $request = (new ReplaceDeploymentRequest())->setDeployment($deployment); $response = $gapicClient->replaceDeployment($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -584,17 +592,19 @@ public function replaceDeploymentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $deployment = new Deployment(); - $request = (new ReplaceDeploymentRequest()) - ->setDeployment($deployment); + $request = (new ReplaceDeploymentRequest())->setDeployment($deployment); try { $gapicClient->replaceDeployment($request); // If the $gapicClient method call did not throw, fail the test @@ -621,8 +631,7 @@ public function uninstallDeploymentTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new UninstallDeploymentRequest()) - ->setName($formattedName); + $request = (new UninstallDeploymentRequest())->setName($formattedName); $gapicClient->uninstallDeployment($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -645,17 +654,19 @@ public function uninstallDeploymentExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $request = (new UninstallDeploymentRequest()) - ->setName($formattedName); + $request = (new UninstallDeploymentRequest())->setName($formattedName); try { $gapicClient->uninstallDeployment($request); // If the $gapicClient method call did not throw, fail the test diff --git a/GSuiteAddOns/tests/Unit/V1/GSuiteAddOnsClientTest.php b/GSuiteAddOns/tests/Unit/V1/GSuiteAddOnsClientTest.php deleted file mode 100644 index f1a3c2e3f7db..000000000000 --- a/GSuiteAddOns/tests/Unit/V1/GSuiteAddOnsClientTest.php +++ /dev/null @@ -1,622 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return GSuiteAddOnsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new GSuiteAddOnsClient($options); - } - - /** @test */ - public function createDeploymentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new Deployment(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $deploymentId = 'deploymentId51250389'; - $deployment = new Deployment(); - $response = $gapicClient->createDeployment($formattedParent, $deploymentId, $deployment); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/CreateDeployment', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getDeploymentId(); - $this->assertProtobufEquals($deploymentId, $actualValue); - $actualValue = $actualRequestObject->getDeployment(); - $this->assertProtobufEquals($deployment, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createDeploymentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $deploymentId = 'deploymentId51250389'; - $deployment = new Deployment(); - try { - $gapicClient->createDeployment($formattedParent, $deploymentId, $deployment); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteDeploymentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $gapicClient->deleteDeployment($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/DeleteDeployment', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteDeploymentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - try { - $gapicClient->deleteDeployment($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 getAuthorizationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $serviceAccountEmail = 'serviceAccountEmail-1300473088'; - $oauthClientId = 'oauthClientId-1137123737'; - $expectedResponse = new Authorization(); - $expectedResponse->setName($name2); - $expectedResponse->setServiceAccountEmail($serviceAccountEmail); - $expectedResponse->setOauthClientId($oauthClientId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->authorizationName('[PROJECT]'); - $response = $gapicClient->getAuthorization($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.gsuiteaddons.v1.GSuiteAddOns/GetAuthorization', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAuthorizationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->authorizationName('[PROJECT]'); - try { - $gapicClient->getAuthorization($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 getDeploymentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $expectedResponse = new Deployment(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $response = $gapicClient->getDeployment($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.gsuiteaddons.v1.GSuiteAddOns/GetDeployment', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDeploymentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - try { - $gapicClient->getDeployment($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 getInstallStatusTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new InstallStatus(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->installStatusName('[PROJECT]', '[DEPLOYMENT]'); - $response = $gapicClient->getInstallStatus($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.gsuiteaddons.v1.GSuiteAddOns/GetInstallStatus', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstallStatusExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->installStatusName('[PROJECT]', '[DEPLOYMENT]'); - try { - $gapicClient->getInstallStatus($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 installDeploymentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $gapicClient->installDeployment($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/InstallDeployment', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function installDeploymentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - try { - $gapicClient->installDeployment($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 listDeploymentsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $deploymentsElement = new Deployment(); - $deployments = [ - $deploymentsElement, - ]; - $expectedResponse = new ListDeploymentsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDeployments($deployments); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listDeployments($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDeployments()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/ListDeployments', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDeploymentsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listDeployments($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 replaceDeploymentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new Deployment(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $deployment = new Deployment(); - $response = $gapicClient->replaceDeployment($deployment); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/ReplaceDeployment', $actualFuncCall); - $actualValue = $actualRequestObject->getDeployment(); - $this->assertProtobufEquals($deployment, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function replaceDeploymentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $deployment = new Deployment(); - try { - $gapicClient->replaceDeployment($deployment); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function uninstallDeploymentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - $gapicClient->uninstallDeployment($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gsuiteaddons.v1.GSuiteAddOns/UninstallDeployment', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function uninstallDeploymentExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->deploymentName('[PROJECT]', '[DEPLOYMENT]'); - try { - $gapicClient->uninstallDeployment($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()); - } -} diff --git a/GkeMultiCloud/.OwlBot.yaml b/GkeMultiCloud/.OwlBot.yaml index 5ed5ff80c499..38f86a04b661 100644 --- a/GkeMultiCloud/.OwlBot.yaml +++ b/GkeMultiCloud/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/gkemulticloud/v1/.*-php/(.*) - dest: /owl-bot-staging/GkeMultiCloud/v1/$1 + - source: /google/cloud/gkemulticloud/(v1)/.*-php/(.*) + dest: /owl-bot-staging/GkeMultiCloud/$1/$2 api-name: GkeMultiCloud diff --git a/GkeMultiCloud/README.md b/GkeMultiCloud/README.md index f778ed47d950..86453b203ed8 100644 --- a/GkeMultiCloud/README.md +++ b/GkeMultiCloud/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/GkeMultiCloud/owlbot.py b/GkeMultiCloud/owlbot.py index b22132746abb..be1be3ac13d8 100644 --- a/GkeMultiCloud/owlbot.py +++ b/GkeMultiCloud/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. @@ -30,13 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php" - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -47,33 +41,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', @@ -82,8 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) \ No newline at end of file + '--print-width=120']) diff --git a/GkeMultiCloud/src/V1/AttachedCluster.php b/GkeMultiCloud/src/V1/AttachedCluster.php index f0294ce32abb..75061e581c14 100644 --- a/GkeMultiCloud/src/V1/AttachedCluster.php +++ b/GkeMultiCloud/src/V1/AttachedCluster.php @@ -24,20 +24,20 @@ class AttachedCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Optional. A human readable description of this cluster. * Cannot be longer than 255 UTF-8 encoded bytes. * * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Required. OpenID Connect (OIDC) configuration for the cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedOidcConfig oidc_config = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $oidc_config = null; + protected $oidc_config = null; /** * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). * You can list all supported versions on a given Google Cloud region by @@ -46,14 +46,14 @@ class AttachedCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string platform_version = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $platform_version = ''; + protected $platform_version = ''; /** * Required. The Kubernetes distribution of the underlying attached cluster. * Supported values: ["eks", "aks", "generic"]. * * Generated from protobuf field string distribution = 16 [(.google.api.field_behavior) = REQUIRED]; */ - private $distribution = ''; + protected $distribution = ''; /** * Output only. The region where this cluster runs. * For EKS clusters, this is a AWS region. For AKS clusters, @@ -61,43 +61,43 @@ class AttachedCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string cluster_region = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $cluster_region = ''; + protected $cluster_region = ''; /** * Required. Fleet configuration. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $fleet = null; + protected $fleet = null; /** * Output only. The current state of the cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. A globally unique identifier for the cluster. * * Generated from protobuf field string uid = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. If set, there are currently changes in flight to the cluster. * * Generated from protobuf field bool reconciling = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. The time at which this cluster was registered. * * 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. The time at which this cluster was last 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; /** * Allows clients to perform consistent read-modify-writes * through optimistic concurrency control. @@ -106,13 +106,13 @@ class AttachedCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 11; */ - private $etag = ''; + protected $etag = ''; /** * Output only. The Kubernetes version of the cluster. * * Generated from protobuf field string kubernetes_version = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $kubernetes_version = ''; + protected $kubernetes_version = ''; /** * Optional. Annotations on the cluster. * This field has the same restrictions as Kubernetes annotations. @@ -131,13 +131,13 @@ class AttachedCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $workload_identity_config = null; + protected $workload_identity_config = null; /** * Optional. Logging configuration for this cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 15 [(.google.api.field_behavior) = OPTIONAL]; */ - private $logging_config = null; + protected $logging_config = null; /** * Output only. A set of errors found in the cluster. * @@ -149,25 +149,25 @@ class AttachedCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedClustersAuthorization authorization = 21 [(.google.api.field_behavior) = OPTIONAL]; */ - private $authorization = null; + protected $authorization = null; /** * Optional. Monitoring configuration for this cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 23 [(.google.api.field_behavior) = OPTIONAL]; */ - private $monitoring_config = null; + protected $monitoring_config = null; /** * Optional. Proxy configuration for outbound HTTP(S) traffic. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedProxyConfig proxy_config = 24 [(.google.api.field_behavior) = OPTIONAL]; */ - private $proxy_config = null; + protected $proxy_config = null; /** * Optional. Binary Authorization configuration for this cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.BinaryAuthorization binary_authorization = 25 [(.google.api.field_behavior) = OPTIONAL]; */ - private $binary_authorization = null; + protected $binary_authorization = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AttachedClusterError.php b/GkeMultiCloud/src/V1/AttachedClusterError.php index daaf28d2aad1..7e2ea588596e 100644 --- a/GkeMultiCloud/src/V1/AttachedClusterError.php +++ b/GkeMultiCloud/src/V1/AttachedClusterError.php @@ -20,7 +20,7 @@ class AttachedClusterError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string message = 1; */ - private $message = ''; + protected $message = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AttachedClusterGroup.php b/GkeMultiCloud/src/V1/AttachedClusterGroup.php index f2e682de10a1..74ec3910d5e6 100644 --- a/GkeMultiCloud/src/V1/AttachedClusterGroup.php +++ b/GkeMultiCloud/src/V1/AttachedClusterGroup.php @@ -20,7 +20,7 @@ class AttachedClusterGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $group = ''; + protected $group = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AttachedClusterUser.php b/GkeMultiCloud/src/V1/AttachedClusterUser.php index 3e2d4a9c758d..f020f59ff48b 100644 --- a/GkeMultiCloud/src/V1/AttachedClusterUser.php +++ b/GkeMultiCloud/src/V1/AttachedClusterUser.php @@ -20,7 +20,7 @@ class AttachedClusterUser extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $username = ''; + protected $username = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AttachedClustersClient.php b/GkeMultiCloud/src/V1/AttachedClustersClient.php deleted file mode 100644 index a7029dacd067..000000000000 --- a/GkeMultiCloud/src/V1/AttachedClustersClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/CreateAttachedCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates an - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. - * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAttachedClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateAttachedCluster(\Google\Cloud\GkeMultiCloud\V1\UpdateAttachedClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/UpdateAttachedCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Imports creates a new - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * by importing an existing Fleet Membership resource. - * - * Attached Clusters created before the introduction of the Anthos Multi-Cloud - * API can be imported through this method. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\ImportAttachedClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ImportAttachedCluster(\Google\Cloud\GkeMultiCloud\V1\ImportAttachedClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/ImportAttachedCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Describes a specific - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. - * @param \Google\Cloud\GkeMultiCloud\V1\GetAttachedClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAttachedCluster(\Google\Cloud\GkeMultiCloud\V1\GetAttachedClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/GetAttachedCluster', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\AttachedCluster', 'decode'], - $metadata, $options); - } - - /** - * Lists all [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] - * resources on a given Google Cloud project and region. - * @param \Google\Cloud\GkeMultiCloud\V1\ListAttachedClustersRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListAttachedClusters(\Google\Cloud\GkeMultiCloud\V1\ListAttachedClustersRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/ListAttachedClusters', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\ListAttachedClustersResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a specific - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAttachedClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteAttachedCluster(\Google\Cloud\GkeMultiCloud\V1\DeleteAttachedClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/DeleteAttachedCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Returns information, such as supported Kubernetes versions, on a given - * Google Cloud location. - * @param \Google\Cloud\GkeMultiCloud\V1\GetAttachedServerConfigRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAttachedServerConfig(\Google\Cloud\GkeMultiCloud\V1\GetAttachedServerConfigRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/GetAttachedServerConfig', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\AttachedServerConfig', 'decode'], - $metadata, $options); - } - - /** - * Generates the install manifest to be installed on the target cluster. - * @param \Google\Cloud\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GenerateAttachedClusterInstallManifest(\Google\Cloud\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterInstallManifest', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/GkeMultiCloud/src/V1/AttachedOidcConfig.php b/GkeMultiCloud/src/V1/AttachedOidcConfig.php index 11a395c7c8a6..116db53533d8 100644 --- a/GkeMultiCloud/src/V1/AttachedOidcConfig.php +++ b/GkeMultiCloud/src/V1/AttachedOidcConfig.php @@ -28,7 +28,7 @@ class AttachedOidcConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string issuer_url = 1; */ - private $issuer_url = ''; + protected $issuer_url = ''; /** * Optional. OIDC verification keys in JWKS format (RFC 7517). * It contains a list of OIDC verification keys that can be used to verify @@ -39,7 +39,7 @@ class AttachedOidcConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes jwks = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $jwks = ''; + protected $jwks = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AttachedPlatformVersionInfo.php b/GkeMultiCloud/src/V1/AttachedPlatformVersionInfo.php index bcdbed40704c..a81ade67a335 100644 --- a/GkeMultiCloud/src/V1/AttachedPlatformVersionInfo.php +++ b/GkeMultiCloud/src/V1/AttachedPlatformVersionInfo.php @@ -20,7 +20,7 @@ class AttachedPlatformVersionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 1; */ - private $version = ''; + protected $version = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AttachedProxyConfig.php b/GkeMultiCloud/src/V1/AttachedProxyConfig.php index ef408fbd5989..e08ea3aba3b0 100644 --- a/GkeMultiCloud/src/V1/AttachedProxyConfig.php +++ b/GkeMultiCloud/src/V1/AttachedProxyConfig.php @@ -22,7 +22,7 @@ class AttachedProxyConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.KubernetesSecret kubernetes_secret = 1; */ - private $kubernetes_secret = null; + protected $kubernetes_secret = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AttachedServerConfig.php b/GkeMultiCloud/src/V1/AttachedServerConfig.php index 129c19cbc32f..3257fd12cab9 100644 --- a/GkeMultiCloud/src/V1/AttachedServerConfig.php +++ b/GkeMultiCloud/src/V1/AttachedServerConfig.php @@ -21,7 +21,7 @@ class AttachedServerConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * List of valid platform versions. * diff --git a/GkeMultiCloud/src/V1/AwsAutoscalingGroupMetricsCollection.php b/GkeMultiCloud/src/V1/AwsAutoscalingGroupMetricsCollection.php index f50f8485b50c..dddb1fd5dc97 100644 --- a/GkeMultiCloud/src/V1/AwsAutoscalingGroupMetricsCollection.php +++ b/GkeMultiCloud/src/V1/AwsAutoscalingGroupMetricsCollection.php @@ -22,7 +22,7 @@ class AwsAutoscalingGroupMetricsCollection extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string granularity = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $granularity = ''; + protected $granularity = ''; /** * Optional. The metrics to enable. For a list of valid metrics, see * https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. diff --git a/GkeMultiCloud/src/V1/AwsCluster.php b/GkeMultiCloud/src/V1/AwsCluster.php index b10b048bb3c5..68baa291c95b 100644 --- a/GkeMultiCloud/src/V1/AwsCluster.php +++ b/GkeMultiCloud/src/V1/AwsCluster.php @@ -24,20 +24,20 @@ class AwsCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Optional. A human readable description of this cluster. * Cannot be longer than 255 UTF-8 encoded bytes. * * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Required. Cluster-wide networking configuration. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsClusterNetworking networking = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $networking = null; + protected $networking = null; /** * Required. The AWS region where the cluster runs. * Each Google Cloud region supports a subset of nearby AWS regions. @@ -47,55 +47,55 @@ class AwsCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string aws_region = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $aws_region = ''; + protected $aws_region = ''; /** * Required. Configuration related to the cluster control plane. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsControlPlane control_plane = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $control_plane = null; + protected $control_plane = null; /** * Required. Configuration related to the cluster RBAC settings. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsAuthorization authorization = 15 [(.google.api.field_behavior) = REQUIRED]; */ - private $authorization = null; + protected $authorization = null; /** * Output only. The current state of the cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The endpoint of the cluster's API server. * * Generated from protobuf field string endpoint = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $endpoint = ''; + protected $endpoint = ''; /** * Output only. A globally unique identifier for the cluster. * * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. If set, there are currently changes in flight to the cluster. * * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. The time at which this cluster 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. The time at which this cluster 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; /** * Allows clients to perform consistent read-modify-writes * through optimistic concurrency control. @@ -104,7 +104,7 @@ class AwsCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 13; */ - private $etag = ''; + protected $etag = ''; /** * Optional. Annotations on the cluster. * This field has the same restrictions as Kubernetes annotations. @@ -123,25 +123,25 @@ class AwsCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $workload_identity_config = null; + protected $workload_identity_config = null; /** * Output only. PEM encoded x509 certificate of the cluster root of trust. * * Generated from protobuf field string cluster_ca_certificate = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $cluster_ca_certificate = ''; + protected $cluster_ca_certificate = ''; /** * Required. Fleet configuration. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 18 [(.google.api.field_behavior) = REQUIRED]; */ - private $fleet = null; + protected $fleet = null; /** * Optional. Logging configuration for this cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 19 [(.google.api.field_behavior) = OPTIONAL]; */ - private $logging_config = null; + protected $logging_config = null; /** * Output only. A set of errors found in the cluster. * @@ -153,13 +153,13 @@ class AwsCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 21 [(.google.api.field_behavior) = OPTIONAL]; */ - private $monitoring_config = null; + protected $monitoring_config = null; /** * Optional. Binary Authorization configuration for this cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.BinaryAuthorization binary_authorization = 22 [(.google.api.field_behavior) = OPTIONAL]; */ - private $binary_authorization = null; + protected $binary_authorization = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsClusterError.php b/GkeMultiCloud/src/V1/AwsClusterError.php index 3f755a6ca159..f40a291a78f8 100644 --- a/GkeMultiCloud/src/V1/AwsClusterError.php +++ b/GkeMultiCloud/src/V1/AwsClusterError.php @@ -20,7 +20,7 @@ class AwsClusterError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string message = 1; */ - private $message = ''; + protected $message = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsClusterGroup.php b/GkeMultiCloud/src/V1/AwsClusterGroup.php index ee2d9b711e8a..6c954b94c1b2 100644 --- a/GkeMultiCloud/src/V1/AwsClusterGroup.php +++ b/GkeMultiCloud/src/V1/AwsClusterGroup.php @@ -20,7 +20,7 @@ class AwsClusterGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $group = ''; + protected $group = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsClusterNetworking.php b/GkeMultiCloud/src/V1/AwsClusterNetworking.php index 3c045e3cd7d2..9301c3f5e52d 100644 --- a/GkeMultiCloud/src/V1/AwsClusterNetworking.php +++ b/GkeMultiCloud/src/V1/AwsClusterNetworking.php @@ -24,7 +24,7 @@ class AwsClusterNetworking extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vpc_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $vpc_id = ''; + protected $vpc_id = ''; /** * Required. All pods in the cluster are assigned an IPv4 address from these * ranges. Only a single range is supported. This field cannot be changed @@ -50,7 +50,7 @@ class AwsClusterNetworking extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool per_node_pool_sg_rules_disabled = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $per_node_pool_sg_rules_disabled = false; + protected $per_node_pool_sg_rules_disabled = false; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsClusterUser.php b/GkeMultiCloud/src/V1/AwsClusterUser.php index a4fd88cd4681..005bd094c801 100644 --- a/GkeMultiCloud/src/V1/AwsClusterUser.php +++ b/GkeMultiCloud/src/V1/AwsClusterUser.php @@ -20,7 +20,7 @@ class AwsClusterUser extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $username = ''; + protected $username = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsClustersClient.php b/GkeMultiCloud/src/V1/AwsClustersClient.php deleted file mode 100644 index 0ff18e6c88e6..000000000000 --- a/GkeMultiCloud/src/V1/AwsClustersClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/CreateAwsCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates an [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAwsClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateAwsCluster(\Google\Cloud\GkeMultiCloud\V1\UpdateAwsClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Describes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - * resource. - * @param \Google\Cloud\GkeMultiCloud\V1\GetAwsClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAwsCluster(\Google\Cloud\GkeMultiCloud\V1\GetAwsClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsCluster', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\AwsCluster', 'decode'], - $metadata, $options); - } - - /** - * Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources - * on a given Google Cloud project and region. - * @param \Google\Cloud\GkeMultiCloud\V1\ListAwsClustersRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListAwsClusters(\Google\Cloud\GkeMultiCloud\V1\ListAwsClustersRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsClusters', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\ListAwsClustersResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - * resource. - * - * Fails if the cluster has one or more associated - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAwsClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteAwsCluster(\Google\Cloud\GkeMultiCloud\V1\DeleteAwsClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Generates a short-lived access token to authenticate to a given - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource. - * @param \Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GenerateAwsAccessToken(\Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/GenerateAwsAccessToken', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenResponse', 'decode'], - $metadata, $options); - } - - /** - * Creates a new [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool], - * attached to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\CreateAwsNodePoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateAwsNodePool(\Google\Cloud\GkeMultiCloud\V1\CreateAwsNodePoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/CreateAwsNodePool', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates an [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. - * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAwsNodePoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateAwsNodePool(\Google\Cloud\GkeMultiCloud\V1\UpdateAwsNodePoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsNodePool', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Describes a specific - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource. - * @param \Google\Cloud\GkeMultiCloud\V1\GetAwsNodePoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAwsNodePool(\Google\Cloud\GkeMultiCloud\V1\GetAwsNodePoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsNodePool', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\AwsNodePool', 'decode'], - $metadata, $options); - } - - /** - * Lists all [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] - * resources on a given - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - * @param \Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListAwsNodePools(\Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsNodePools', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] - * resource. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAwsNodePoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteAwsNodePool(\Google\Cloud\GkeMultiCloud\V1\DeleteAwsNodePoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsNodePool', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Returns information, such as supported AWS regions and Kubernetes - * versions, on a given Google Cloud location. - * @param \Google\Cloud\GkeMultiCloud\V1\GetAwsServerConfigRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAwsServerConfig(\Google\Cloud\GkeMultiCloud\V1\GetAwsServerConfigRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsServerConfig', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\AwsServerConfig', 'decode'], - $metadata, $options); - } - -} diff --git a/GkeMultiCloud/src/V1/AwsConfigEncryption.php b/GkeMultiCloud/src/V1/AwsConfigEncryption.php index 8dd775c43be8..ed4be8aef12a 100644 --- a/GkeMultiCloud/src/V1/AwsConfigEncryption.php +++ b/GkeMultiCloud/src/V1/AwsConfigEncryption.php @@ -20,7 +20,7 @@ class AwsConfigEncryption extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string kms_key_arn = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $kms_key_arn = ''; + protected $kms_key_arn = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsControlPlane.php b/GkeMultiCloud/src/V1/AwsControlPlane.php index 64f3fbf2be12..826ee8af1a67 100644 --- a/GkeMultiCloud/src/V1/AwsControlPlane.php +++ b/GkeMultiCloud/src/V1/AwsControlPlane.php @@ -24,21 +24,21 @@ class AwsControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $version = ''; + protected $version = ''; /** * Optional. The AWS instance type. * When unspecified, it uses a default based on the cluster's version. * * Generated from protobuf field string instance_type = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $instance_type = ''; + protected $instance_type = ''; /** * Optional. SSH configuration for how to access the underlying control plane * machines. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsSshConfig ssh_config = 14 [(.google.api.field_behavior) = OPTIONAL]; */ - private $ssh_config = null; + protected $ssh_config = null; /** * Required. The list of subnets where control plane replicas will run. * A replica will be provisioned on each subnet and up to three values @@ -62,7 +62,7 @@ class AwsControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string iam_instance_profile = 7 [(.google.api.field_behavior) = REQUIRED]; */ - private $iam_instance_profile = ''; + protected $iam_instance_profile = ''; /** * Optional. Configuration related to the root volume provisioned for each * control plane replica. @@ -72,7 +72,7 @@ class AwsControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate root_volume = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $root_volume = null; + protected $root_volume = null; /** * Optional. Configuration related to the main volume provisioned for each * control plane replica. @@ -83,13 +83,13 @@ class AwsControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate main_volume = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $main_volume = null; + protected $main_volume = null; /** * Required. The ARN of the AWS KMS key used to encrypt cluster secrets. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsDatabaseEncryption database_encryption = 10 [(.google.api.field_behavior) = REQUIRED]; */ - private $database_encryption = null; + protected $database_encryption = null; /** * Optional. A set of AWS resource tags to propagate to all underlying managed * AWS resources. @@ -105,26 +105,26 @@ class AwsControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsServicesAuthentication aws_services_authentication = 12 [(.google.api.field_behavior) = REQUIRED]; */ - private $aws_services_authentication = null; + protected $aws_services_authentication = null; /** * Optional. Proxy configuration for outbound HTTP(S) traffic. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsProxyConfig proxy_config = 16 [(.google.api.field_behavior) = OPTIONAL]; */ - private $proxy_config = null; + protected $proxy_config = null; /** * Required. Config encryption for user data. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsConfigEncryption config_encryption = 17 [(.google.api.field_behavior) = REQUIRED]; */ - private $config_encryption = null; + protected $config_encryption = null; /** * Optional. The placement to use on control plane instances. * When unspecified, the VPC's default tenancy will be used. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement instance_placement = 18 [(.google.api.field_behavior) = OPTIONAL]; */ - private $instance_placement = null; + protected $instance_placement = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsDatabaseEncryption.php b/GkeMultiCloud/src/V1/AwsDatabaseEncryption.php index 829c9058c2a6..e7e0ce60bd12 100644 --- a/GkeMultiCloud/src/V1/AwsDatabaseEncryption.php +++ b/GkeMultiCloud/src/V1/AwsDatabaseEncryption.php @@ -20,7 +20,7 @@ class AwsDatabaseEncryption extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string kms_key_arn = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $kms_key_arn = ''; + protected $kms_key_arn = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsInstancePlacement.php b/GkeMultiCloud/src/V1/AwsInstancePlacement.php index d66cb9fa2803..e2eccd85ae67 100644 --- a/GkeMultiCloud/src/V1/AwsInstancePlacement.php +++ b/GkeMultiCloud/src/V1/AwsInstancePlacement.php @@ -23,7 +23,7 @@ class AwsInstancePlacement extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement.Tenancy tenancy = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $tenancy = 0; + protected $tenancy = 0; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsK8sVersionInfo.php b/GkeMultiCloud/src/V1/AwsK8sVersionInfo.php index 981eb3e2dde0..9e560d4e09ec 100644 --- a/GkeMultiCloud/src/V1/AwsK8sVersionInfo.php +++ b/GkeMultiCloud/src/V1/AwsK8sVersionInfo.php @@ -20,7 +20,7 @@ class AwsK8sVersionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 1; */ - private $version = ''; + protected $version = ''; /** * Optional. True if the version is available for cluster creation. If a * version is enabled for creation, it can be used to create new clusters. @@ -29,7 +29,7 @@ class AwsK8sVersionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enabled = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $enabled = false; + protected $enabled = false; /** * Optional. True if this cluster version belongs to a minor version that has * reached its end of life and is no longer in scope to receive security and @@ -37,7 +37,7 @@ class AwsK8sVersionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool end_of_life = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $end_of_life = false; + protected $end_of_life = false; /** * Optional. The estimated date (in Pacific Time) when this cluster version * will reach its end of life. Or if this version is no longer supported (the @@ -46,13 +46,13 @@ class AwsK8sVersionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.type.Date end_of_life_date = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $end_of_life_date = null; + protected $end_of_life_date = null; /** * Optional. The date (in Pacific Time) when the cluster version was released. * * Generated from protobuf field .google.type.Date release_date = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $release_date = null; + protected $release_date = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsNodeConfig.php b/GkeMultiCloud/src/V1/AwsNodeConfig.php index a27af8a5a10e..9b48cad7dd0b 100644 --- a/GkeMultiCloud/src/V1/AwsNodeConfig.php +++ b/GkeMultiCloud/src/V1/AwsNodeConfig.php @@ -22,7 +22,7 @@ class AwsNodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_type = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $instance_type = ''; + protected $instance_type = ''; /** * Optional. Template for the root volume provisioned for node pool nodes. * Volumes will be provisioned in the availability zone assigned @@ -31,7 +31,7 @@ class AwsNodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate root_volume = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $root_volume = null; + protected $root_volume = null; /** * Optional. The initial taints assigned to nodes of this node pool. * @@ -61,7 +61,7 @@ class AwsNodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string iam_instance_profile = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $iam_instance_profile = ''; + protected $iam_instance_profile = ''; /** * Optional. The OS image type to use on node pool instances. * Can be unspecified, or have a value of `ubuntu`. @@ -69,13 +69,13 @@ class AwsNodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string image_type = 11 [(.google.api.field_behavior) = OPTIONAL]; */ - private $image_type = ''; + protected $image_type = ''; /** * Optional. The SSH configuration. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsSshConfig ssh_config = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $ssh_config = null; + protected $ssh_config = null; /** * Optional. The IDs of additional security groups to add to nodes in this * pool. The manager will automatically create security groups with minimum @@ -89,20 +89,20 @@ class AwsNodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsProxyConfig proxy_config = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $proxy_config = null; + protected $proxy_config = null; /** * Required. Config encryption for user data. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsConfigEncryption config_encryption = 13 [(.google.api.field_behavior) = REQUIRED]; */ - private $config_encryption = null; + protected $config_encryption = null; /** * Optional. Placement related info for this node. * When unspecified, the VPC's default tenancy will be used. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsInstancePlacement instance_placement = 14 [(.google.api.field_behavior) = OPTIONAL]; */ - private $instance_placement = null; + protected $instance_placement = null; /** * Optional. Configuration related to CloudWatch metrics collection on the * Auto Scaling group of the node pool. @@ -110,7 +110,7 @@ class AwsNodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsAutoscalingGroupMetricsCollection autoscaling_metrics_collection = 15 [(.google.api.field_behavior) = OPTIONAL]; */ - private $autoscaling_metrics_collection = null; + protected $autoscaling_metrics_collection = null; /** * Optional. Configuration for provisioning EC2 Spot instances * When specified, the node pool will provision Spot instances from the set @@ -119,7 +119,7 @@ class AwsNodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.SpotConfig spot_config = 16 [(.google.api.field_behavior) = OPTIONAL]; */ - private $spot_config = null; + protected $spot_config = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsNodeManagement.php b/GkeMultiCloud/src/V1/AwsNodeManagement.php index 5e992e472f36..881f7bcf2ef8 100644 --- a/GkeMultiCloud/src/V1/AwsNodeManagement.php +++ b/GkeMultiCloud/src/V1/AwsNodeManagement.php @@ -24,7 +24,7 @@ class AwsNodeManagement extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool auto_repair = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $auto_repair = false; + protected $auto_repair = false; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsNodePool.php b/GkeMultiCloud/src/V1/AwsNodePool.php index 42bd9d380334..e7187eca223d 100644 --- a/GkeMultiCloud/src/V1/AwsNodePool.php +++ b/GkeMultiCloud/src/V1/AwsNodePool.php @@ -24,7 +24,7 @@ class AwsNodePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Required. The Kubernetes version to run on this node pool (e.g. * `1.19.10-gke.1000`). @@ -34,56 +34,56 @@ class AwsNodePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $version = ''; + protected $version = ''; /** * Required. The configuration of the node pool. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodeConfig config = 28 [(.google.api.field_behavior) = REQUIRED]; */ - private $config = null; + protected $config = null; /** * Required. Autoscaler configuration for this node pool. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePoolAutoscaling autoscaling = 25 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaling = null; + protected $autoscaling = null; /** * Required. The subnet where the node pool node run. * * Generated from protobuf field string subnet_id = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnet_id = ''; + protected $subnet_id = ''; /** * Output only. The lifecycle state of the node pool. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool.State state = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. A globally unique identifier for the node pool. * * Generated from protobuf field string uid = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. If set, there are currently changes in flight to the node * pool. * * Generated from protobuf field bool reconciling = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. The time at which this node pool was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The time at which this node pool was last updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Allows clients to perform consistent read-modify-writes * through optimistic concurrency control. @@ -92,7 +92,7 @@ class AwsNodePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 21; */ - private $etag = ''; + protected $etag = ''; /** * Optional. Annotations on the node pool. * This field has the same restrictions as Kubernetes annotations. @@ -112,7 +112,7 @@ class AwsNodePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.MaxPodsConstraint max_pods_constraint = 27 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_pods_constraint = null; + protected $max_pods_constraint = null; /** * Output only. A set of errors found in the node pool. * @@ -124,13 +124,13 @@ class AwsNodePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodeManagement management = 30 [(.google.api.field_behavior) = OPTIONAL]; */ - private $management = null; + protected $management = null; /** * Optional. Update settings control the speed and disruption of the update. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.UpdateSettings update_settings = 32 [(.google.api.field_behavior) = OPTIONAL]; */ - private $update_settings = null; + protected $update_settings = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsNodePoolAutoscaling.php b/GkeMultiCloud/src/V1/AwsNodePoolAutoscaling.php index ecb27ce21a77..fa2cda6ccf53 100644 --- a/GkeMultiCloud/src/V1/AwsNodePoolAutoscaling.php +++ b/GkeMultiCloud/src/V1/AwsNodePoolAutoscaling.php @@ -22,14 +22,14 @@ class AwsNodePoolAutoscaling 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. Maximum number of nodes in the node pool. Must be greater than or * equal to min_node_count and less than or equal to 50. * * Generated from protobuf field int32 max_node_count = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_node_count = 0; + protected $max_node_count = 0; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsNodePoolError.php b/GkeMultiCloud/src/V1/AwsNodePoolError.php index 9c30d9a13051..c5a04b7d3934 100644 --- a/GkeMultiCloud/src/V1/AwsNodePoolError.php +++ b/GkeMultiCloud/src/V1/AwsNodePoolError.php @@ -20,7 +20,7 @@ class AwsNodePoolError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string message = 1; */ - private $message = ''; + protected $message = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsOpenIdConfig.php b/GkeMultiCloud/src/V1/AwsOpenIdConfig.php index 2e8fbbf6701b..01857611cf0f 100644 --- a/GkeMultiCloud/src/V1/AwsOpenIdConfig.php +++ b/GkeMultiCloud/src/V1/AwsOpenIdConfig.php @@ -21,13 +21,13 @@ class AwsOpenIdConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string issuer = 1; */ - private $issuer = ''; + protected $issuer = ''; /** * JSON Web Key uri. * * Generated from protobuf field string jwks_uri = 2; */ - private $jwks_uri = ''; + protected $jwks_uri = ''; /** * Supported response types. * diff --git a/GkeMultiCloud/src/V1/AwsProxyConfig.php b/GkeMultiCloud/src/V1/AwsProxyConfig.php index 0d5ac3f2fd57..2e5856c7b329 100644 --- a/GkeMultiCloud/src/V1/AwsProxyConfig.php +++ b/GkeMultiCloud/src/V1/AwsProxyConfig.php @@ -24,14 +24,14 @@ class AwsProxyConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string secret_arn = 1; */ - private $secret_arn = ''; + protected $secret_arn = ''; /** * The version string of the AWS Secret Manager secret that contains the * HTTP(S) proxy configuration. * * Generated from protobuf field string secret_version = 2; */ - private $secret_version = ''; + protected $secret_version = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsServerConfig.php b/GkeMultiCloud/src/V1/AwsServerConfig.php index 5ddbe9ab94f7..04d329be8dfa 100644 --- a/GkeMultiCloud/src/V1/AwsServerConfig.php +++ b/GkeMultiCloud/src/V1/AwsServerConfig.php @@ -20,7 +20,7 @@ class AwsServerConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * List of all released Kubernetes versions, including ones which are end of * life and can no longer be used. Filter by the `enabled` diff --git a/GkeMultiCloud/src/V1/AwsServicesAuthentication.php b/GkeMultiCloud/src/V1/AwsServicesAuthentication.php index b93a3f19431e..cef249ad091f 100644 --- a/GkeMultiCloud/src/V1/AwsServicesAuthentication.php +++ b/GkeMultiCloud/src/V1/AwsServicesAuthentication.php @@ -21,14 +21,14 @@ class AwsServicesAuthentication extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string role_arn = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $role_arn = ''; + protected $role_arn = ''; /** * Optional. An identifier for the assumed role session. * When unspecified, it defaults to `multicloud-service-agent`. * * Generated from protobuf field string role_session_name = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $role_session_name = ''; + protected $role_session_name = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsSshConfig.php b/GkeMultiCloud/src/V1/AwsSshConfig.php index 46e0f0d0a1dd..a3e356328b16 100644 --- a/GkeMultiCloud/src/V1/AwsSshConfig.php +++ b/GkeMultiCloud/src/V1/AwsSshConfig.php @@ -20,7 +20,7 @@ class AwsSshConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string ec2_key_pair = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $ec2_key_pair = ''; + protected $ec2_key_pair = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AwsVolumeTemplate.php b/GkeMultiCloud/src/V1/AwsVolumeTemplate.php index 05d320c7ce03..4a6ca5810edc 100644 --- a/GkeMultiCloud/src/V1/AwsVolumeTemplate.php +++ b/GkeMultiCloud/src/V1/AwsVolumeTemplate.php @@ -22,21 +22,21 @@ class AwsVolumeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 size_gib = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $size_gib = 0; + protected $size_gib = 0; /** * Optional. Type of the EBS volume. * When unspecified, it defaults to GP2 volume. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsVolumeTemplate.VolumeType volume_type = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $volume_type = 0; + protected $volume_type = 0; /** * Optional. The number of I/O operations per second (IOPS) to provision for * GP3 volume. * * Generated from protobuf field int32 iops = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $iops = 0; + protected $iops = 0; /** * Optional. The throughput that the volume supports, in MiB/s. Only valid if * volume_type is GP3. @@ -44,7 +44,7 @@ class AwsVolumeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 throughput = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $throughput = 0; + protected $throughput = 0; /** * Optional. The Amazon Resource Name (ARN) of the Customer Managed Key (CMK) * used to encrypt AWS EBS volumes. @@ -53,7 +53,7 @@ class AwsVolumeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string kms_key_arn = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $kms_key_arn = ''; + protected $kms_key_arn = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureClient.php b/GkeMultiCloud/src/V1/AzureClient.php index d2c80ab4bce7..002830ccfddd 100644 --- a/GkeMultiCloud/src/V1/AzureClient.php +++ b/GkeMultiCloud/src/V1/AzureClient.php @@ -32,25 +32,25 @@ class AzureClient extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Required. The Azure Active Directory Tenant ID. * * Generated from protobuf field string tenant_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $tenant_id = ''; + protected $tenant_id = ''; /** * Required. The Azure Active Directory Application ID. * * Generated from protobuf field string application_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $application_id = ''; + protected $application_id = ''; /** * Output only. If set, there are currently pending changes to the client. * * Generated from protobuf field bool reconciling = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Optional. Annotations on the resource. * This field has the same restrictions as Kubernetes annotations. @@ -69,25 +69,25 @@ class AzureClient extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string pem_certificate = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $pem_certificate = ''; + protected $pem_certificate = ''; /** * Output only. A globally unique identifier for the client. * * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. The time at which this resource 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. The time at which this client was last 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; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureCluster.php b/GkeMultiCloud/src/V1/AzureCluster.php index e47b476dd19e..fb3117ed00b6 100644 --- a/GkeMultiCloud/src/V1/AzureCluster.php +++ b/GkeMultiCloud/src/V1/AzureCluster.php @@ -24,14 +24,14 @@ class AzureCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Optional. A human readable description of this cluster. * Cannot be longer than 255 UTF-8 encoded bytes. * * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Required. The Azure region where the cluster runs. * Each Google Cloud region supports a subset of nearby Azure regions. @@ -41,7 +41,7 @@ class AzureCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string azure_region = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_region = ''; + protected $azure_region = ''; /** * Required. The ARM ID of the resource group where the cluster resources are * deployed. For example: @@ -49,7 +49,7 @@ class AzureCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string resource_group_id = 17 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource_group_id = ''; + protected $resource_group_id = ''; /** * Optional. Name of the * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] that contains @@ -65,68 +65,68 @@ class AzureCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string azure_client = 16 [(.google.api.field_behavior) = OPTIONAL]; */ - private $azure_client = ''; + protected $azure_client = ''; /** * Required. Cluster-wide networking configuration. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClusterNetworking networking = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $networking = null; + protected $networking = null; /** * Required. Configuration related to the cluster control plane. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureControlPlane control_plane = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $control_plane = null; + protected $control_plane = null; /** * Required. Configuration related to the cluster RBAC settings. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureAuthorization authorization = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $authorization = null; + protected $authorization = null; /** * Optional. Authentication configuration for management of Azure resources. * Either azure_client or azure_services_authentication should be provided. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureServicesAuthentication azure_services_authentication = 22 [(.google.api.field_behavior) = OPTIONAL]; */ - private $azure_services_authentication = null; + protected $azure_services_authentication = null; /** * Output only. The current state of the cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The endpoint of the cluster's API server. * * Generated from protobuf field string endpoint = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $endpoint = ''; + protected $endpoint = ''; /** * Output only. A globally unique identifier for the cluster. * * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. If set, there are currently changes in flight to the cluster. * * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. The time at which this cluster 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. The time at which this cluster 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; /** * Allows clients to perform consistent read-modify-writes * through optimistic concurrency control. @@ -135,7 +135,7 @@ class AzureCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 13; */ - private $etag = ''; + protected $etag = ''; /** * Optional. Annotations on the cluster. * This field has the same restrictions as Kubernetes annotations. @@ -154,31 +154,31 @@ class AzureCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.WorkloadIdentityConfig workload_identity_config = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $workload_identity_config = null; + protected $workload_identity_config = null; /** * Output only. PEM encoded x509 certificate of the cluster root of trust. * * Generated from protobuf field string cluster_ca_certificate = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $cluster_ca_certificate = ''; + protected $cluster_ca_certificate = ''; /** * Required. Fleet configuration. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.Fleet fleet = 20 [(.google.api.field_behavior) = REQUIRED]; */ - private $fleet = null; + protected $fleet = null; /** * Output only. Managed Azure resources for this cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClusterResources managed_resources = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $managed_resources = null; + protected $managed_resources = null; /** * Optional. Logging configuration for this cluster. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingConfig logging_config = 23 [(.google.api.field_behavior) = OPTIONAL]; */ - private $logging_config = null; + protected $logging_config = null; /** * Output only. A set of errors found in the cluster. * @@ -190,7 +190,7 @@ class AzureCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.MonitoringConfig monitoring_config = 25 [(.google.api.field_behavior) = OPTIONAL]; */ - private $monitoring_config = null; + protected $monitoring_config = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureClusterError.php b/GkeMultiCloud/src/V1/AzureClusterError.php index 87a4e11c7cb3..cf9a9b6b2e5d 100644 --- a/GkeMultiCloud/src/V1/AzureClusterError.php +++ b/GkeMultiCloud/src/V1/AzureClusterError.php @@ -20,7 +20,7 @@ class AzureClusterError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string message = 1; */ - private $message = ''; + protected $message = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureClusterGroup.php b/GkeMultiCloud/src/V1/AzureClusterGroup.php index 7540571ac9b4..dee74b296f31 100644 --- a/GkeMultiCloud/src/V1/AzureClusterGroup.php +++ b/GkeMultiCloud/src/V1/AzureClusterGroup.php @@ -20,7 +20,7 @@ class AzureClusterGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $group = ''; + protected $group = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureClusterNetworking.php b/GkeMultiCloud/src/V1/AzureClusterNetworking.php index f083c4513f0b..c4425dee6e7c 100644 --- a/GkeMultiCloud/src/V1/AzureClusterNetworking.php +++ b/GkeMultiCloud/src/V1/AzureClusterNetworking.php @@ -26,7 +26,7 @@ class AzureClusterNetworking extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string virtual_network_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $virtual_network_id = ''; + protected $virtual_network_id = ''; /** * Required. The IP address range of the pods in this cluster, in CIDR * notation (e.g. `10.96.0.0/14`). @@ -56,7 +56,7 @@ class AzureClusterNetworking extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_load_balancer_subnet_id = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $service_load_balancer_subnet_id = ''; + protected $service_load_balancer_subnet_id = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureClusterResources.php b/GkeMultiCloud/src/V1/AzureClusterResources.php index ba76854c77dc..ca301cadedac 100644 --- a/GkeMultiCloud/src/V1/AzureClusterResources.php +++ b/GkeMultiCloud/src/V1/AzureClusterResources.php @@ -21,13 +21,13 @@ class AzureClusterResources extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_security_group_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $network_security_group_id = ''; + protected $network_security_group_id = ''; /** * Output only. The ARM ID of the control plane application security group. * * Generated from protobuf field string control_plane_application_security_group_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $control_plane_application_security_group_id = ''; + protected $control_plane_application_security_group_id = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureClusterUser.php b/GkeMultiCloud/src/V1/AzureClusterUser.php index 85d73ccc5285..3aecd59fbf61 100644 --- a/GkeMultiCloud/src/V1/AzureClusterUser.php +++ b/GkeMultiCloud/src/V1/AzureClusterUser.php @@ -20,7 +20,7 @@ class AzureClusterUser extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $username = ''; + protected $username = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureClustersClient.php b/GkeMultiCloud/src/V1/AzureClustersClient.php deleted file mode 100644 index 7b8283300a24..000000000000 --- a/GkeMultiCloud/src/V1/AzureClustersClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/CreateAzureClient', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Describes a specific - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource. - * @param \Google\Cloud\GkeMultiCloud\V1\GetAzureClientRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAzureClient(\Google\Cloud\GkeMultiCloud\V1\GetAzureClientRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureClient', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\AzureClient', 'decode'], - $metadata, $options); - } - - /** - * Lists all [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] - * resources on a given Google Cloud project and region. - * @param \Google\Cloud\GkeMultiCloud\V1\ListAzureClientsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListAzureClients(\Google\Cloud\GkeMultiCloud\V1\ListAzureClientsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClients', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\ListAzureClientsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] - * resource. - * - * If the client is used by one or more clusters, deletion will - * fail and a `FAILED_PRECONDITION` error will be returned. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAzureClientRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteAzureClient(\Google\Cloud\GkeMultiCloud\V1\DeleteAzureClientRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureClient', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a new [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - * resource on a given Google Cloud Platform project and region. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\CreateAzureClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateAzureCluster(\Google\Cloud\GkeMultiCloud\V1\CreateAzureClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/CreateAzureCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAzureClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateAzureCluster(\Google\Cloud\GkeMultiCloud\V1\UpdateAzureClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Describes a specific - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. - * @param \Google\Cloud\GkeMultiCloud\V1\GetAzureClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAzureCluster(\Google\Cloud\GkeMultiCloud\V1\GetAzureClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureCluster', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\AzureCluster', 'decode'], - $metadata, $options); - } - - /** - * Lists all [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - * resources on a given Google Cloud project and region. - * @param \Google\Cloud\GkeMultiCloud\V1\ListAzureClustersRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListAzureClusters(\Google\Cloud\GkeMultiCloud\V1\ListAzureClustersRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClusters', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\ListAzureClustersResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a specific - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. - * - * Fails if the cluster has one or more associated - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAzureClusterRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteAzureCluster(\Google\Cloud\GkeMultiCloud\V1\DeleteAzureClusterRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureCluster', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Generates a short-lived access token to authenticate to a given - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. - * @param \Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GenerateAzureAccessToken(\Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GenerateAzureAccessToken', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenResponse', 'decode'], - $metadata, $options); - } - - /** - * Creates a new [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool], - * attached to a given - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\CreateAzureNodePoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateAzureNodePool(\Google\Cloud\GkeMultiCloud\V1\CreateAzureNodePoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/CreateAzureNodePool', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates an [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. - * @param \Google\Cloud\GkeMultiCloud\V1\UpdateAzureNodePoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateAzureNodePool(\Google\Cloud\GkeMultiCloud\V1\UpdateAzureNodePoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureNodePool', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Describes a specific - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. - * @param \Google\Cloud\GkeMultiCloud\V1\GetAzureNodePoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAzureNodePool(\Google\Cloud\GkeMultiCloud\V1\GetAzureNodePoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureNodePool', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\AzureNodePool', 'decode'], - $metadata, $options); - } - - /** - * Lists all [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] - * resources on a given - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - * @param \Google\Cloud\GkeMultiCloud\V1\ListAzureNodePoolsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListAzureNodePools(\Google\Cloud\GkeMultiCloud\V1\ListAzureNodePoolsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureNodePools', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\ListAzureNodePoolsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a specific - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * @param \Google\Cloud\GkeMultiCloud\V1\DeleteAzureNodePoolRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteAzureNodePool(\Google\Cloud\GkeMultiCloud\V1\DeleteAzureNodePoolRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureNodePool', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Returns information, such as supported Azure regions and Kubernetes - * versions, on a given Google Cloud location. - * @param \Google\Cloud\GkeMultiCloud\V1\GetAzureServerConfigRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAzureServerConfig(\Google\Cloud\GkeMultiCloud\V1\GetAzureServerConfigRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureServerConfig', - $argument, - ['\Google\Cloud\GkeMultiCloud\V1\AzureServerConfig', 'decode'], - $metadata, $options); - } - -} diff --git a/GkeMultiCloud/src/V1/AzureConfigEncryption.php b/GkeMultiCloud/src/V1/AzureConfigEncryption.php index c9c99c3518ae..f90fcdd501a4 100644 --- a/GkeMultiCloud/src/V1/AzureConfigEncryption.php +++ b/GkeMultiCloud/src/V1/AzureConfigEncryption.php @@ -25,7 +25,7 @@ class AzureConfigEncryption extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $key_id = ''; + protected $key_id = ''; /** * Optional. RSA key of the Azure Key Vault public key to use for encrypting * the data. @@ -35,7 +35,7 @@ class AzureConfigEncryption extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string public_key = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $public_key = ''; + protected $public_key = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureControlPlane.php b/GkeMultiCloud/src/V1/AzureControlPlane.php index 0e4b51b12846..92f3fed0095f 100644 --- a/GkeMultiCloud/src/V1/AzureControlPlane.php +++ b/GkeMultiCloud/src/V1/AzureControlPlane.php @@ -24,7 +24,7 @@ class AzureControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $version = ''; + protected $version = ''; /** * Optional. The ARM ID of the default subnet for the control plane. The * control plane VMs are deployed in this subnet, unless @@ -38,7 +38,7 @@ class AzureControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string subnet_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $subnet_id = ''; + protected $subnet_id = ''; /** * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. * For available VM sizes, see @@ -47,14 +47,14 @@ class AzureControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vm_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $vm_size = ''; + protected $vm_size = ''; /** * Required. SSH configuration for how to access the underlying control plane * machines. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureSshConfig ssh_config = 11 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssh_config = null; + protected $ssh_config = null; /** * Optional. Configuration related to the root volume provisioned for each * control plane replica. @@ -62,7 +62,7 @@ class AzureControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate root_volume = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $root_volume = null; + protected $root_volume = null; /** * Optional. Configuration related to the main volume provisioned for each * control plane replica. @@ -71,25 +71,25 @@ class AzureControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate main_volume = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $main_volume = null; + protected $main_volume = null; /** * Optional. Configuration related to application-layer secrets encryption. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDatabaseEncryption database_encryption = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $database_encryption = null; + protected $database_encryption = null; /** * Optional. Proxy configuration for outbound HTTP(S) traffic. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureProxyConfig proxy_config = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $proxy_config = null; + protected $proxy_config = null; /** * Optional. Configuration related to vm config encryption. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureConfigEncryption config_encryption = 14 [(.google.api.field_behavior) = OPTIONAL]; */ - private $config_encryption = null; + protected $config_encryption = null; /** * Optional. A set of tags to apply to all underlying control plane Azure * resources. @@ -114,7 +114,7 @@ class AzureControlPlane extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string endpoint_subnet_id = 15 [(.google.api.field_behavior) = OPTIONAL]; */ - private $endpoint_subnet_id = ''; + protected $endpoint_subnet_id = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureDatabaseEncryption.php b/GkeMultiCloud/src/V1/AzureDatabaseEncryption.php index 51819c04c1c4..21c7b8009267 100644 --- a/GkeMultiCloud/src/V1/AzureDatabaseEncryption.php +++ b/GkeMultiCloud/src/V1/AzureDatabaseEncryption.php @@ -26,7 +26,7 @@ class AzureDatabaseEncryption extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $key_id = ''; + protected $key_id = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureDiskTemplate.php b/GkeMultiCloud/src/V1/AzureDiskTemplate.php index c5011c118a12..f3c1a39446b7 100644 --- a/GkeMultiCloud/src/V1/AzureDiskTemplate.php +++ b/GkeMultiCloud/src/V1/AzureDiskTemplate.php @@ -22,7 +22,7 @@ class AzureDiskTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 size_gib = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $size_gib = 0; + protected $size_gib = 0; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureK8sVersionInfo.php b/GkeMultiCloud/src/V1/AzureK8sVersionInfo.php index 121e118c6af5..c454dce8f80f 100644 --- a/GkeMultiCloud/src/V1/AzureK8sVersionInfo.php +++ b/GkeMultiCloud/src/V1/AzureK8sVersionInfo.php @@ -20,7 +20,7 @@ class AzureK8sVersionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 1; */ - private $version = ''; + protected $version = ''; /** * Optional. True if the version is available for cluster creation. If a * version is enabled for creation, it can be used to create new clusters. @@ -29,7 +29,7 @@ class AzureK8sVersionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enabled = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $enabled = false; + protected $enabled = false; /** * Optional. True if this cluster version belongs to a minor version that has * reached its end of life and is no longer in scope to receive security and @@ -37,7 +37,7 @@ class AzureK8sVersionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool end_of_life = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $end_of_life = false; + protected $end_of_life = false; /** * Optional. The estimated date (in Pacific Time) when this cluster version * will reach its end of life. Or if this version is no longer supported (the @@ -46,13 +46,13 @@ class AzureK8sVersionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.type.Date end_of_life_date = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $end_of_life_date = null; + protected $end_of_life_date = null; /** * Optional. The date (in Pacific Time) when the cluster version was released. * * Generated from protobuf field .google.type.Date release_date = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $release_date = null; + protected $release_date = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureNodeConfig.php b/GkeMultiCloud/src/V1/AzureNodeConfig.php index c5d819166217..8167a17060ad 100644 --- a/GkeMultiCloud/src/V1/AzureNodeConfig.php +++ b/GkeMultiCloud/src/V1/AzureNodeConfig.php @@ -19,12 +19,12 @@ class AzureNodeConfig extends \Google\Protobuf\Internal\Message /** * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. * See [Supported VM - * sizes](https://cloud.google.com/anthos/clusters/docs/azure/reference/supported-vms) for options. + * sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. * When unspecified, it defaults to `Standard_DS2_v2`. * * Generated from protobuf field string vm_size = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $vm_size = ''; + protected $vm_size = ''; /** * Optional. Configuration related to the root volume provisioned for each * node pool machine. @@ -32,7 +32,7 @@ class AzureNodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureDiskTemplate root_volume = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $root_volume = null; + protected $root_volume = null; /** * Optional. A set of tags to apply to all underlying Azure resources for this * node pool. This currently only includes Virtual Machine Scale Sets. @@ -50,25 +50,25 @@ class AzureNodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string image_type = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $image_type = ''; + protected $image_type = ''; /** * Required. SSH configuration for how to access the node pool machines. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureSshConfig ssh_config = 7 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssh_config = null; + protected $ssh_config = null; /** * Optional. Proxy configuration for outbound HTTP(S) traffic. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureProxyConfig proxy_config = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $proxy_config = null; + protected $proxy_config = null; /** * Optional. Configuration related to vm config encryption. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureConfigEncryption config_encryption = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $config_encryption = null; + protected $config_encryption = null; /** * Optional. The initial taints assigned to nodes of this node pool. * @@ -93,7 +93,7 @@ class AzureNodeConfig extends \Google\Protobuf\Internal\Message * @type string $vm_size * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. * See [Supported VM - * sizes](https://cloud.google.com/anthos/clusters/docs/azure/reference/supported-vms) for options. + * sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. * When unspecified, it defaults to `Standard_DS2_v2`. * @type \Google\Cloud\GkeMultiCloud\V1\AzureDiskTemplate $root_volume * Optional. Configuration related to the root volume provisioned for each @@ -131,7 +131,7 @@ public function __construct($data = NULL) { /** * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. * See [Supported VM - * sizes](https://cloud.google.com/anthos/clusters/docs/azure/reference/supported-vms) for options. + * sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. * When unspecified, it defaults to `Standard_DS2_v2`. * * Generated from protobuf field string vm_size = 1 [(.google.api.field_behavior) = OPTIONAL]; @@ -145,7 +145,7 @@ public function getVmSize() /** * Optional. The Azure VM size name. Example: `Standard_DS2_v2`. * See [Supported VM - * sizes](https://cloud.google.com/anthos/clusters/docs/azure/reference/supported-vms) for options. + * sizes](/anthos/clusters/docs/azure/reference/supported-vms) for options. * When unspecified, it defaults to `Standard_DS2_v2`. * * Generated from protobuf field string vm_size = 1 [(.google.api.field_behavior) = OPTIONAL]; diff --git a/GkeMultiCloud/src/V1/AzureNodeManagement.php b/GkeMultiCloud/src/V1/AzureNodeManagement.php index 212df6fc3a09..fafb582d67b4 100644 --- a/GkeMultiCloud/src/V1/AzureNodeManagement.php +++ b/GkeMultiCloud/src/V1/AzureNodeManagement.php @@ -24,7 +24,7 @@ class AzureNodeManagement extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool auto_repair = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $auto_repair = false; + protected $auto_repair = false; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureNodePool.php b/GkeMultiCloud/src/V1/AzureNodePool.php index 6cc7edbd6f8a..d2fd28ceca6e 100644 --- a/GkeMultiCloud/src/V1/AzureNodePool.php +++ b/GkeMultiCloud/src/V1/AzureNodePool.php @@ -24,64 +24,64 @@ class AzureNodePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Required. The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this * node pool. * * Generated from protobuf field string version = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $version = ''; + protected $version = ''; /** * Required. The node configuration of the node pool. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodeConfig config = 22 [(.google.api.field_behavior) = REQUIRED]; */ - private $config = null; + protected $config = null; /** * Required. The ARM ID of the subnet where the node pool VMs run. Make sure * it's a subnet under the virtual network in the cluster configuration. * * Generated from protobuf field string subnet_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnet_id = ''; + protected $subnet_id = ''; /** * Required. Autoscaler configuration for this node pool. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePoolAutoscaling autoscaling = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaling = null; + protected $autoscaling = null; /** * Output only. The current state of the node pool. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. A globally unique identifier for the node pool. * * Generated from protobuf field string uid = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. If set, there are currently pending changes to the node * pool. * * Generated from protobuf field bool reconciling = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. The time at which this node pool 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. The time at which this node pool 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; /** * Allows clients to perform consistent read-modify-writes * through optimistic concurrency control. @@ -90,7 +90,7 @@ class AzureNodePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 12; */ - private $etag = ''; + protected $etag = ''; /** * Optional. Annotations on the node pool. * This field has the same restrictions as Kubernetes annotations. @@ -110,14 +110,14 @@ class AzureNodePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.MaxPodsConstraint max_pods_constraint = 21 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_pods_constraint = null; + protected $max_pods_constraint = null; /** * Optional. The Azure availability zone of the nodes in this nodepool. * When unspecified, it defaults to `1`. * * Generated from protobuf field string azure_availability_zone = 23 [(.google.api.field_behavior) = OPTIONAL]; */ - private $azure_availability_zone = ''; + protected $azure_availability_zone = ''; /** * Output only. A set of errors found in the node pool. * @@ -129,7 +129,7 @@ class AzureNodePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodeManagement management = 30 [(.google.api.field_behavior) = OPTIONAL]; */ - private $management = null; + protected $management = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureNodePoolAutoscaling.php b/GkeMultiCloud/src/V1/AzureNodePoolAutoscaling.php index beb9d081090f..2688e11da544 100644 --- a/GkeMultiCloud/src/V1/AzureNodePoolAutoscaling.php +++ b/GkeMultiCloud/src/V1/AzureNodePoolAutoscaling.php @@ -23,14 +23,14 @@ class AzureNodePoolAutoscaling 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. Maximum number of nodes in the node pool. Must be greater than or * equal to min_node_count and less than or equal to 50. * * Generated from protobuf field int32 max_node_count = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_node_count = 0; + protected $max_node_count = 0; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureNodePoolError.php b/GkeMultiCloud/src/V1/AzureNodePoolError.php index 81a43321f84e..854ce75b671a 100644 --- a/GkeMultiCloud/src/V1/AzureNodePoolError.php +++ b/GkeMultiCloud/src/V1/AzureNodePoolError.php @@ -20,7 +20,7 @@ class AzureNodePoolError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string message = 1; */ - private $message = ''; + protected $message = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureOpenIdConfig.php b/GkeMultiCloud/src/V1/AzureOpenIdConfig.php index a3116e88a272..cad099ee30e3 100644 --- a/GkeMultiCloud/src/V1/AzureOpenIdConfig.php +++ b/GkeMultiCloud/src/V1/AzureOpenIdConfig.php @@ -21,13 +21,13 @@ class AzureOpenIdConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string issuer = 1; */ - private $issuer = ''; + protected $issuer = ''; /** * JSON Web Key uri. * * Generated from protobuf field string jwks_uri = 2; */ - private $jwks_uri = ''; + protected $jwks_uri = ''; /** * Supported response types. * diff --git a/GkeMultiCloud/src/V1/AzureProxyConfig.php b/GkeMultiCloud/src/V1/AzureProxyConfig.php index e4343728def7..15d6eae15612 100644 --- a/GkeMultiCloud/src/V1/AzureProxyConfig.php +++ b/GkeMultiCloud/src/V1/AzureProxyConfig.php @@ -22,7 +22,7 @@ class AzureProxyConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string resource_group_id = 1; */ - private $resource_group_id = ''; + protected $resource_group_id = ''; /** * The URL the of the proxy setting secret with its version. * The secret must be a JSON encoded proxy configuration @@ -33,7 +33,7 @@ class AzureProxyConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string secret_id = 2; */ - private $secret_id = ''; + protected $secret_id = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureServerConfig.php b/GkeMultiCloud/src/V1/AzureServerConfig.php index c9568f614b21..b16a42166e59 100644 --- a/GkeMultiCloud/src/V1/AzureServerConfig.php +++ b/GkeMultiCloud/src/V1/AzureServerConfig.php @@ -25,7 +25,7 @@ class AzureServerConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * List of all released Kubernetes versions, including ones which are end of * life and can no longer be used. Filter by the `enabled` diff --git a/GkeMultiCloud/src/V1/AzureServicesAuthentication.php b/GkeMultiCloud/src/V1/AzureServicesAuthentication.php index 8114867b9b31..b5a17552ed8f 100644 --- a/GkeMultiCloud/src/V1/AzureServicesAuthentication.php +++ b/GkeMultiCloud/src/V1/AzureServicesAuthentication.php @@ -20,13 +20,13 @@ class AzureServicesAuthentication extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string tenant_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $tenant_id = ''; + protected $tenant_id = ''; /** * Required. The Azure Active Directory Application ID. * * Generated from protobuf field string application_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $application_id = ''; + protected $application_id = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/AzureSshConfig.php b/GkeMultiCloud/src/V1/AzureSshConfig.php index f37d5cfd3438..1327e9f14c97 100644 --- a/GkeMultiCloud/src/V1/AzureSshConfig.php +++ b/GkeMultiCloud/src/V1/AzureSshConfig.php @@ -22,7 +22,7 @@ class AzureSshConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string authorized_key = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $authorized_key = ''; + protected $authorized_key = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/BinaryAuthorization.php b/GkeMultiCloud/src/V1/BinaryAuthorization.php index fd6263b43a79..9272bbf1053d 100644 --- a/GkeMultiCloud/src/V1/BinaryAuthorization.php +++ b/GkeMultiCloud/src/V1/BinaryAuthorization.php @@ -21,7 +21,7 @@ class BinaryAuthorization extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.BinaryAuthorization.EvaluationMode evaluation_mode = 1; */ - private $evaluation_mode = 0; + protected $evaluation_mode = 0; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/Client/AttachedClustersClient.php b/GkeMultiCloud/src/V1/Client/AttachedClustersClient.php index 52169eee523f..cc065341d4a7 100644 --- a/GkeMultiCloud/src/V1/Client/AttachedClustersClient.php +++ b/GkeMultiCloud/src/V1/Client/AttachedClustersClient.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 * attached_cluster resource. @@ -332,8 +351,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function createAttachedCluster(CreateAttachedClusterRequest $request, array $callOptions = []): OperationResponse - { + public function createAttachedCluster( + CreateAttachedClusterRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateAttachedCluster', $request, $callOptions)->wait(); } @@ -364,8 +385,10 @@ public function createAttachedCluster(CreateAttachedClusterRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function deleteAttachedCluster(DeleteAttachedClusterRequest $request, array $callOptions = []): OperationResponse - { + public function deleteAttachedCluster( + DeleteAttachedClusterRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteAttachedCluster', $request, $callOptions)->wait(); } @@ -391,8 +414,10 @@ public function deleteAttachedCluster(DeleteAttachedClusterRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function generateAttachedClusterAgentToken(GenerateAttachedClusterAgentTokenRequest $request, array $callOptions = []): GenerateAttachedClusterAgentTokenResponse - { + public function generateAttachedClusterAgentToken( + GenerateAttachedClusterAgentTokenRequest $request, + array $callOptions = [] + ): GenerateAttachedClusterAgentTokenResponse { return $this->startApiCall('GenerateAttachedClusterAgentToken', $request, $callOptions)->wait(); } @@ -418,8 +443,10 @@ public function generateAttachedClusterAgentToken(GenerateAttachedClusterAgentTo * * @throws ApiException Thrown if the API call fails. */ - public function generateAttachedClusterInstallManifest(GenerateAttachedClusterInstallManifestRequest $request, array $callOptions = []): GenerateAttachedClusterInstallManifestResponse - { + public function generateAttachedClusterInstallManifest( + GenerateAttachedClusterInstallManifestRequest $request, + array $callOptions = [] + ): GenerateAttachedClusterInstallManifestResponse { return $this->startApiCall('GenerateAttachedClusterInstallManifest', $request, $callOptions)->wait(); } @@ -473,8 +500,10 @@ public function getAttachedCluster(GetAttachedClusterRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function getAttachedServerConfig(GetAttachedServerConfigRequest $request, array $callOptions = []): AttachedServerConfig - { + public function getAttachedServerConfig( + GetAttachedServerConfigRequest $request, + array $callOptions = [] + ): AttachedServerConfig { return $this->startApiCall('GetAttachedServerConfig', $request, $callOptions)->wait(); } @@ -509,8 +538,10 @@ public function getAttachedServerConfig(GetAttachedServerConfigRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function importAttachedCluster(ImportAttachedClusterRequest $request, array $callOptions = []): OperationResponse - { + public function importAttachedCluster( + ImportAttachedClusterRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('ImportAttachedCluster', $request, $callOptions)->wait(); } @@ -537,8 +568,10 @@ public function importAttachedCluster(ImportAttachedClusterRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function listAttachedClusters(ListAttachedClustersRequest $request, array $callOptions = []): PagedListResponse - { + public function listAttachedClusters( + ListAttachedClustersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListAttachedClusters', $request, $callOptions); } @@ -565,8 +598,10 @@ public function listAttachedClusters(ListAttachedClustersRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function updateAttachedCluster(UpdateAttachedClusterRequest $request, array $callOptions = []): OperationResponse - { + public function updateAttachedCluster( + UpdateAttachedClusterRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateAttachedCluster', $request, $callOptions)->wait(); } } diff --git a/GkeMultiCloud/src/V1/Client/AwsClustersClient.php b/GkeMultiCloud/src/V1/Client/AwsClustersClient.php index 0f7b6e65be6e..0872281ee076 100644 --- a/GkeMultiCloud/src/V1/Client/AwsClustersClient.php +++ b/GkeMultiCloud/src/V1/Client/AwsClustersClient.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 aws_cluster * resource. @@ -199,8 +218,12 @@ public static function awsClusterName(string $project, string $location, string * * @return string The formatted aws_node_pool resource. */ - public static function awsNodePoolName(string $project, string $location, string $awsCluster, string $awsNodePool): string - { + public static function awsNodePoolName( + string $project, + string $location, + string $awsCluster, + string $awsNodePool + ): string { return self::getPathTemplate('awsNodePool')->render([ 'project' => $project, 'location' => $location, @@ -491,8 +514,10 @@ public function deleteAwsNodePool(DeleteAwsNodePoolRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function generateAwsAccessToken(GenerateAwsAccessTokenRequest $request, array $callOptions = []): GenerateAwsAccessTokenResponse - { + public function generateAwsAccessToken( + GenerateAwsAccessTokenRequest $request, + array $callOptions = [] + ): GenerateAwsAccessTokenResponse { return $this->startApiCall('GenerateAwsAccessToken', $request, $callOptions)->wait(); } @@ -518,8 +543,10 @@ public function generateAwsAccessToken(GenerateAwsAccessTokenRequest $request, a * * @throws ApiException Thrown if the API call fails. */ - public function generateAwsClusterAgentToken(GenerateAwsClusterAgentTokenRequest $request, array $callOptions = []): GenerateAwsClusterAgentTokenResponse - { + public function generateAwsClusterAgentToken( + GenerateAwsClusterAgentTokenRequest $request, + array $callOptions = [] + ): GenerateAwsClusterAgentTokenResponse { return $this->startApiCall('GenerateAwsClusterAgentToken', $request, $callOptions)->wait(); } @@ -743,8 +770,10 @@ public function listAwsNodePools(ListAwsNodePoolsRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function rollbackAwsNodePoolUpdate(RollbackAwsNodePoolUpdateRequest $request, array $callOptions = []): OperationResponse - { + public function rollbackAwsNodePoolUpdate( + RollbackAwsNodePoolUpdateRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RollbackAwsNodePoolUpdate', $request, $callOptions)->wait(); } diff --git a/GkeMultiCloud/src/V1/Client/AzureClustersClient.php b/GkeMultiCloud/src/V1/Client/AzureClustersClient.php index 213ededb0949..e6759b576b27 100644 --- a/GkeMultiCloud/src/V1/Client/AzureClustersClient.php +++ b/GkeMultiCloud/src/V1/Client/AzureClustersClient.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 azure_client * resource. @@ -225,8 +244,12 @@ public static function azureClusterName(string $project, string $location, strin * * @return string The formatted azure_node_pool resource. */ - public static function azureNodePoolName(string $project, string $location, string $azureCluster, string $azureNodePool): string - { + public static function azureNodePoolName( + string $project, + string $location, + string $azureCluster, + string $azureNodePool + ): string { return self::getPathTemplate('azureNodePool')->render([ 'project' => $project, 'location' => $location, @@ -589,8 +612,10 @@ public function deleteAzureNodePool(DeleteAzureNodePoolRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function generateAzureAccessToken(GenerateAzureAccessTokenRequest $request, array $callOptions = []): GenerateAzureAccessTokenResponse - { + public function generateAzureAccessToken( + GenerateAzureAccessTokenRequest $request, + array $callOptions = [] + ): GenerateAzureAccessTokenResponse { return $this->startApiCall('GenerateAzureAccessToken', $request, $callOptions)->wait(); } @@ -616,8 +641,10 @@ public function generateAzureAccessToken(GenerateAzureAccessTokenRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function generateAzureClusterAgentToken(GenerateAzureClusterAgentTokenRequest $request, array $callOptions = []): GenerateAzureClusterAgentTokenResponse - { + public function generateAzureClusterAgentToken( + GenerateAzureClusterAgentTokenRequest $request, + array $callOptions = [] + ): GenerateAzureClusterAgentTokenResponse { return $this->startApiCall('GenerateAzureClusterAgentToken', $request, $callOptions)->wait(); } @@ -754,8 +781,10 @@ public function getAzureNodePool(GetAzureNodePoolRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function getAzureOpenIdConfig(GetAzureOpenIdConfigRequest $request, array $callOptions = []): AzureOpenIdConfig - { + public function getAzureOpenIdConfig( + GetAzureOpenIdConfigRequest $request, + array $callOptions = [] + ): AzureOpenIdConfig { return $this->startApiCall('GetAzureOpenIdConfig', $request, $callOptions)->wait(); } @@ -781,8 +810,10 @@ public function getAzureOpenIdConfig(GetAzureOpenIdConfigRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function getAzureServerConfig(GetAzureServerConfigRequest $request, array $callOptions = []): AzureServerConfig - { + public function getAzureServerConfig( + GetAzureServerConfigRequest $request, + array $callOptions = [] + ): AzureServerConfig { return $this->startApiCall('GetAzureServerConfig', $request, $callOptions)->wait(); } diff --git a/GkeMultiCloud/src/V1/CreateAttachedClusterRequest.php b/GkeMultiCloud/src/V1/CreateAttachedClusterRequest.php index 301f9ac6f9ed..80fed129c9ca 100644 --- a/GkeMultiCloud/src/V1/CreateAttachedClusterRequest.php +++ b/GkeMultiCloud/src/V1/CreateAttachedClusterRequest.php @@ -25,14 +25,14 @@ class CreateAttachedClusterRequest 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 specification of the * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster attached_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $attached_cluster = null; + protected $attached_cluster = null; /** * Required. A client provided ID the resource. Must be unique within the * parent resource. @@ -44,13 +44,13 @@ class CreateAttachedClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string attached_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $attached_cluster_id = ''; + protected $attached_cluster_id = ''; /** * If set, only validate the request, but do not actually create the cluster. * * Generated from protobuf field bool validate_only = 4; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The parent location where this diff --git a/GkeMultiCloud/src/V1/CreateAwsClusterRequest.php b/GkeMultiCloud/src/V1/CreateAwsClusterRequest.php index b51f9782ca4a..2421c4f73fba 100644 --- a/GkeMultiCloud/src/V1/CreateAwsClusterRequest.php +++ b/GkeMultiCloud/src/V1/CreateAwsClusterRequest.php @@ -25,14 +25,14 @@ class CreateAwsClusterRequest 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 specification of the * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster aws_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $aws_cluster = null; + protected $aws_cluster = null; /** * Required. A client provided ID the resource. Must be unique within the * parent resource. @@ -44,13 +44,13 @@ class CreateAwsClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string aws_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $aws_cluster_id = ''; + protected $aws_cluster_id = ''; /** * If set, only validate the request, but do not actually create the cluster. * * Generated from protobuf field bool validate_only = 4; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The parent location where this diff --git a/GkeMultiCloud/src/V1/CreateAwsNodePoolRequest.php b/GkeMultiCloud/src/V1/CreateAwsNodePoolRequest.php index f8e52fb6e59f..0a50ccd7b646 100644 --- a/GkeMultiCloud/src/V1/CreateAwsNodePoolRequest.php +++ b/GkeMultiCloud/src/V1/CreateAwsNodePoolRequest.php @@ -25,14 +25,14 @@ class CreateAwsNodePoolRequest 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 specification of the * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pool = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $aws_node_pool = null; + protected $aws_node_pool = null; /** * Required. A client provided ID the resource. Must be unique within the * parent resource. @@ -44,14 +44,14 @@ class CreateAwsNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string aws_node_pool_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $aws_node_pool_id = ''; + protected $aws_node_pool_id = ''; /** * If set, only validate the request, but do not actually create the node * pool. * * Generated from protobuf field bool validate_only = 4; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] diff --git a/GkeMultiCloud/src/V1/CreateAzureClientRequest.php b/GkeMultiCloud/src/V1/CreateAzureClientRequest.php index cf5549d7917c..79ffc0e05dc3 100644 --- a/GkeMultiCloud/src/V1/CreateAzureClientRequest.php +++ b/GkeMultiCloud/src/V1/CreateAzureClientRequest.php @@ -25,14 +25,14 @@ class CreateAzureClientRequest 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 specification of the * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureClient azure_client = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_client = null; + protected $azure_client = null; /** * Required. A client provided ID the resource. Must be unique within the * parent resource. @@ -44,13 +44,13 @@ class CreateAzureClientRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string azure_client_id = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_client_id = ''; + protected $azure_client_id = ''; /** * If set, only validate the request, but do not actually create the client. * * Generated from protobuf field bool validate_only = 3; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The parent location where this diff --git a/GkeMultiCloud/src/V1/CreateAzureClusterRequest.php b/GkeMultiCloud/src/V1/CreateAzureClusterRequest.php index df2cb207a28a..4a91100acf58 100644 --- a/GkeMultiCloud/src/V1/CreateAzureClusterRequest.php +++ b/GkeMultiCloud/src/V1/CreateAzureClusterRequest.php @@ -25,14 +25,14 @@ class CreateAzureClusterRequest 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 specification of the * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster azure_cluster = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_cluster = null; + protected $azure_cluster = null; /** * Required. A client provided ID the resource. Must be unique within the * parent resource. @@ -44,13 +44,13 @@ class CreateAzureClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string azure_cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_cluster_id = ''; + protected $azure_cluster_id = ''; /** * If set, only validate the request, but do not actually create the cluster. * * Generated from protobuf field bool validate_only = 4; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The parent location where this diff --git a/GkeMultiCloud/src/V1/CreateAzureNodePoolRequest.php b/GkeMultiCloud/src/V1/CreateAzureNodePoolRequest.php index dcbb9b49fa1a..916c7caa6c2a 100644 --- a/GkeMultiCloud/src/V1/CreateAzureNodePoolRequest.php +++ b/GkeMultiCloud/src/V1/CreateAzureNodePoolRequest.php @@ -25,14 +25,14 @@ class CreateAzureNodePoolRequest 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 specification of the * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pool = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_node_pool = null; + protected $azure_node_pool = null; /** * Required. A client provided ID the resource. Must be unique within the * parent resource. @@ -44,14 +44,14 @@ class CreateAzureNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string azure_node_pool_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_node_pool_id = ''; + protected $azure_node_pool_id = ''; /** * If set, only validate the request, but do not actually create the node * pool. * * Generated from protobuf field bool validate_only = 4; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] diff --git a/GkeMultiCloud/src/V1/DeleteAttachedClusterRequest.php b/GkeMultiCloud/src/V1/DeleteAttachedClusterRequest.php index 5e7432150286..0d3c5f6c7d10 100644 --- a/GkeMultiCloud/src/V1/DeleteAttachedClusterRequest.php +++ b/GkeMultiCloud/src/V1/DeleteAttachedClusterRequest.php @@ -25,13 +25,13 @@ class DeleteAttachedClusterRequest 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, only validate the request, but do not actually delete the resource. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * If set to true, and the * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource @@ -42,7 +42,7 @@ class DeleteAttachedClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 3; */ - private $allow_missing = false; + protected $allow_missing = false; /** * If set to true, the deletion of * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource @@ -51,7 +51,7 @@ class DeleteAttachedClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool ignore_errors = 5; */ - private $ignore_errors = false; + protected $ignore_errors = false; /** * The current etag of the * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. @@ -61,7 +61,7 @@ class DeleteAttachedClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 4; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The resource name the diff --git a/GkeMultiCloud/src/V1/DeleteAwsClusterRequest.php b/GkeMultiCloud/src/V1/DeleteAwsClusterRequest.php index 3e8a3062036d..af66bc8b136a 100644 --- a/GkeMultiCloud/src/V1/DeleteAwsClusterRequest.php +++ b/GkeMultiCloud/src/V1/DeleteAwsClusterRequest.php @@ -25,13 +25,13 @@ class DeleteAwsClusterRequest 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, only validate the request, but do not actually delete the resource. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * If set to true, and the * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource is not @@ -41,7 +41,7 @@ class DeleteAwsClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 3; */ - private $allow_missing = false; + protected $allow_missing = false; /** * Optional. If set to true, the deletion of * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will @@ -50,7 +50,7 @@ class DeleteAwsClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool ignore_errors = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $ignore_errors = false; + protected $ignore_errors = false; /** * The current etag of the * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. @@ -60,7 +60,7 @@ class DeleteAwsClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 4; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The resource name the diff --git a/GkeMultiCloud/src/V1/DeleteAwsNodePoolRequest.php b/GkeMultiCloud/src/V1/DeleteAwsNodePoolRequest.php index 057e37a0f1ec..c4c621f59cdc 100644 --- a/GkeMultiCloud/src/V1/DeleteAwsNodePoolRequest.php +++ b/GkeMultiCloud/src/V1/DeleteAwsNodePoolRequest.php @@ -25,14 +25,14 @@ class DeleteAwsNodePoolRequest 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, only validate the request, but do not actually delete the node * pool. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * If set to true, and the * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource is not @@ -42,7 +42,7 @@ class DeleteAwsNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 3; */ - private $allow_missing = false; + protected $allow_missing = false; /** * Optional. If set to true, the deletion of * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource will @@ -51,7 +51,7 @@ class DeleteAwsNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool ignore_errors = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $ignore_errors = false; + protected $ignore_errors = false; /** * The current ETag of the * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. @@ -61,7 +61,7 @@ class DeleteAwsNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 4; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The resource name the diff --git a/GkeMultiCloud/src/V1/DeleteAzureClientRequest.php b/GkeMultiCloud/src/V1/DeleteAzureClientRequest.php index b0633da6b550..37807fa3dee7 100644 --- a/GkeMultiCloud/src/V1/DeleteAzureClientRequest.php +++ b/GkeMultiCloud/src/V1/DeleteAzureClientRequest.php @@ -26,7 +26,7 @@ class DeleteAzureClientRequest 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, and the * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource is not @@ -36,13 +36,13 @@ class DeleteAzureClientRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 2; */ - private $allow_missing = false; + protected $allow_missing = false; /** * If set, only validate the request, but do not actually delete the resource. * * Generated from protobuf field bool validate_only = 3; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $name Required. The resource name the diff --git a/GkeMultiCloud/src/V1/DeleteAzureClusterRequest.php b/GkeMultiCloud/src/V1/DeleteAzureClusterRequest.php index 7db351b4cec9..4d3907269d12 100644 --- a/GkeMultiCloud/src/V1/DeleteAzureClusterRequest.php +++ b/GkeMultiCloud/src/V1/DeleteAzureClusterRequest.php @@ -25,7 +25,7 @@ class DeleteAzureClusterRequest 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, and the * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource is not @@ -35,13 +35,13 @@ class DeleteAzureClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 2; */ - private $allow_missing = false; + protected $allow_missing = false; /** * If set, only validate the request, but do not actually delete the resource. * * Generated from protobuf field bool validate_only = 3; */ - private $validate_only = false; + protected $validate_only = false; /** * The current etag of the * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. @@ -51,7 +51,7 @@ class DeleteAzureClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 4; */ - private $etag = ''; + protected $etag = ''; /** * Optional. If set to true, the deletion of * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will @@ -60,7 +60,7 @@ class DeleteAzureClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool ignore_errors = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $ignore_errors = false; + protected $ignore_errors = false; /** * @param string $name Required. The resource name the diff --git a/GkeMultiCloud/src/V1/DeleteAzureNodePoolRequest.php b/GkeMultiCloud/src/V1/DeleteAzureNodePoolRequest.php index ad078d7dad23..a27b26f73fd0 100644 --- a/GkeMultiCloud/src/V1/DeleteAzureNodePoolRequest.php +++ b/GkeMultiCloud/src/V1/DeleteAzureNodePoolRequest.php @@ -25,14 +25,14 @@ class DeleteAzureNodePoolRequest 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, only validate the request, but do not actually delete the node * pool. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * If set to true, and the * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource is @@ -43,7 +43,7 @@ class DeleteAzureNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 3; */ - private $allow_missing = false; + protected $allow_missing = false; /** * The current ETag of the * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. @@ -53,7 +53,7 @@ class DeleteAzureNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 4; */ - private $etag = ''; + protected $etag = ''; /** * Optional. If set to true, the deletion of * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource will @@ -62,7 +62,7 @@ class DeleteAzureNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool ignore_errors = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $ignore_errors = false; + protected $ignore_errors = false; /** * @param string $name Required. The resource name the diff --git a/GkeMultiCloud/src/V1/Fleet.php b/GkeMultiCloud/src/V1/Fleet.php index 860ebe49c0a4..ddc8d53d7ae1 100644 --- a/GkeMultiCloud/src/V1/Fleet.php +++ b/GkeMultiCloud/src/V1/Fleet.php @@ -29,7 +29,7 @@ class Fleet extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Output only. The name of the managed Hub Membership resource associated to * this cluster. @@ -38,7 +38,7 @@ class Fleet extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string membership = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $membership = ''; + protected $membership = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/Gapic/AttachedClustersGapicClient.php b/GkeMultiCloud/src/V1/Gapic/AttachedClustersGapicClient.php deleted file mode 100644 index a713b7d9542f..000000000000 --- a/GkeMultiCloud/src/V1/Gapic/AttachedClustersGapicClient.php +++ /dev/null @@ -1,1255 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $attachedCluster = new AttachedCluster(); - * $attachedClusterId = 'attached_cluster_id'; - * $operationResponse = $attachedClustersClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); - * $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 = $attachedClustersClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'createAttachedCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $attachedClustersClient->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\GkeMultiCloud\V1\Client\AttachedClustersClient}. - */ -class AttachedClustersGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.gkemulticloud.v1.AttachedClusters'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'gkemulticloud.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'gkemulticloud.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 $attachedClusterNameTemplate; - - private static $attachedServerConfigNameTemplate; - - 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/attached_clusters_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/attached_clusters_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/attached_clusters_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/attached_clusters_rest_client_config.php', - ], - ], - ]; - } - - private static function getAttachedClusterNameTemplate() - { - if (self::$attachedClusterNameTemplate == null) { - self::$attachedClusterNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/attachedClusters/{attached_cluster}' - ); - } - - return self::$attachedClusterNameTemplate; - } - - private static function getAttachedServerConfigNameTemplate() - { - if (self::$attachedServerConfigNameTemplate == null) { - self::$attachedServerConfigNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/attachedServerConfig' - ); - } - - return self::$attachedServerConfigNameTemplate; - } - - 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 = [ - 'attachedCluster' => self::getAttachedClusterNameTemplate(), - 'attachedServerConfig' => self::getAttachedServerConfigNameTemplate(), - 'location' => self::getLocationNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * attached_cluster resource. - * - * @param string $project - * @param string $location - * @param string $attachedCluster - * - * @return string The formatted attached_cluster resource. - */ - public static function attachedClusterName( - $project, - $location, - $attachedCluster - ) { - return self::getAttachedClusterNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'attached_cluster' => $attachedCluster, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * attached_server_config resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted attached_server_config resource. - */ - public static function attachedServerConfigName($project, $location) - { - return self::getAttachedServerConfigNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * 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 - * - attachedCluster: projects/{project}/locations/{location}/attachedClusters/{attached_cluster} - * - attachedServerConfig: projects/{project}/locations/{location}/attachedServerConfig - * - 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 'gkemulticloud.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 - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * on a given Google Cloud Platform project and region. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $attachedClustersClient = new AttachedClustersClient(); - * try { - * $formattedParent = $attachedClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * $attachedCluster = new AttachedCluster(); - * $attachedClusterId = 'attached_cluster_id'; - * $operationResponse = $attachedClustersClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); - * $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 = $attachedClustersClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'createAttachedCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $attachedClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location where this - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * will be created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param AttachedCluster $attachedCluster Required. The specification of the - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to create. - * @param string $attachedClusterId Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * name formatted as - * `projects//locations//attachedClusters/`. - * - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually create the cluster. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createAttachedCluster( - $parent, - $attachedCluster, - $attachedClusterId, - array $optionalArgs = [] - ) { - $request = new CreateAttachedClusterRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setAttachedCluster($attachedCluster); - $request->setAttachedClusterId($attachedClusterId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateAttachedCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a specific - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $attachedClustersClient = new AttachedClustersClient(); - * try { - * $formattedName = $attachedClustersClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - * $operationResponse = $attachedClustersClient->deleteAttachedCluster($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 = $attachedClustersClient->deleteAttachedCluster($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'deleteAttachedCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $attachedClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name the - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] to delete. - * - * `AttachedCluster` names are formatted as - * `projects//locations//attachedClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually delete the resource. - * @type bool $allowMissing - * If set to true, and the - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * is not found, the request will succeed but no action will be taken on the - * server and a completed [Operation][google.longrunning.Operation] will be - * returned. - * - * Useful for idempotent deletion. - * @type bool $ignoreErrors - * If set to true, the deletion of - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * will succeed even if errors occur during deleting in cluster resources. - * Using this parameter may result in orphaned resources in the cluster. - * @type string $etag - * The current etag of the - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided etag does not match the current etag of the cluster, - * the request will fail and an ABORTED error will be returned. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteAttachedCluster($name, array $optionalArgs = []) - { - $request = new DeleteAttachedClusterRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - if (isset($optionalArgs['allowMissing'])) { - $request->setAllowMissing($optionalArgs['allowMissing']); - } - - if (isset($optionalArgs['ignoreErrors'])) { - $request->setIgnoreErrors($optionalArgs['ignoreErrors']); - } - - 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( - 'DeleteAttachedCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Generates an access token for a cluster agent. - * - * Sample code: - * ``` - * $attachedClustersClient = new AttachedClustersClient(); - * try { - * $formattedAttachedCluster = $attachedClustersClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - * $subjectToken = 'subject_token'; - * $subjectTokenType = 'subject_token_type'; - * $version = 'version'; - * $response = $attachedClustersClient->generateAttachedClusterAgentToken($formattedAttachedCluster, $subjectToken, $subjectTokenType, $version); - * } finally { - * $attachedClustersClient->close(); - * } - * ``` - * - * @param string $attachedCluster Required. - * @param string $subjectToken Required. - * @param string $subjectTokenType Required. - * @param string $version Required. - * @param array $optionalArgs { - * Optional. - * - * @type string $grantType - * Optional. - * @type string $audience - * Optional. - * @type string $scope - * Optional. - * @type string $requestedTokenType - * Optional. - * @type string $options - * 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\GkeMultiCloud\V1\GenerateAttachedClusterAgentTokenResponse - * - * @throws ApiException if the remote call fails - */ - public function generateAttachedClusterAgentToken( - $attachedCluster, - $subjectToken, - $subjectTokenType, - $version, - array $optionalArgs = [] - ) { - $request = new GenerateAttachedClusterAgentTokenRequest(); - $requestParamHeaders = []; - $request->setAttachedCluster($attachedCluster); - $request->setSubjectToken($subjectToken); - $request->setSubjectTokenType($subjectTokenType); - $request->setVersion($version); - $requestParamHeaders['attached_cluster'] = $attachedCluster; - if (isset($optionalArgs['grantType'])) { - $request->setGrantType($optionalArgs['grantType']); - } - - if (isset($optionalArgs['audience'])) { - $request->setAudience($optionalArgs['audience']); - } - - if (isset($optionalArgs['scope'])) { - $request->setScope($optionalArgs['scope']); - } - - if (isset($optionalArgs['requestedTokenType'])) { - $request->setRequestedTokenType( - $optionalArgs['requestedTokenType'] - ); - } - - 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( - 'GenerateAttachedClusterAgentToken', - GenerateAttachedClusterAgentTokenResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Generates the install manifest to be installed on the target cluster. - * - * Sample code: - * ``` - * $attachedClustersClient = new AttachedClustersClient(); - * try { - * $formattedParent = $attachedClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * $attachedClusterId = 'attached_cluster_id'; - * $platformVersion = 'platform_version'; - * $response = $attachedClustersClient->generateAttachedClusterInstallManifest($formattedParent, $attachedClusterId, $platformVersion); - * } finally { - * $attachedClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location where this - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * will be created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param string $attachedClusterId Required. A client provided ID of the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * name formatted as - * `projects//locations//attachedClusters/`. - * - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - * - * When generating an install manifest for importing an existing Membership - * resource, the attached_cluster_id field must be the Membership id. - * - * Membership names are formatted as - * `projects//locations//memberships/`. - * @param string $platformVersion Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). - * - * You can list all supported versions on a given Google Cloud region by - * calling - * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. - * @param array $optionalArgs { - * Optional. - * - * @type AttachedProxyConfig $proxyConfig - * Optional. Proxy configuration for outbound HTTP(S) traffic. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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\GkeMultiCloud\V1\GenerateAttachedClusterInstallManifestResponse - * - * @throws ApiException if the remote call fails - */ - public function generateAttachedClusterInstallManifest( - $parent, - $attachedClusterId, - $platformVersion, - array $optionalArgs = [] - ) { - $request = new GenerateAttachedClusterInstallManifestRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setAttachedClusterId($attachedClusterId); - $request->setPlatformVersion($platformVersion); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['proxyConfig'])) { - $request->setProxyConfig($optionalArgs['proxyConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GenerateAttachedClusterInstallManifest', - GenerateAttachedClusterInstallManifestResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Describes a specific - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource. - * - * Sample code: - * ``` - * $attachedClustersClient = new AttachedClustersClient(); - * try { - * $formattedName = $attachedClustersClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - * $response = $attachedClustersClient->getAttachedCluster($formattedName); - * } finally { - * $attachedClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * to describe. - * - * `AttachedCluster` names are formatted as - * `projects//locations//attachedClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @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\GkeMultiCloud\V1\AttachedCluster - * - * @throws ApiException if the remote call fails - */ - public function getAttachedCluster($name, array $optionalArgs = []) - { - $request = new GetAttachedClusterRequest(); - $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( - 'GetAttachedCluster', - AttachedCluster::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns information, such as supported Kubernetes versions, on a given - * Google Cloud location. - * - * Sample code: - * ``` - * $attachedClustersClient = new AttachedClustersClient(); - * try { - * $formattedName = $attachedClustersClient->attachedServerConfigName('[PROJECT]', '[LOCATION]'); - * $response = $attachedClustersClient->getAttachedServerConfig($formattedName); - * } finally { - * $attachedClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedServerConfig] - * resource to describe. - * - * `AttachedServerConfig` names are formatted as - * `projects//locations//attachedServerConfig`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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\GkeMultiCloud\V1\AttachedServerConfig - * - * @throws ApiException if the remote call fails - */ - public function getAttachedServerConfig($name, array $optionalArgs = []) - { - $request = new GetAttachedServerConfigRequest(); - $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( - 'GetAttachedServerConfig', - AttachedServerConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Imports creates a new - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * by importing an existing Fleet Membership resource. - * - * Attached Clusters created before the introduction of the Anthos Multi-Cloud - * API can be imported through this method. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $attachedClustersClient = new AttachedClustersClient(); - * try { - * $formattedParent = $attachedClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * $fleetMembership = 'fleet_membership'; - * $platformVersion = 'platform_version'; - * $distribution = 'distribution'; - * $operationResponse = $attachedClustersClient->importAttachedCluster($formattedParent, $fleetMembership, $platformVersion, $distribution); - * $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 = $attachedClustersClient->importAttachedCluster($formattedParent, $fleetMembership, $platformVersion, $distribution); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'importAttachedCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $attachedClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location where this - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * will be created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param string $fleetMembership Required. The name of the fleet membership resource to import. - * @param string $platformVersion Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). - * - * You can list all supported versions on a given Google Cloud region by - * calling - * [GetAttachedServerConfig][google.cloud.gkemulticloud.v1.AttachedClusters.GetAttachedServerConfig]. - * @param string $distribution Required. The Kubernetes distribution of the underlying attached cluster. - * - * Supported values: ["eks", "aks"]. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually import the cluster. - * @type AttachedProxyConfig $proxyConfig - * Optional. Proxy configuration for outbound HTTP(S) traffic. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 importAttachedCluster( - $parent, - $fleetMembership, - $platformVersion, - $distribution, - array $optionalArgs = [] - ) { - $request = new ImportAttachedClusterRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setFleetMembership($fleetMembership); - $request->setPlatformVersion($platformVersion); - $request->setDistribution($distribution); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - if (isset($optionalArgs['proxyConfig'])) { - $request->setProxyConfig($optionalArgs['proxyConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'ImportAttachedCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Lists all [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] - * resources on a given Google Cloud project and region. - * - * Sample code: - * ``` - * $attachedClustersClient = new AttachedClustersClient(); - * try { - * $formattedParent = $attachedClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $attachedClustersClient->listAttachedClusters($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $attachedClustersClient->listAttachedClusters($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $attachedClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location which owns this collection of - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @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 listAttachedClusters($parent, array $optionalArgs = []) - { - $request = new ListAttachedClustersRequest(); - $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( - 'ListAttachedClusters', - $optionalArgs, - ListAttachedClustersResponse::class, - $request - ); - } - - /** - * Updates an - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]. - * - * Sample code: - * ``` - * $attachedClustersClient = new AttachedClustersClient(); - * try { - * $attachedCluster = new AttachedCluster(); - * $updateMask = new FieldMask(); - * $operationResponse = $attachedClustersClient->updateAttachedCluster($attachedCluster, $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 = $attachedClustersClient->updateAttachedCluster($attachedCluster, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $attachedClustersClient->resumeOperation($operationName, 'updateAttachedCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $attachedClustersClient->close(); - * } - * ``` - * - * @param AttachedCluster $attachedCluster Required. The - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster] resource - * to update. - * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from - * [AttachedCluster][google.cloud.gkemulticloud.v1.AttachedCluster]: - * - * * `annotations`. - * * `authorization.admin_groups`. - * * `authorization.admin_users`. - * * `binary_authorization.evaluation_mode`. - * * `description`. - * * `logging_config.component_config.enable_components`. - * * `monitoring_config.managed_prometheus_config.enabled`. - * * `platform_version`. - * * `proxy_config.kubernetes_secret.name`. - * * `proxy_config.kubernetes_secret.namespace`. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually update the cluster. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateAttachedCluster( - $attachedCluster, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateAttachedClusterRequest(); - $requestParamHeaders = []; - $request->setAttachedCluster($attachedCluster); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'attached_cluster.name' - ] = $attachedCluster->getName(); - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateAttachedCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } -} diff --git a/GkeMultiCloud/src/V1/Gapic/AwsClustersGapicClient.php b/GkeMultiCloud/src/V1/Gapic/AwsClustersGapicClient.php deleted file mode 100644 index 0aeb1b938e0e..000000000000 --- a/GkeMultiCloud/src/V1/Gapic/AwsClustersGapicClient.php +++ /dev/null @@ -1,1861 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $awsCluster = new AwsCluster(); - * $awsClusterId = 'aws_cluster_id'; - * $operationResponse = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); - * $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 = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'createAwsCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $awsClustersClient->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\GkeMultiCloud\V1\Client\AwsClustersClient}. - */ -class AwsClustersGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.gkemulticloud.v1.AwsClusters'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'gkemulticloud.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'gkemulticloud.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 $awsClusterNameTemplate; - - private static $awsNodePoolNameTemplate; - - private static $awsServerConfigNameTemplate; - - 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/aws_clusters_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/aws_clusters_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/aws_clusters_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/aws_clusters_rest_client_config.php', - ], - ], - ]; - } - - private static function getAwsClusterNameTemplate() - { - if (self::$awsClusterNameTemplate == null) { - self::$awsClusterNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}' - ); - } - - return self::$awsClusterNameTemplate; - } - - private static function getAwsNodePoolNameTemplate() - { - if (self::$awsNodePoolNameTemplate == null) { - self::$awsNodePoolNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}' - ); - } - - return self::$awsNodePoolNameTemplate; - } - - private static function getAwsServerConfigNameTemplate() - { - if (self::$awsServerConfigNameTemplate == null) { - self::$awsServerConfigNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/awsServerConfig' - ); - } - - return self::$awsServerConfigNameTemplate; - } - - 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 = [ - 'awsCluster' => self::getAwsClusterNameTemplate(), - 'awsNodePool' => self::getAwsNodePoolNameTemplate(), - 'awsServerConfig' => self::getAwsServerConfigNameTemplate(), - 'location' => self::getLocationNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a aws_cluster - * resource. - * - * @param string $project - * @param string $location - * @param string $awsCluster - * - * @return string The formatted aws_cluster resource. - */ - public static function awsClusterName($project, $location, $awsCluster) - { - return self::getAwsClusterNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'aws_cluster' => $awsCluster, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * aws_node_pool resource. - * - * @param string $project - * @param string $location - * @param string $awsCluster - * @param string $awsNodePool - * - * @return string The formatted aws_node_pool resource. - */ - public static function awsNodePoolName( - $project, - $location, - $awsCluster, - $awsNodePool - ) { - return self::getAwsNodePoolNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'aws_cluster' => $awsCluster, - 'aws_node_pool' => $awsNodePool, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * aws_server_config resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted aws_server_config resource. - */ - public static function awsServerConfigName($project, $location) - { - return self::getAwsServerConfigNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * 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 - * - awsCluster: projects/{project}/locations/{location}/awsClusters/{aws_cluster} - * - awsNodePool: projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool} - * - awsServerConfig: projects/{project}/locations/{location}/awsServerConfig - * - 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 'gkemulticloud.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 [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - * resource on a given Google Cloud Platform project and region. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedParent = $awsClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * $awsCluster = new AwsCluster(); - * $awsClusterId = 'aws_cluster_id'; - * $operationResponse = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); - * $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 = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'createAwsCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location where this - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be - * created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param AwsCluster $awsCluster Required. The specification of the - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to create. - * @param string $awsClusterId Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name - * formatted as - * `projects//locations//awsClusters/`. - * - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually create the cluster. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createAwsCluster( - $parent, - $awsCluster, - $awsClusterId, - array $optionalArgs = [] - ) { - $request = new CreateAwsClusterRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setAwsCluster($awsCluster); - $request->setAwsClusterId($awsClusterId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateAwsCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool], - * attached to a given [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedParent = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - * $awsNodePool = new AwsNodePool(); - * $awsNodePoolId = 'aws_node_pool_id'; - * $operationResponse = $awsClustersClient->createAwsNodePool($formattedParent, $awsNodePool, $awsNodePoolId); - * $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 = $awsClustersClient->createAwsNodePool($formattedParent, $awsNodePool, $awsNodePoolId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'createAwsNodePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - * resource where this node pool will be created. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param AwsNodePool $awsNodePool Required. The specification of the - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to create. - * @param string $awsNodePoolId Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name - * formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually create the node - * pool. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createAwsNodePool( - $parent, - $awsNodePool, - $awsNodePoolId, - array $optionalArgs = [] - ) { - $request = new CreateAwsNodePoolRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setAwsNodePool($awsNodePool); - $request->setAwsNodePoolId($awsNodePoolId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateAwsNodePool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - * resource. - * - * Fails if the cluster has one or more associated - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedName = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - * $operationResponse = $awsClustersClient->deleteAwsCluster($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 = $awsClustersClient->deleteAwsCluster($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'deleteAwsCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name the - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually delete the resource. - * @type bool $allowMissing - * If set to true, and the - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed [Operation][google.longrunning.Operation] will be returned. - * - * Useful for idempotent deletion. - * @type bool $ignoreErrors - * Optional. If set to true, the deletion of - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will - * succeed even if errors occur during deleting in cluster resources. Using - * this parameter may result in orphaned resources in the cluster. - * @type string $etag - * The current etag of the - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided etag does not match the current etag of the cluster, - * the request will fail and an ABORTED error will be returned. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteAwsCluster($name, array $optionalArgs = []) - { - $request = new DeleteAwsClusterRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - if (isset($optionalArgs['allowMissing'])) { - $request->setAllowMissing($optionalArgs['allowMissing']); - } - - if (isset($optionalArgs['ignoreErrors'])) { - $request->setIgnoreErrors($optionalArgs['ignoreErrors']); - } - - 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( - 'DeleteAwsCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a specific [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] - * resource. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedName = $awsClustersClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - * $operationResponse = $awsClustersClient->deleteAwsNodePool($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 = $awsClustersClient->deleteAwsNodePool($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'deleteAwsNodePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name the - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete. - * - * `AwsNodePool` names are formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually delete the node - * pool. - * @type bool $allowMissing - * If set to true, and the - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed [Operation][google.longrunning.Operation] will be returned. - * - * Useful for idempotent deletion. - * @type bool $ignoreErrors - * Optional. If set to true, the deletion of - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource will - * succeed even if errors occur during deleting in node pool resources. Using - * this parameter may result in orphaned resources in the node pool. - * @type string $etag - * The current ETag of the - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided ETag does not match the current etag of the node pool, - * the request will fail and an ABORTED error will be returned. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteAwsNodePool($name, array $optionalArgs = []) - { - $request = new DeleteAwsNodePoolRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - if (isset($optionalArgs['allowMissing'])) { - $request->setAllowMissing($optionalArgs['allowMissing']); - } - - if (isset($optionalArgs['ignoreErrors'])) { - $request->setIgnoreErrors($optionalArgs['ignoreErrors']); - } - - 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( - 'DeleteAwsNodePool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Generates a short-lived access token to authenticate to a given - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedAwsCluster = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - * $response = $awsClustersClient->generateAwsAccessToken($formattedAwsCluster); - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $awsCluster Required. The name of the - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to - * authenticate to. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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\GkeMultiCloud\V1\GenerateAwsAccessTokenResponse - * - * @throws ApiException if the remote call fails - */ - public function generateAwsAccessToken( - $awsCluster, - array $optionalArgs = [] - ) { - $request = new GenerateAwsAccessTokenRequest(); - $requestParamHeaders = []; - $request->setAwsCluster($awsCluster); - $requestParamHeaders['aws_cluster'] = $awsCluster; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GenerateAwsAccessToken', - GenerateAwsAccessTokenResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Generates an access token for a cluster agent. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedAwsCluster = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - * $subjectToken = 'subject_token'; - * $subjectTokenType = 'subject_token_type'; - * $version = 'version'; - * $response = $awsClustersClient->generateAwsClusterAgentToken($formattedAwsCluster, $subjectToken, $subjectTokenType, $version); - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $awsCluster Required. - * @param string $subjectToken Required. - * @param string $subjectTokenType Required. - * @param string $version Required. - * @param array $optionalArgs { - * Optional. - * - * @type string $nodePoolId - * Optional. - * @type string $grantType - * Optional. - * @type string $audience - * Optional. - * @type string $scope - * Optional. - * @type string $requestedTokenType - * Optional. - * @type string $options - * 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\GkeMultiCloud\V1\GenerateAwsClusterAgentTokenResponse - * - * @throws ApiException if the remote call fails - */ - public function generateAwsClusterAgentToken( - $awsCluster, - $subjectToken, - $subjectTokenType, - $version, - array $optionalArgs = [] - ) { - $request = new GenerateAwsClusterAgentTokenRequest(); - $requestParamHeaders = []; - $request->setAwsCluster($awsCluster); - $request->setSubjectToken($subjectToken); - $request->setSubjectTokenType($subjectTokenType); - $request->setVersion($version); - $requestParamHeaders['aws_cluster'] = $awsCluster; - if (isset($optionalArgs['nodePoolId'])) { - $request->setNodePoolId($optionalArgs['nodePoolId']); - } - - if (isset($optionalArgs['grantType'])) { - $request->setGrantType($optionalArgs['grantType']); - } - - if (isset($optionalArgs['audience'])) { - $request->setAudience($optionalArgs['audience']); - } - - if (isset($optionalArgs['scope'])) { - $request->setScope($optionalArgs['scope']); - } - - if (isset($optionalArgs['requestedTokenType'])) { - $request->setRequestedTokenType( - $optionalArgs['requestedTokenType'] - ); - } - - 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( - 'GenerateAwsClusterAgentToken', - GenerateAwsClusterAgentTokenResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Describes a specific [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - * resource. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedName = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - * $response = $awsClustersClient->getAwsCluster($formattedName); - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to - * describe. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @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\GkeMultiCloud\V1\AwsCluster - * - * @throws ApiException if the remote call fails - */ - public function getAwsCluster($name, array $optionalArgs = []) - { - $request = new GetAwsClusterRequest(); - $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( - 'GetAwsCluster', - AwsCluster::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets the public component of the cluster signing keys in - * JSON Web Key format. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedAwsCluster = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - * $response = $awsClustersClient->getAwsJsonWebKeys($formattedAwsCluster); - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $awsCluster Required. The AwsCluster, which owns the JsonWebKeys. - * Format: - * projects/{project}/locations/{location}/awsClusters/{cluster} - * @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\GkeMultiCloud\V1\AwsJsonWebKeys - * - * @throws ApiException if the remote call fails - */ - public function getAwsJsonWebKeys($awsCluster, array $optionalArgs = []) - { - $request = new GetAwsJsonWebKeysRequest(); - $requestParamHeaders = []; - $request->setAwsCluster($awsCluster); - $requestParamHeaders['aws_cluster'] = $awsCluster; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetAwsJsonWebKeys', - AwsJsonWebKeys::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Describes a specific - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedName = $awsClustersClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - * $response = $awsClustersClient->getAwsNodePool($formattedName); - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to - * describe. - * - * `AwsNodePool` names are formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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\GkeMultiCloud\V1\AwsNodePool - * - * @throws ApiException if the remote call fails - */ - public function getAwsNodePool($name, array $optionalArgs = []) - { - $request = new GetAwsNodePoolRequest(); - $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( - 'GetAwsNodePool', - AwsNodePool::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets the OIDC discovery document for the cluster. - * See the - * [OpenID Connect Discovery 1.0 - * specification](https://openid.net/specs/openid-connect-discovery-1_0.html) - * for details. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedAwsCluster = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - * $response = $awsClustersClient->getAwsOpenIdConfig($formattedAwsCluster); - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $awsCluster Required. The AwsCluster, which owns the OIDC discovery document. - * Format: - * projects/{project}/locations/{location}/awsClusters/{cluster} - * @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\GkeMultiCloud\V1\AwsOpenIdConfig - * - * @throws ApiException if the remote call fails - */ - public function getAwsOpenIdConfig($awsCluster, array $optionalArgs = []) - { - $request = new GetAwsOpenIdConfigRequest(); - $requestParamHeaders = []; - $request->setAwsCluster($awsCluster); - $requestParamHeaders['aws_cluster'] = $awsCluster; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetAwsOpenIdConfig', - AwsOpenIdConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns information, such as supported AWS regions and Kubernetes - * versions, on a given Google Cloud location. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedName = $awsClustersClient->awsServerConfigName('[PROJECT]', '[LOCATION]'); - * $response = $awsClustersClient->getAwsServerConfig($formattedName); - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource - * to describe. - * - * `AwsServerConfig` names are formatted as - * `projects//locations//awsServerConfig`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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\GkeMultiCloud\V1\AwsServerConfig - * - * @throws ApiException if the remote call fails - */ - public function getAwsServerConfig($name, array $optionalArgs = []) - { - $request = new GetAwsServerConfigRequest(); - $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( - 'GetAwsServerConfig', - AwsServerConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources - * on a given Google Cloud project and region. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedParent = $awsClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $awsClustersClient->listAwsClusters($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $awsClustersClient->listAwsClusters($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location which owns this collection of - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @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 listAwsClusters($parent, array $optionalArgs = []) - { - $request = new ListAwsClustersRequest(); - $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( - 'ListAwsClusters', - $optionalArgs, - ListAwsClustersResponse::class, - $request - ); - } - - /** - * Lists all [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] - * resources on a given - * [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedParent = $awsClustersClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - * // Iterate over pages of elements - * $pagedResponse = $awsClustersClient->listAwsNodePools($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $awsClustersClient->listAwsNodePools($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent `AwsCluster` which owns this collection of - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources. - * - * `AwsCluster` names are formatted as - * `projects//locations//awsClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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 listAwsNodePools($parent, array $optionalArgs = []) - { - $request = new ListAwsNodePoolsRequest(); - $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( - 'ListAwsNodePools', - $optionalArgs, - ListAwsNodePoolsResponse::class, - $request - ); - } - - /** - * Rolls back a previously aborted or failed - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] update request. - * Makes no changes if the last update request successfully finished. - * If an update request is in progress, you cannot rollback the update. - * You must first cancel or let it finish unsuccessfully before you can - * rollback. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $formattedName = $awsClustersClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - * $operationResponse = $awsClustersClient->rollbackAwsNodePoolUpdate($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 = $awsClustersClient->rollbackAwsNodePoolUpdate($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'rollbackAwsNodePoolUpdate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to - * rollback. - * - * `AwsNodePool` names are formatted as - * `projects//locations//awsClusters//awsNodePools/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param array $optionalArgs { - * Optional. - * - * @type bool $respectPdb - * Optional. Option for rollback to ignore the PodDisruptionBudget when - * draining the node pool nodes. Default value is 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. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function rollbackAwsNodePoolUpdate($name, array $optionalArgs = []) - { - $request = new RollbackAwsNodePoolUpdateRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['respectPdb'])) { - $request->setRespectPdb($optionalArgs['respectPdb']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'RollbackAwsNodePoolUpdate', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates an [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $awsCluster = new AwsCluster(); - * $updateMask = new FieldMask(); - * $operationResponse = $awsClustersClient->updateAwsCluster($awsCluster, $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 = $awsClustersClient->updateAwsCluster($awsCluster, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'updateAwsCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param AwsCluster $awsCluster Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] - * resource to update. - * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]: - * - * * `description`. - * * `annotations`. - * * `control_plane.version`. - * * `authorization.admin_users`. - * * `authorization.admin_groups`. - * * `binary_authorization.evaluation_mode`. - * * `control_plane.aws_services_authentication.role_arn`. - * * `control_plane.aws_services_authentication.role_session_name`. - * * `control_plane.config_encryption.kms_key_arn`. - * * `control_plane.instance_type`. - * * `control_plane.security_group_ids`. - * * `control_plane.proxy_config`. - * * `control_plane.proxy_config.secret_arn`. - * * `control_plane.proxy_config.secret_version`. - * * `control_plane.root_volume.size_gib`. - * * `control_plane.root_volume.volume_type`. - * * `control_plane.root_volume.iops`. - * * `control_plane.root_volume.throughput`. - * * `control_plane.root_volume.kms_key_arn`. - * * `control_plane.ssh_config`. - * * `control_plane.ssh_config.ec2_key_pair`. - * * `control_plane.instance_placement.tenancy`. - * * `control_plane.iam_instance_profile`. - * * `logging_config.component_config.enable_components`. - * * `control_plane.tags`. - * * `monitoring_config.managed_prometheus_config.enabled`. - * * `networking.per_node_pool_sg_rules_disabled`. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually update the cluster. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateAwsCluster( - $awsCluster, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateAwsClusterRequest(); - $requestParamHeaders = []; - $request->setAwsCluster($awsCluster); - $request->setUpdateMask($updateMask); - $requestParamHeaders['aws_cluster.name'] = $awsCluster->getName(); - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateAwsCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates an [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]. - * - * Sample code: - * ``` - * $awsClustersClient = new AwsClustersClient(); - * try { - * $awsNodePool = new AwsNodePool(); - * $updateMask = new FieldMask(); - * $operationResponse = $awsClustersClient->updateAwsNodePool($awsNodePool, $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 = $awsClustersClient->updateAwsNodePool($awsNodePool, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'updateAwsNodePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $awsClustersClient->close(); - * } - * ``` - * - * @param AwsNodePool $awsNodePool Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] - * resource to update. - * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool]: - * - * * `annotations`. - * * `version`. - * * `autoscaling.min_node_count`. - * * `autoscaling.max_node_count`. - * * `config.config_encryption.kms_key_arn`. - * * `config.security_group_ids`. - * * `config.root_volume.iops`. - * * `config.root_volume.throughput`. - * * `config.root_volume.kms_key_arn`. - * * `config.root_volume.volume_type`. - * * `config.root_volume.size_gib`. - * * `config.proxy_config`. - * * `config.proxy_config.secret_arn`. - * * `config.proxy_config.secret_version`. - * * `config.ssh_config`. - * * `config.ssh_config.ec2_key_pair`. - * * `config.instance_placement.tenancy`. - * * `config.iam_instance_profile`. - * * `config.labels`. - * * `config.tags`. - * * `config.autoscaling_metrics_collection`. - * * `config.autoscaling_metrics_collection.granularity`. - * * `config.autoscaling_metrics_collection.metrics`. - * * `config.instance_type`. - * * `management.auto_repair`. - * * `management`. - * * `update_settings`. - * * `update_settings.surge_settings`. - * * `update_settings.surge_settings.max_surge`. - * * `update_settings.surge_settings.max_unavailable`. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but don't actually update the node pool. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateAwsNodePool( - $awsNodePool, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateAwsNodePoolRequest(); - $requestParamHeaders = []; - $request->setAwsNodePool($awsNodePool); - $request->setUpdateMask($updateMask); - $requestParamHeaders['aws_node_pool.name'] = $awsNodePool->getName(); - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateAwsNodePool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } -} diff --git a/GkeMultiCloud/src/V1/Gapic/AzureClustersGapicClient.php b/GkeMultiCloud/src/V1/Gapic/AzureClustersGapicClient.php deleted file mode 100644 index 2ae69c834eee..000000000000 --- a/GkeMultiCloud/src/V1/Gapic/AzureClustersGapicClient.php +++ /dev/null @@ -1,2140 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $azureClient = new AzureClient(); - * $azureClientId = 'azure_client_id'; - * $operationResponse = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId); - * $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 = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'createAzureClient'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $azureClustersClient->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\GkeMultiCloud\V1\Client\AzureClustersClient}. - */ -class AzureClustersGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.gkemulticloud.v1.AzureClusters'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'gkemulticloud.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'gkemulticloud.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 $azureClientNameTemplate; - - private static $azureClusterNameTemplate; - - private static $azureNodePoolNameTemplate; - - private static $azureServerConfigNameTemplate; - - 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/azure_clusters_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/azure_clusters_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/azure_clusters_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/azure_clusters_rest_client_config.php', - ], - ], - ]; - } - - private static function getAzureClientNameTemplate() - { - if (self::$azureClientNameTemplate == null) { - self::$azureClientNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/azureClients/{azure_client}' - ); - } - - return self::$azureClientNameTemplate; - } - - private static function getAzureClusterNameTemplate() - { - if (self::$azureClusterNameTemplate == null) { - self::$azureClusterNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}' - ); - } - - return self::$azureClusterNameTemplate; - } - - private static function getAzureNodePoolNameTemplate() - { - if (self::$azureNodePoolNameTemplate == null) { - self::$azureNodePoolNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}' - ); - } - - return self::$azureNodePoolNameTemplate; - } - - private static function getAzureServerConfigNameTemplate() - { - if (self::$azureServerConfigNameTemplate == null) { - self::$azureServerConfigNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/azureServerConfig' - ); - } - - return self::$azureServerConfigNameTemplate; - } - - 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 = [ - 'azureClient' => self::getAzureClientNameTemplate(), - 'azureCluster' => self::getAzureClusterNameTemplate(), - 'azureNodePool' => self::getAzureNodePoolNameTemplate(), - 'azureServerConfig' => self::getAzureServerConfigNameTemplate(), - 'location' => self::getLocationNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a azure_client - * resource. - * - * @param string $project - * @param string $location - * @param string $azureClient - * - * @return string The formatted azure_client resource. - */ - public static function azureClientName($project, $location, $azureClient) - { - return self::getAzureClientNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'azure_client' => $azureClient, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * azure_cluster resource. - * - * @param string $project - * @param string $location - * @param string $azureCluster - * - * @return string The formatted azure_cluster resource. - */ - public static function azureClusterName($project, $location, $azureCluster) - { - return self::getAzureClusterNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'azure_cluster' => $azureCluster, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * azure_node_pool resource. - * - * @param string $project - * @param string $location - * @param string $azureCluster - * @param string $azureNodePool - * - * @return string The formatted azure_node_pool resource. - */ - public static function azureNodePoolName( - $project, - $location, - $azureCluster, - $azureNodePool - ) { - return self::getAzureNodePoolNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'azure_cluster' => $azureCluster, - 'azure_node_pool' => $azureNodePool, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * azure_server_config resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted azure_server_config resource. - */ - public static function azureServerConfigName($project, $location) - { - return self::getAzureServerConfigNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * 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 - * - azureClient: projects/{project}/locations/{location}/azureClients/{azure_client} - * - azureCluster: projects/{project}/locations/{location}/azureClusters/{azure_cluster} - * - azureNodePool: projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool} - * - azureServerConfig: projects/{project}/locations/{location}/azureServerConfig - * - 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 'gkemulticloud.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 [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] - * resource on a given Google Cloud project and region. - * - * `AzureClient` resources hold client authentication - * information needed by the Anthos Multicloud API to manage Azure resources - * on your Azure subscription on your behalf. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedParent = $azureClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * $azureClient = new AzureClient(); - * $azureClientId = 'azure_client_id'; - * $operationResponse = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId); - * $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 = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'createAzureClient'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location where this - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be - * created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param AzureClient $azureClient Required. The specification of the - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to create. - * @param string $azureClientId Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name - * formatted as - * `projects//locations//azureClients/`. - * - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually create the client. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createAzureClient( - $parent, - $azureClient, - $azureClientId, - array $optionalArgs = [] - ) { - $request = new CreateAzureClientRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setAzureClient($azureClient); - $request->setAzureClientId($azureClientId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateAzureClient', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - * resource on a given Google Cloud Platform project and region. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedParent = $azureClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * $azureCluster = new AzureCluster(); - * $azureClusterId = 'azure_cluster_id'; - * $operationResponse = $azureClustersClient->createAzureCluster($formattedParent, $azureCluster, $azureClusterId); - * $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 = $azureClustersClient->createAzureCluster($formattedParent, $azureCluster, $azureClusterId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'createAzureCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location where this - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be - * created. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param AzureCluster $azureCluster Required. The specification of the - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to create. - * @param string $azureClusterId Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name - * formatted as - * `projects//locations//azureClusters/`. - * - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually create the cluster. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createAzureCluster( - $parent, - $azureCluster, - $azureClusterId, - array $optionalArgs = [] - ) { - $request = new CreateAzureClusterRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setAzureCluster($azureCluster); - $request->setAzureClusterId($azureClusterId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateAzureCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool], - * attached to a given - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedParent = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - * $azureNodePool = new AzureNodePool(); - * $azureNodePoolId = 'azure_node_pool_id'; - * $operationResponse = $azureClustersClient->createAzureNodePool($formattedParent, $azureNodePool, $azureNodePoolId); - * $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 = $azureClustersClient->createAzureNodePool($formattedParent, $azureNodePool, $azureNodePoolId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'createAzureNodePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - * resource where this node pool will be created. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param AzureNodePool $azureNodePool Required. The specification of the - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to create. - * @param string $azureNodePoolId Required. A client provided ID the resource. Must be unique within the - * parent resource. - * - * The provided ID will be part of the - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name - * formatted as - * `projects//locations//azureClusters//azureNodePools/`. - * - * Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually create the node - * pool. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createAzureNodePool( - $parent, - $azureNodePool, - $azureNodePoolId, - array $optionalArgs = [] - ) { - $request = new CreateAzureNodePoolRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setAzureNodePool($azureNodePool); - $request->setAzureNodePoolId($azureNodePoolId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateAzureNodePool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a specific [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] - * resource. - * - * If the client is used by one or more clusters, deletion will - * fail and a `FAILED_PRECONDITION` error will be returned. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedName = $azureClustersClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - * $operationResponse = $azureClustersClient->deleteAzureClient($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 = $azureClustersClient->deleteAzureClient($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'deleteAzureClient'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name the - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete. - * - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are - * formatted as - * `projects//locations//azureClients/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param array $optionalArgs { - * Optional. - * - * @type bool $allowMissing - * If set to true, and the - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed [Operation][google.longrunning.Operation] will be returned. - * - * Useful for idempotent deletion. - * @type bool $validateOnly - * If set, only validate the request, but do not actually delete the resource. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteAzureClient($name, array $optionalArgs = []) - { - $request = new DeleteAzureClientRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['allowMissing'])) { - $request->setAllowMissing($optionalArgs['allowMissing']); - } - - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteAzureClient', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a specific - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. - * - * Fails if the cluster has one or more associated - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedName = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - * $operationResponse = $azureClustersClient->deleteAzureCluster($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 = $azureClustersClient->deleteAzureCluster($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'deleteAzureCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name the - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @param array $optionalArgs { - * Optional. - * - * @type bool $allowMissing - * If set to true, and the - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource is not - * found, the request will succeed but no action will be taken on the server - * and a completed [Operation][google.longrunning.Operation] will be returned. - * - * Useful for idempotent deletion. - * @type bool $validateOnly - * If set, only validate the request, but do not actually delete the resource. - * @type string $etag - * The current etag of the - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided etag does not match the current etag of the cluster, - * the request will fail and an ABORTED error will be returned. - * @type bool $ignoreErrors - * Optional. If set to true, the deletion of - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will - * succeed even if errors occur during deleting in cluster resources. Using - * this parameter may result in orphaned resources in the cluster. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteAzureCluster($name, array $optionalArgs = []) - { - $request = new DeleteAzureClusterRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['allowMissing'])) { - $request->setAllowMissing($optionalArgs['allowMissing']); - } - - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - if (isset($optionalArgs['etag'])) { - $request->setEtag($optionalArgs['etag']); - } - - if (isset($optionalArgs['ignoreErrors'])) { - $request->setIgnoreErrors($optionalArgs['ignoreErrors']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteAzureCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a specific - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. - * - * If successful, the response contains a newly created - * [Operation][google.longrunning.Operation] resource that can be - * described to track the status of the operation. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedName = $azureClustersClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - * $operationResponse = $azureClustersClient->deleteAzureNodePool($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 = $azureClustersClient->deleteAzureNodePool($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'deleteAzureNodePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name the - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete. - * - * `AzureNodePool` names are formatted as - * `projects//locations//azureClusters//azureNodePools/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually delete the node - * pool. - * @type bool $allowMissing - * If set to true, and the - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource is - * not found, the request will succeed but no action will be taken on the - * server and a completed [Operation][google.longrunning.Operation] will be - * returned. - * - * Useful for idempotent deletion. - * @type string $etag - * The current ETag of the - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. - * - * Allows clients to perform deletions through optimistic concurrency control. - * - * If the provided ETag does not match the current etag of the node pool, - * the request will fail and an ABORTED error will be returned. - * @type bool $ignoreErrors - * Optional. If set to true, the deletion of - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource will - * succeed even if errors occur during deleting in node pool resources. Using - * this parameter may result in orphaned resources in the node pool. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteAzureNodePool($name, array $optionalArgs = []) - { - $request = new DeleteAzureNodePoolRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - if (isset($optionalArgs['allowMissing'])) { - $request->setAllowMissing($optionalArgs['allowMissing']); - } - - if (isset($optionalArgs['etag'])) { - $request->setEtag($optionalArgs['etag']); - } - - if (isset($optionalArgs['ignoreErrors'])) { - $request->setIgnoreErrors($optionalArgs['ignoreErrors']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteAzureNodePool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Generates a short-lived access token to authenticate to a given - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedAzureCluster = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - * $response = $azureClustersClient->generateAzureAccessToken($formattedAzureCluster); - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $azureCluster Required. The name of the - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to - * authenticate to. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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\GkeMultiCloud\V1\GenerateAzureAccessTokenResponse - * - * @throws ApiException if the remote call fails - */ - public function generateAzureAccessToken( - $azureCluster, - array $optionalArgs = [] - ) { - $request = new GenerateAzureAccessTokenRequest(); - $requestParamHeaders = []; - $request->setAzureCluster($azureCluster); - $requestParamHeaders['azure_cluster'] = $azureCluster; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GenerateAzureAccessToken', - GenerateAzureAccessTokenResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Generates an access token for a cluster agent. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedAzureCluster = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - * $subjectToken = 'subject_token'; - * $subjectTokenType = 'subject_token_type'; - * $version = 'version'; - * $response = $azureClustersClient->generateAzureClusterAgentToken($formattedAzureCluster, $subjectToken, $subjectTokenType, $version); - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $azureCluster Required. - * @param string $subjectToken Required. - * @param string $subjectTokenType Required. - * @param string $version Required. - * @param array $optionalArgs { - * Optional. - * - * @type string $nodePoolId - * Optional. - * @type string $grantType - * Optional. - * @type string $audience - * Optional. - * @type string $scope - * Optional. - * @type string $requestedTokenType - * Optional. - * @type string $options - * 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\GkeMultiCloud\V1\GenerateAzureClusterAgentTokenResponse - * - * @throws ApiException if the remote call fails - */ - public function generateAzureClusterAgentToken( - $azureCluster, - $subjectToken, - $subjectTokenType, - $version, - array $optionalArgs = [] - ) { - $request = new GenerateAzureClusterAgentTokenRequest(); - $requestParamHeaders = []; - $request->setAzureCluster($azureCluster); - $request->setSubjectToken($subjectToken); - $request->setSubjectTokenType($subjectTokenType); - $request->setVersion($version); - $requestParamHeaders['azure_cluster'] = $azureCluster; - if (isset($optionalArgs['nodePoolId'])) { - $request->setNodePoolId($optionalArgs['nodePoolId']); - } - - if (isset($optionalArgs['grantType'])) { - $request->setGrantType($optionalArgs['grantType']); - } - - if (isset($optionalArgs['audience'])) { - $request->setAudience($optionalArgs['audience']); - } - - if (isset($optionalArgs['scope'])) { - $request->setScope($optionalArgs['scope']); - } - - if (isset($optionalArgs['requestedTokenType'])) { - $request->setRequestedTokenType( - $optionalArgs['requestedTokenType'] - ); - } - - 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( - 'GenerateAzureClusterAgentToken', - GenerateAzureClusterAgentTokenResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Describes a specific - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedName = $azureClustersClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - * $response = $azureClustersClient->getAzureClient($formattedName); - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to - * describe. - * - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are - * formatted as - * `projects//locations//azureClients/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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\GkeMultiCloud\V1\AzureClient - * - * @throws ApiException if the remote call fails - */ - public function getAzureClient($name, array $optionalArgs = []) - { - $request = new GetAzureClientRequest(); - $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( - 'GetAzureClient', - AzureClient::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Describes a specific - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedName = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - * $response = $azureClustersClient->getAzureCluster($formattedName); - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to - * describe. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @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\GkeMultiCloud\V1\AzureCluster - * - * @throws ApiException if the remote call fails - */ - public function getAzureCluster($name, array $optionalArgs = []) - { - $request = new GetAzureClusterRequest(); - $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( - 'GetAzureCluster', - AzureCluster::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets the public component of the cluster signing keys in - * JSON Web Key format. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedAzureCluster = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - * $response = $azureClustersClient->getAzureJsonWebKeys($formattedAzureCluster); - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $azureCluster Required. The AzureCluster, which owns the JsonWebKeys. - * Format: - * `projects//locations//azureClusters/` - * @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\GkeMultiCloud\V1\AzureJsonWebKeys - * - * @throws ApiException if the remote call fails - */ - public function getAzureJsonWebKeys($azureCluster, array $optionalArgs = []) - { - $request = new GetAzureJsonWebKeysRequest(); - $requestParamHeaders = []; - $request->setAzureCluster($azureCluster); - $requestParamHeaders['azure_cluster'] = $azureCluster; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetAzureJsonWebKeys', - AzureJsonWebKeys::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Describes a specific - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedName = $azureClustersClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - * $response = $azureClustersClient->getAzureNodePool($formattedName); - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to - * describe. - * - * `AzureNodePool` names are formatted as - * `projects//locations//azureClusters//azureNodePools/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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\GkeMultiCloud\V1\AzureNodePool - * - * @throws ApiException if the remote call fails - */ - public function getAzureNodePool($name, array $optionalArgs = []) - { - $request = new GetAzureNodePoolRequest(); - $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( - 'GetAzureNodePool', - AzureNodePool::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets the OIDC discovery document for the cluster. - * See the - * [OpenID Connect Discovery 1.0 - * specification](https://openid.net/specs/openid-connect-discovery-1_0.html) - * for details. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedAzureCluster = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - * $response = $azureClustersClient->getAzureOpenIdConfig($formattedAzureCluster); - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $azureCluster Required. The AzureCluster, which owns the OIDC discovery document. - * Format: - * projects//locations//azureClusters/ - * @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\GkeMultiCloud\V1\AzureOpenIdConfig - * - * @throws ApiException if the remote call fails - */ - public function getAzureOpenIdConfig( - $azureCluster, - array $optionalArgs = [] - ) { - $request = new GetAzureOpenIdConfigRequest(); - $requestParamHeaders = []; - $request->setAzureCluster($azureCluster); - $requestParamHeaders['azure_cluster'] = $azureCluster; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetAzureOpenIdConfig', - AzureOpenIdConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns information, such as supported Azure regions and Kubernetes - * versions, on a given Google Cloud location. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedName = $azureClustersClient->azureServerConfigName('[PROJECT]', '[LOCATION]'); - * $response = $azureClustersClient->getAzureServerConfig($formattedName); - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the - * [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig] - * resource to describe. - * - * `AzureServerConfig` names are formatted as - * `projects//locations//azureServerConfig`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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\GkeMultiCloud\V1\AzureServerConfig - * - * @throws ApiException if the remote call fails - */ - public function getAzureServerConfig($name, array $optionalArgs = []) - { - $request = new GetAzureServerConfigRequest(); - $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( - 'GetAzureServerConfig', - AzureServerConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists all [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] - * resources on a given Google Cloud project and region. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedParent = $azureClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $azureClustersClient->listAzureClients($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $azureClustersClient->listAzureClients($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location which owns this collection of - * [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @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 listAzureClients($parent, array $optionalArgs = []) - { - $request = new ListAzureClientsRequest(); - $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( - 'ListAzureClients', - $optionalArgs, - ListAzureClientsResponse::class, - $request - ); - } - - /** - * Lists all [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - * resources on a given Google Cloud project and region. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedParent = $azureClustersClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $azureClustersClient->listAzureClusters($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $azureClustersClient->listAzureClusters($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location which owns this collection of - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources. - * - * Location names are formatted as `projects//locations/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud Platform resource names. - * @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 listAzureClusters($parent, array $optionalArgs = []) - { - $request = new ListAzureClustersRequest(); - $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( - 'ListAzureClusters', - $optionalArgs, - ListAzureClustersResponse::class, - $request - ); - } - - /** - * Lists all [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] - * resources on a given - * [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $formattedParent = $azureClustersClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - * // Iterate over pages of elements - * $pagedResponse = $azureClustersClient->listAzureNodePools($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $azureClustersClient->listAzureNodePools($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent `AzureCluster` which owns this collection of - * [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources. - * - * `AzureCluster` names are formatted as - * `projects//locations//azureClusters/`. - * - * See [Resource Names](https://cloud.google.com/apis/design/resource_names) - * for more details on Google Cloud resource names. - * @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 listAzureNodePools($parent, array $optionalArgs = []) - { - $request = new ListAzureNodePoolsRequest(); - $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( - 'ListAzureNodePools', - $optionalArgs, - ListAzureNodePoolsResponse::class, - $request - ); - } - - /** - * Updates an [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $azureCluster = new AzureCluster(); - * $updateMask = new FieldMask(); - * $operationResponse = $azureClustersClient->updateAzureCluster($azureCluster, $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 = $azureClustersClient->updateAzureCluster($azureCluster, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'updateAzureCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param AzureCluster $azureCluster Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] - * resource to update. - * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]: - * - * * `description`. - * * `azureClient`. - * * `control_plane.version`. - * * `control_plane.vm_size`. - * * `annotations`. - * * `authorization.admin_users`. - * * `authorization.admin_groups`. - * * `control_plane.root_volume.size_gib`. - * * `azure_services_authentication`. - * * `azure_services_authentication.tenant_id`. - * * `azure_services_authentication.application_id`. - * * `control_plane.proxy_config`. - * * `control_plane.proxy_config.resource_group_id`. - * * `control_plane.proxy_config.secret_id`. - * * `control_plane.ssh_config.authorized_key`. - * * `logging_config.component_config.enable_components` - * * `monitoring_config.managed_prometheus_config.enabled`. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but do not actually update the cluster. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateAzureCluster( - $azureCluster, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateAzureClusterRequest(); - $requestParamHeaders = []; - $request->setAzureCluster($azureCluster); - $request->setUpdateMask($updateMask); - $requestParamHeaders['azure_cluster.name'] = $azureCluster->getName(); - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateAzureCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates an [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]. - * - * Sample code: - * ``` - * $azureClustersClient = new AzureClustersClient(); - * try { - * $azureNodePool = new AzureNodePool(); - * $updateMask = new FieldMask(); - * $operationResponse = $azureClustersClient->updateAzureNodePool($azureNodePool, $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 = $azureClustersClient->updateAzureNodePool($azureNodePool, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'updateAzureNodePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $azureClustersClient->close(); - * } - * ``` - * - * @param AzureNodePool $azureNodePool Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] - * resource to update. - * @param FieldMask $updateMask Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field can only include these - * fields from [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool]: - * - * *. `annotations`. - * * `version`. - * * `autoscaling.min_node_count`. - * * `autoscaling.max_node_count`. - * * `config.ssh_config.authorized_key`. - * * `management.auto_repair`. - * * `management`. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If set, only validate the request, but don't actually update the node pool. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateAzureNodePool( - $azureNodePool, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateAzureNodePoolRequest(); - $requestParamHeaders = []; - $request->setAzureNodePool($azureNodePool); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'azure_node_pool.name' - ] = $azureNodePool->getName(); - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateAzureNodePool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } -} diff --git a/GkeMultiCloud/src/V1/GenerateAttachedClusterAgentTokenRequest.php b/GkeMultiCloud/src/V1/GenerateAttachedClusterAgentTokenRequest.php index fde47479c79c..121afc3898f2 100644 --- a/GkeMultiCloud/src/V1/GenerateAttachedClusterAgentTokenRequest.php +++ b/GkeMultiCloud/src/V1/GenerateAttachedClusterAgentTokenRequest.php @@ -18,55 +18,55 @@ class GenerateAttachedClusterAgentTokenRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string attached_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $attached_cluster = ''; + protected $attached_cluster = ''; /** * Required. * * Generated from protobuf field string subject_token = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $subject_token = ''; + protected $subject_token = ''; /** * Required. * * Generated from protobuf field string subject_token_type = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $subject_token_type = ''; + protected $subject_token_type = ''; /** * Required. * * Generated from protobuf field string version = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $version = ''; + protected $version = ''; /** * Optional. * * Generated from protobuf field string grant_type = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $grant_type = ''; + protected $grant_type = ''; /** * Optional. * * Generated from protobuf field string audience = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $audience = ''; + protected $audience = ''; /** * Optional. * * Generated from protobuf field string scope = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $scope = ''; + protected $scope = ''; /** * Optional. * * Generated from protobuf field string requested_token_type = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $requested_token_type = ''; + protected $requested_token_type = ''; /** * Optional. * * Generated from protobuf field string options = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $options = ''; + protected $options = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAttachedClusterAgentTokenResponse.php b/GkeMultiCloud/src/V1/GenerateAttachedClusterAgentTokenResponse.php index 30b9d51af243..913a5f2ab892 100644 --- a/GkeMultiCloud/src/V1/GenerateAttachedClusterAgentTokenResponse.php +++ b/GkeMultiCloud/src/V1/GenerateAttachedClusterAgentTokenResponse.php @@ -16,15 +16,15 @@ class GenerateAttachedClusterAgentTokenResponse extends \Google\Protobuf\Interna /** * Generated from protobuf field string access_token = 1; */ - private $access_token = ''; + protected $access_token = ''; /** * Generated from protobuf field int32 expires_in = 2; */ - private $expires_in = 0; + protected $expires_in = 0; /** * Generated from protobuf field string token_type = 3; */ - private $token_type = ''; + protected $token_type = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAttachedClusterInstallManifestRequest.php b/GkeMultiCloud/src/V1/GenerateAttachedClusterInstallManifestRequest.php index 37124a28c892..b3000ce01b1b 100644 --- a/GkeMultiCloud/src/V1/GenerateAttachedClusterInstallManifestRequest.php +++ b/GkeMultiCloud/src/V1/GenerateAttachedClusterInstallManifestRequest.php @@ -26,7 +26,7 @@ class GenerateAttachedClusterInstallManifestRequest extends \Google\Protobuf\Int * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. A client provided ID of the resource. Must be unique within the * parent resource. @@ -42,7 +42,7 @@ class GenerateAttachedClusterInstallManifestRequest extends \Google\Protobuf\Int * * Generated from protobuf field string attached_cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $attached_cluster_id = ''; + protected $attached_cluster_id = ''; /** * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). * You can list all supported versions on a given Google Cloud region by @@ -51,13 +51,13 @@ class GenerateAttachedClusterInstallManifestRequest extends \Google\Protobuf\Int * * Generated from protobuf field string platform_version = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $platform_version = ''; + protected $platform_version = ''; /** * Optional. Proxy configuration for outbound HTTP(S) traffic. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedProxyConfig proxy_config = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $proxy_config = null; + protected $proxy_config = null; /** * @param string $parent Required. The parent location where this diff --git a/GkeMultiCloud/src/V1/GenerateAttachedClusterInstallManifestResponse.php b/GkeMultiCloud/src/V1/GenerateAttachedClusterInstallManifestResponse.php index 45932b34d98f..558f3fe1e5d2 100644 --- a/GkeMultiCloud/src/V1/GenerateAttachedClusterInstallManifestResponse.php +++ b/GkeMultiCloud/src/V1/GenerateAttachedClusterInstallManifestResponse.php @@ -22,7 +22,7 @@ class GenerateAttachedClusterInstallManifestResponse extends \Google\Protobuf\In * * Generated from protobuf field string manifest = 1; */ - private $manifest = ''; + protected $manifest = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAwsAccessTokenRequest.php b/GkeMultiCloud/src/V1/GenerateAwsAccessTokenRequest.php index 0f02d7f840bd..d3d109e81257 100644 --- a/GkeMultiCloud/src/V1/GenerateAwsAccessTokenRequest.php +++ b/GkeMultiCloud/src/V1/GenerateAwsAccessTokenRequest.php @@ -26,7 +26,7 @@ class GenerateAwsAccessTokenRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $aws_cluster = ''; + protected $aws_cluster = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAwsAccessTokenResponse.php b/GkeMultiCloud/src/V1/GenerateAwsAccessTokenResponse.php index e0496ce4faa4..35f1695ffc34 100644 --- a/GkeMultiCloud/src/V1/GenerateAwsAccessTokenResponse.php +++ b/GkeMultiCloud/src/V1/GenerateAwsAccessTokenResponse.php @@ -20,13 +20,13 @@ class GenerateAwsAccessTokenResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string access_token = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $access_token = ''; + protected $access_token = ''; /** * Output only. Timestamp at which the token will expire. * * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $expiration_time = null; + protected $expiration_time = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAwsClusterAgentTokenRequest.php b/GkeMultiCloud/src/V1/GenerateAwsClusterAgentTokenRequest.php index 2f6c3265b9af..16461659a451 100644 --- a/GkeMultiCloud/src/V1/GenerateAwsClusterAgentTokenRequest.php +++ b/GkeMultiCloud/src/V1/GenerateAwsClusterAgentTokenRequest.php @@ -18,61 +18,61 @@ class GenerateAwsClusterAgentTokenRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $aws_cluster = ''; + protected $aws_cluster = ''; /** * Required. * * Generated from protobuf field string subject_token = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $subject_token = ''; + protected $subject_token = ''; /** * Required. * * Generated from protobuf field string subject_token_type = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $subject_token_type = ''; + protected $subject_token_type = ''; /** * Required. * * Generated from protobuf field string version = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $version = ''; + protected $version = ''; /** * Optional. * * Generated from protobuf field string node_pool_id = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $node_pool_id = ''; + protected $node_pool_id = ''; /** * Optional. * * Generated from protobuf field string grant_type = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $grant_type = ''; + protected $grant_type = ''; /** * Optional. * * Generated from protobuf field string audience = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $audience = ''; + protected $audience = ''; /** * Optional. * * Generated from protobuf field string scope = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $scope = ''; + protected $scope = ''; /** * Optional. * * Generated from protobuf field string requested_token_type = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $requested_token_type = ''; + protected $requested_token_type = ''; /** * Optional. * * Generated from protobuf field string options = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $options = ''; + protected $options = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAwsClusterAgentTokenResponse.php b/GkeMultiCloud/src/V1/GenerateAwsClusterAgentTokenResponse.php index 926e327afd26..0a5d0bafb1b3 100644 --- a/GkeMultiCloud/src/V1/GenerateAwsClusterAgentTokenResponse.php +++ b/GkeMultiCloud/src/V1/GenerateAwsClusterAgentTokenResponse.php @@ -16,15 +16,15 @@ class GenerateAwsClusterAgentTokenResponse extends \Google\Protobuf\Internal\Mes /** * Generated from protobuf field string access_token = 1; */ - private $access_token = ''; + protected $access_token = ''; /** * Generated from protobuf field int32 expires_in = 2; */ - private $expires_in = 0; + protected $expires_in = 0; /** * Generated from protobuf field string token_type = 3; */ - private $token_type = ''; + protected $token_type = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAzureAccessTokenRequest.php b/GkeMultiCloud/src/V1/GenerateAzureAccessTokenRequest.php index dfcb60d9816a..f189dbc3a504 100644 --- a/GkeMultiCloud/src/V1/GenerateAzureAccessTokenRequest.php +++ b/GkeMultiCloud/src/V1/GenerateAzureAccessTokenRequest.php @@ -26,7 +26,7 @@ class GenerateAzureAccessTokenRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $azure_cluster = ''; + protected $azure_cluster = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAzureAccessTokenResponse.php b/GkeMultiCloud/src/V1/GenerateAzureAccessTokenResponse.php index f470eb40aaff..4371394919c5 100644 --- a/GkeMultiCloud/src/V1/GenerateAzureAccessTokenResponse.php +++ b/GkeMultiCloud/src/V1/GenerateAzureAccessTokenResponse.php @@ -20,13 +20,13 @@ class GenerateAzureAccessTokenResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string access_token = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $access_token = ''; + protected $access_token = ''; /** * Output only. Timestamp at which the token will expire. * * Generated from protobuf field .google.protobuf.Timestamp expiration_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $expiration_time = null; + protected $expiration_time = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAzureClusterAgentTokenRequest.php b/GkeMultiCloud/src/V1/GenerateAzureClusterAgentTokenRequest.php index 74b1ffe3ecbe..d19114785203 100644 --- a/GkeMultiCloud/src/V1/GenerateAzureClusterAgentTokenRequest.php +++ b/GkeMultiCloud/src/V1/GenerateAzureClusterAgentTokenRequest.php @@ -18,61 +18,61 @@ class GenerateAzureClusterAgentTokenRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $azure_cluster = ''; + protected $azure_cluster = ''; /** * Required. * * Generated from protobuf field string subject_token = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $subject_token = ''; + protected $subject_token = ''; /** * Required. * * Generated from protobuf field string subject_token_type = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $subject_token_type = ''; + protected $subject_token_type = ''; /** * Required. * * Generated from protobuf field string version = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $version = ''; + protected $version = ''; /** * Optional. * * Generated from protobuf field string node_pool_id = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $node_pool_id = ''; + protected $node_pool_id = ''; /** * Optional. * * Generated from protobuf field string grant_type = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $grant_type = ''; + protected $grant_type = ''; /** * Optional. * * Generated from protobuf field string audience = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $audience = ''; + protected $audience = ''; /** * Optional. * * Generated from protobuf field string scope = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $scope = ''; + protected $scope = ''; /** * Optional. * * Generated from protobuf field string requested_token_type = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $requested_token_type = ''; + protected $requested_token_type = ''; /** * Optional. * * Generated from protobuf field string options = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $options = ''; + protected $options = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GenerateAzureClusterAgentTokenResponse.php b/GkeMultiCloud/src/V1/GenerateAzureClusterAgentTokenResponse.php index a2a9e7c343ae..beb176c6239a 100644 --- a/GkeMultiCloud/src/V1/GenerateAzureClusterAgentTokenResponse.php +++ b/GkeMultiCloud/src/V1/GenerateAzureClusterAgentTokenResponse.php @@ -16,15 +16,15 @@ class GenerateAzureClusterAgentTokenResponse extends \Google\Protobuf\Internal\M /** * Generated from protobuf field string access_token = 1; */ - private $access_token = ''; + protected $access_token = ''; /** * Generated from protobuf field int32 expires_in = 2; */ - private $expires_in = 0; + protected $expires_in = 0; /** * Generated from protobuf field string token_type = 3; */ - private $token_type = ''; + protected $token_type = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GetAttachedClusterRequest.php b/GkeMultiCloud/src/V1/GetAttachedClusterRequest.php index cc6b0532a72c..b5da37d6fa0a 100644 --- a/GkeMultiCloud/src/V1/GetAttachedClusterRequest.php +++ b/GkeMultiCloud/src/V1/GetAttachedClusterRequest.php @@ -26,7 +26,7 @@ class GetAttachedClusterRequest 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 diff --git a/GkeMultiCloud/src/V1/GetAttachedServerConfigRequest.php b/GkeMultiCloud/src/V1/GetAttachedServerConfigRequest.php index 1513a1dd1087..f2ed61ae77c5 100644 --- a/GkeMultiCloud/src/V1/GetAttachedServerConfigRequest.php +++ b/GkeMultiCloud/src/V1/GetAttachedServerConfigRequest.php @@ -27,7 +27,7 @@ class GetAttachedServerConfigRequest 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 diff --git a/GkeMultiCloud/src/V1/GetAwsClusterRequest.php b/GkeMultiCloud/src/V1/GetAwsClusterRequest.php index 0ffbc250e084..1a522d11bbb5 100644 --- a/GkeMultiCloud/src/V1/GetAwsClusterRequest.php +++ b/GkeMultiCloud/src/V1/GetAwsClusterRequest.php @@ -26,7 +26,7 @@ class GetAwsClusterRequest 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 diff --git a/GkeMultiCloud/src/V1/GetAwsJsonWebKeysRequest.php b/GkeMultiCloud/src/V1/GetAwsJsonWebKeysRequest.php index 1949aa15a6d8..7e334e021db1 100644 --- a/GkeMultiCloud/src/V1/GetAwsJsonWebKeysRequest.php +++ b/GkeMultiCloud/src/V1/GetAwsJsonWebKeysRequest.php @@ -25,7 +25,7 @@ class GetAwsJsonWebKeysRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $aws_cluster = ''; + protected $aws_cluster = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GetAwsNodePoolRequest.php b/GkeMultiCloud/src/V1/GetAwsNodePoolRequest.php index 3ba8153490bf..549d270d9f3e 100644 --- a/GkeMultiCloud/src/V1/GetAwsNodePoolRequest.php +++ b/GkeMultiCloud/src/V1/GetAwsNodePoolRequest.php @@ -26,7 +26,7 @@ class GetAwsNodePoolRequest 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 diff --git a/GkeMultiCloud/src/V1/GetAwsOpenIdConfigRequest.php b/GkeMultiCloud/src/V1/GetAwsOpenIdConfigRequest.php index 34bedc89feb3..e1e5b395ff9f 100644 --- a/GkeMultiCloud/src/V1/GetAwsOpenIdConfigRequest.php +++ b/GkeMultiCloud/src/V1/GetAwsOpenIdConfigRequest.php @@ -23,7 +23,7 @@ class GetAwsOpenIdConfigRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $aws_cluster = ''; + protected $aws_cluster = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/GetAwsServerConfigRequest.php b/GkeMultiCloud/src/V1/GetAwsServerConfigRequest.php index b7eff6dbf2dc..fe925dd0cc05 100644 --- a/GkeMultiCloud/src/V1/GetAwsServerConfigRequest.php +++ b/GkeMultiCloud/src/V1/GetAwsServerConfigRequest.php @@ -26,7 +26,7 @@ class GetAwsServerConfigRequest 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 diff --git a/GkeMultiCloud/src/V1/GetAzureClientRequest.php b/GkeMultiCloud/src/V1/GetAzureClientRequest.php index 1cff6d467ea8..ce520b46f6bd 100644 --- a/GkeMultiCloud/src/V1/GetAzureClientRequest.php +++ b/GkeMultiCloud/src/V1/GetAzureClientRequest.php @@ -27,7 +27,7 @@ class GetAzureClientRequest 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 diff --git a/GkeMultiCloud/src/V1/GetAzureClusterRequest.php b/GkeMultiCloud/src/V1/GetAzureClusterRequest.php index 156772580440..c0403c71bf54 100644 --- a/GkeMultiCloud/src/V1/GetAzureClusterRequest.php +++ b/GkeMultiCloud/src/V1/GetAzureClusterRequest.php @@ -26,7 +26,7 @@ class GetAzureClusterRequest 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 diff --git a/GkeMultiCloud/src/V1/GetAzureJsonWebKeysRequest.php b/GkeMultiCloud/src/V1/GetAzureJsonWebKeysRequest.php index 175b70d5b9a3..75a740ad73d9 100644 --- a/GkeMultiCloud/src/V1/GetAzureJsonWebKeysRequest.php +++ b/GkeMultiCloud/src/V1/GetAzureJsonWebKeysRequest.php @@ -25,7 +25,7 @@ class GetAzureJsonWebKeysRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $azure_cluster = ''; + protected $azure_cluster = ''; /** * @param string $azureCluster Required. The AzureCluster, which owns the JsonWebKeys. diff --git a/GkeMultiCloud/src/V1/GetAzureNodePoolRequest.php b/GkeMultiCloud/src/V1/GetAzureNodePoolRequest.php index 8f406b4d7358..d491eade7bca 100644 --- a/GkeMultiCloud/src/V1/GetAzureNodePoolRequest.php +++ b/GkeMultiCloud/src/V1/GetAzureNodePoolRequest.php @@ -26,7 +26,7 @@ class GetAzureNodePoolRequest 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 diff --git a/GkeMultiCloud/src/V1/GetAzureOpenIdConfigRequest.php b/GkeMultiCloud/src/V1/GetAzureOpenIdConfigRequest.php index 9aa781d844be..bb7336cfb5ff 100644 --- a/GkeMultiCloud/src/V1/GetAzureOpenIdConfigRequest.php +++ b/GkeMultiCloud/src/V1/GetAzureOpenIdConfigRequest.php @@ -23,7 +23,7 @@ class GetAzureOpenIdConfigRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $azure_cluster = ''; + protected $azure_cluster = ''; /** * @param string $azureCluster Required. The AzureCluster, which owns the OIDC discovery document. diff --git a/GkeMultiCloud/src/V1/GetAzureServerConfigRequest.php b/GkeMultiCloud/src/V1/GetAzureServerConfigRequest.php index 719887b2e9a5..933aca070c01 100644 --- a/GkeMultiCloud/src/V1/GetAzureServerConfigRequest.php +++ b/GkeMultiCloud/src/V1/GetAzureServerConfigRequest.php @@ -26,7 +26,7 @@ class GetAzureServerConfigRequest 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 diff --git a/GkeMultiCloud/src/V1/ImportAttachedClusterRequest.php b/GkeMultiCloud/src/V1/ImportAttachedClusterRequest.php index af0c7083c3ad..2402fd36bcbb 100644 --- a/GkeMultiCloud/src/V1/ImportAttachedClusterRequest.php +++ b/GkeMultiCloud/src/V1/ImportAttachedClusterRequest.php @@ -25,19 +25,19 @@ class ImportAttachedClusterRequest 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 = ''; /** * If set, only validate the request, but do not actually import the cluster. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * Required. The name of the fleet membership resource to import. * * Generated from protobuf field string fleet_membership = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $fleet_membership = ''; + protected $fleet_membership = ''; /** * Required. The platform version for the cluster (e.g. `1.19.0-gke.1000`). * You can list all supported versions on a given Google Cloud region by @@ -46,20 +46,20 @@ class ImportAttachedClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string platform_version = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $platform_version = ''; + protected $platform_version = ''; /** * Required. The Kubernetes distribution of the underlying attached cluster. * Supported values: ["eks", "aks"]. * * Generated from protobuf field string distribution = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $distribution = ''; + protected $distribution = ''; /** * Optional. Proxy configuration for outbound HTTP(S) traffic. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedProxyConfig proxy_config = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $proxy_config = null; + protected $proxy_config = null; /** * @param string $parent Required. The parent location where this diff --git a/GkeMultiCloud/src/V1/Jwk.php b/GkeMultiCloud/src/V1/Jwk.php index f89b16b53100..b1c701bfc4c4 100644 --- a/GkeMultiCloud/src/V1/Jwk.php +++ b/GkeMultiCloud/src/V1/Jwk.php @@ -20,55 +20,55 @@ class Jwk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string kty = 1; */ - private $kty = ''; + protected $kty = ''; /** * Algorithm. * * Generated from protobuf field string alg = 2; */ - private $alg = ''; + protected $alg = ''; /** * Permitted uses for the public keys. * * Generated from protobuf field string use = 3; */ - private $use = ''; + protected $use = ''; /** * Key ID. * * Generated from protobuf field string kid = 4; */ - private $kid = ''; + protected $kid = ''; /** * Used for RSA keys. * * Generated from protobuf field string n = 5; */ - private $n = ''; + protected $n = ''; /** * Used for RSA keys. * * Generated from protobuf field string e = 6; */ - private $e = ''; + protected $e = ''; /** * Used for ECDSA keys. * * Generated from protobuf field string x = 7; */ - private $x = ''; + protected $x = ''; /** * Used for ECDSA keys. * * Generated from protobuf field string y = 8; */ - private $y = ''; + protected $y = ''; /** * Used for ECDSA keys. * * Generated from protobuf field string crv = 9; */ - private $crv = ''; + protected $crv = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/KubernetesSecret.php b/GkeMultiCloud/src/V1/KubernetesSecret.php index ebf9f12020f9..48dc2a01caff 100644 --- a/GkeMultiCloud/src/V1/KubernetesSecret.php +++ b/GkeMultiCloud/src/V1/KubernetesSecret.php @@ -20,13 +20,13 @@ class KubernetesSecret extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Namespace in which the kubernetes secret is stored. * * Generated from protobuf field string namespace = 2; */ - private $namespace = ''; + protected $namespace = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/ListAttachedClustersRequest.php b/GkeMultiCloud/src/V1/ListAttachedClustersRequest.php index 55aa669845b4..dbf9477b5b25 100644 --- a/GkeMultiCloud/src/V1/ListAttachedClustersRequest.php +++ b/GkeMultiCloud/src/V1/ListAttachedClustersRequest.php @@ -24,7 +24,7 @@ class ListAttachedClustersRequest 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 items to return. * If not specified, a default value of 50 will be used by the service. @@ -35,7 +35,7 @@ class ListAttachedClustersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The `nextPageToken` value returned from a previous * [attachedClusters.list][google.cloud.gkemulticloud.v1.AttachedClusters.ListAttachedClusters] @@ -43,7 +43,7 @@ class ListAttachedClustersRequest extends \Google\Protobuf\Internal\Message * * 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/GkeMultiCloud/src/V1/ListAttachedClustersResponse.php b/GkeMultiCloud/src/V1/ListAttachedClustersResponse.php index c7cce4a8e6ac..1252498f6346 100644 --- a/GkeMultiCloud/src/V1/ListAttachedClustersResponse.php +++ b/GkeMultiCloud/src/V1/ListAttachedClustersResponse.php @@ -28,7 +28,7 @@ class ListAttachedClustersResponse 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/GkeMultiCloud/src/V1/ListAwsClustersRequest.php b/GkeMultiCloud/src/V1/ListAwsClustersRequest.php index 0333c6b08863..cabd399a840b 100644 --- a/GkeMultiCloud/src/V1/ListAwsClustersRequest.php +++ b/GkeMultiCloud/src/V1/ListAwsClustersRequest.php @@ -24,7 +24,7 @@ class ListAwsClustersRequest 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 items to return. * If not specified, a default value of 50 will be used by the service. @@ -35,7 +35,7 @@ class ListAwsClustersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The `nextPageToken` value returned from a previous * [awsClusters.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsClusters] @@ -43,7 +43,7 @@ class ListAwsClustersRequest extends \Google\Protobuf\Internal\Message * * 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/GkeMultiCloud/src/V1/ListAwsClustersResponse.php b/GkeMultiCloud/src/V1/ListAwsClustersResponse.php index afc93508c76e..cf2c1a17dca9 100644 --- a/GkeMultiCloud/src/V1/ListAwsClustersResponse.php +++ b/GkeMultiCloud/src/V1/ListAwsClustersResponse.php @@ -28,7 +28,7 @@ class ListAwsClustersResponse 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/GkeMultiCloud/src/V1/ListAwsNodePoolsRequest.php b/GkeMultiCloud/src/V1/ListAwsNodePoolsRequest.php index a2613f9a2e82..ec512d71b6af 100644 --- a/GkeMultiCloud/src/V1/ListAwsNodePoolsRequest.php +++ b/GkeMultiCloud/src/V1/ListAwsNodePoolsRequest.php @@ -25,7 +25,7 @@ class ListAwsNodePoolsRequest 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 items to return. * If not specified, a default value of 50 will be used by the service. @@ -36,7 +36,7 @@ class ListAwsNodePoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The `nextPageToken` value returned from a previous * [awsNodePools.list][google.cloud.gkemulticloud.v1.AwsClusters.ListAwsNodePools] @@ -44,7 +44,7 @@ class ListAwsNodePoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The parent `AwsCluster` which owns this collection of diff --git a/GkeMultiCloud/src/V1/ListAwsNodePoolsResponse.php b/GkeMultiCloud/src/V1/ListAwsNodePoolsResponse.php index 446a5a397710..e6a681467d5a 100644 --- a/GkeMultiCloud/src/V1/ListAwsNodePoolsResponse.php +++ b/GkeMultiCloud/src/V1/ListAwsNodePoolsResponse.php @@ -28,7 +28,7 @@ class ListAwsNodePoolsResponse 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/GkeMultiCloud/src/V1/ListAzureClientsRequest.php b/GkeMultiCloud/src/V1/ListAzureClientsRequest.php index 55271adcd723..721195797caf 100644 --- a/GkeMultiCloud/src/V1/ListAzureClientsRequest.php +++ b/GkeMultiCloud/src/V1/ListAzureClientsRequest.php @@ -24,7 +24,7 @@ class ListAzureClientsRequest 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 items to return. * If not specified, a default value of 50 will be used by the service. @@ -35,7 +35,7 @@ class ListAzureClientsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The `nextPageToken` value returned from a previous * [azureClients.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClients] @@ -43,7 +43,7 @@ class ListAzureClientsRequest extends \Google\Protobuf\Internal\Message * * 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/GkeMultiCloud/src/V1/ListAzureClientsResponse.php b/GkeMultiCloud/src/V1/ListAzureClientsResponse.php index a88567069e3c..6ec3fccc2c48 100644 --- a/GkeMultiCloud/src/V1/ListAzureClientsResponse.php +++ b/GkeMultiCloud/src/V1/ListAzureClientsResponse.php @@ -28,7 +28,7 @@ class ListAzureClientsResponse 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/GkeMultiCloud/src/V1/ListAzureClustersRequest.php b/GkeMultiCloud/src/V1/ListAzureClustersRequest.php index fd27ca16f6bf..c8d3b2bc6110 100644 --- a/GkeMultiCloud/src/V1/ListAzureClustersRequest.php +++ b/GkeMultiCloud/src/V1/ListAzureClustersRequest.php @@ -24,7 +24,7 @@ class ListAzureClustersRequest 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 items to return. * If not specified, a default value of 50 will be used by the service. @@ -35,7 +35,7 @@ class ListAzureClustersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The `nextPageToken` value returned from a previous * [azureClusters.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureClusters] @@ -43,7 +43,7 @@ class ListAzureClustersRequest extends \Google\Protobuf\Internal\Message * * 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/GkeMultiCloud/src/V1/ListAzureClustersResponse.php b/GkeMultiCloud/src/V1/ListAzureClustersResponse.php index fd8eda1241d8..ed2af0dfa8b5 100644 --- a/GkeMultiCloud/src/V1/ListAzureClustersResponse.php +++ b/GkeMultiCloud/src/V1/ListAzureClustersResponse.php @@ -28,7 +28,7 @@ class ListAzureClustersResponse 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/GkeMultiCloud/src/V1/ListAzureNodePoolsRequest.php b/GkeMultiCloud/src/V1/ListAzureNodePoolsRequest.php index 6bc2ea1ea9b8..4a48b8d5a27d 100644 --- a/GkeMultiCloud/src/V1/ListAzureNodePoolsRequest.php +++ b/GkeMultiCloud/src/V1/ListAzureNodePoolsRequest.php @@ -25,7 +25,7 @@ class ListAzureNodePoolsRequest 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 items to return. * If not specified, a default value of 50 will be used by the service. @@ -36,7 +36,7 @@ class ListAzureNodePoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The `nextPageToken` value returned from a previous * [azureNodePools.list][google.cloud.gkemulticloud.v1.AzureClusters.ListAzureNodePools] @@ -44,7 +44,7 @@ class ListAzureNodePoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The parent `AzureCluster` which owns this collection of diff --git a/GkeMultiCloud/src/V1/ListAzureNodePoolsResponse.php b/GkeMultiCloud/src/V1/ListAzureNodePoolsResponse.php index 45566908cfa6..dba3b96d705d 100644 --- a/GkeMultiCloud/src/V1/ListAzureNodePoolsResponse.php +++ b/GkeMultiCloud/src/V1/ListAzureNodePoolsResponse.php @@ -28,7 +28,7 @@ class ListAzureNodePoolsResponse 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/GkeMultiCloud/src/V1/LoggingConfig.php b/GkeMultiCloud/src/V1/LoggingConfig.php index 825db4b99196..85b0a7595ebf 100644 --- a/GkeMultiCloud/src/V1/LoggingConfig.php +++ b/GkeMultiCloud/src/V1/LoggingConfig.php @@ -20,7 +20,7 @@ class LoggingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.LoggingComponentConfig component_config = 1; */ - private $component_config = null; + protected $component_config = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/ManagedPrometheusConfig.php b/GkeMultiCloud/src/V1/ManagedPrometheusConfig.php index 5df2f24b1965..c3f7e469972b 100644 --- a/GkeMultiCloud/src/V1/ManagedPrometheusConfig.php +++ b/GkeMultiCloud/src/V1/ManagedPrometheusConfig.php @@ -21,7 +21,7 @@ class ManagedPrometheusConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enabled = 1; */ - private $enabled = false; + protected $enabled = false; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/MaxPodsConstraint.php b/GkeMultiCloud/src/V1/MaxPodsConstraint.php index a4902d5654a4..abbd020c984a 100644 --- a/GkeMultiCloud/src/V1/MaxPodsConstraint.php +++ b/GkeMultiCloud/src/V1/MaxPodsConstraint.php @@ -20,7 +20,7 @@ class MaxPodsConstraint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 max_pods_per_node = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_pods_per_node = 0; + protected $max_pods_per_node = 0; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/MonitoringConfig.php b/GkeMultiCloud/src/V1/MonitoringConfig.php index 491f19a758f0..a6b9a2e0a799 100644 --- a/GkeMultiCloud/src/V1/MonitoringConfig.php +++ b/GkeMultiCloud/src/V1/MonitoringConfig.php @@ -20,7 +20,7 @@ class MonitoringConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.ManagedPrometheusConfig managed_prometheus_config = 2; */ - private $managed_prometheus_config = null; + protected $managed_prometheus_config = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/NodeTaint.php b/GkeMultiCloud/src/V1/NodeTaint.php index 5e2d72cadce8..3008c9dd75ef 100644 --- a/GkeMultiCloud/src/V1/NodeTaint.php +++ b/GkeMultiCloud/src/V1/NodeTaint.php @@ -20,19 +20,19 @@ class NodeTaint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $key = ''; + protected $key = ''; /** * Required. Value for the taint. * * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $value = ''; + protected $value = ''; /** * Required. The taint effect. * * Generated from protobuf field .google.cloud.gkemulticloud.v1.NodeTaint.Effect effect = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $effect = 0; + protected $effect = 0; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/OperationMetadata.php b/GkeMultiCloud/src/V1/OperationMetadata.php index a5588e59ab19..da707c71cf06 100644 --- a/GkeMultiCloud/src/V1/OperationMetadata.php +++ b/GkeMultiCloud/src/V1/OperationMetadata.php @@ -20,39 +20,39 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The time at which this operation was completed. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. The name of the resource associated to this operation. * * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $target = ''; + protected $target = ''; /** * Output only. Human-readable status of the operation, if any. * * Generated from protobuf field string status_detail = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $status_detail = ''; + protected $status_detail = ''; /** * Output only. Human-readable status of any error that occurred during the * operation. * * Generated from protobuf field string error_detail = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error_detail = ''; + protected $error_detail = ''; /** * Output only. The verb associated with the API method which triggered this * operation. Possible values are "create", "delete", "update" and "import". * * Generated from protobuf field string verb = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $verb = ''; + protected $verb = ''; /** * Output only. Identifies whether it has been requested cancellation * for the operation. Operations that have successfully been cancelled @@ -62,7 +62,7 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $requested_cancellation = false; + protected $requested_cancellation = false; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/ReplicaPlacement.php b/GkeMultiCloud/src/V1/ReplicaPlacement.php index f817881ea2bd..c78be2466d12 100644 --- a/GkeMultiCloud/src/V1/ReplicaPlacement.php +++ b/GkeMultiCloud/src/V1/ReplicaPlacement.php @@ -22,14 +22,14 @@ class ReplicaPlacement extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string subnet_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnet_id = ''; + protected $subnet_id = ''; /** * Required. For a given replica, the Azure availability zone where to * provision the control plane VM and the ETCD disk. * * Generated from protobuf field string azure_availability_zone = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_availability_zone = ''; + protected $azure_availability_zone = ''; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/RollbackAwsNodePoolUpdateRequest.php b/GkeMultiCloud/src/V1/RollbackAwsNodePoolUpdateRequest.php index 90985f4303be..6d5b8a8bbc0d 100644 --- a/GkeMultiCloud/src/V1/RollbackAwsNodePoolUpdateRequest.php +++ b/GkeMultiCloud/src/V1/RollbackAwsNodePoolUpdateRequest.php @@ -26,14 +26,14 @@ class RollbackAwsNodePoolUpdateRequest 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. Option for rollback to ignore the PodDisruptionBudget when * draining the node pool nodes. Default value is false. * * Generated from protobuf field bool respect_pdb = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $respect_pdb = false; + protected $respect_pdb = false; /** * @param string $name Required. The name of the diff --git a/GkeMultiCloud/src/V1/SurgeSettings.php b/GkeMultiCloud/src/V1/SurgeSettings.php index 485291032dff..80494e596f75 100644 --- a/GkeMultiCloud/src/V1/SurgeSettings.php +++ b/GkeMultiCloud/src/V1/SurgeSettings.php @@ -21,7 +21,7 @@ class SurgeSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 max_surge = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $max_surge = 0; + protected $max_surge = 0; /** * Optional. The maximum number of nodes that can be simultaneously * unavailable during the update process. A node is considered unavailable if @@ -29,7 +29,7 @@ class SurgeSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 max_unavailable = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $max_unavailable = 0; + protected $max_unavailable = 0; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/UpdateAttachedClusterRequest.php b/GkeMultiCloud/src/V1/UpdateAttachedClusterRequest.php index a1ab170ed899..a45ece2a28f9 100644 --- a/GkeMultiCloud/src/V1/UpdateAttachedClusterRequest.php +++ b/GkeMultiCloud/src/V1/UpdateAttachedClusterRequest.php @@ -22,13 +22,13 @@ class UpdateAttachedClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AttachedCluster attached_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $attached_cluster = null; + protected $attached_cluster = null; /** * If set, only validate the request, but do not actually update the cluster. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * Required. Mask of fields to update. At least one path must be supplied in * this field. The elements of the repeated paths field can only include these @@ -47,7 +47,7 @@ class UpdateAttachedClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\GkeMultiCloud\V1\AttachedCluster $attachedCluster Required. The diff --git a/GkeMultiCloud/src/V1/UpdateAwsClusterRequest.php b/GkeMultiCloud/src/V1/UpdateAwsClusterRequest.php index 279d5052d8e7..401b27d1d3e5 100644 --- a/GkeMultiCloud/src/V1/UpdateAwsClusterRequest.php +++ b/GkeMultiCloud/src/V1/UpdateAwsClusterRequest.php @@ -21,13 +21,13 @@ class UpdateAwsClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsCluster aws_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $aws_cluster = null; + protected $aws_cluster = null; /** * If set, only validate the request, but do not actually update the cluster. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * Required. Mask of fields to update. At least one path must be supplied in * this field. The elements of the repeated paths field can only include these @@ -62,7 +62,7 @@ class UpdateAwsClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\GkeMultiCloud\V1\AwsCluster $awsCluster Required. The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] diff --git a/GkeMultiCloud/src/V1/UpdateAwsNodePoolRequest.php b/GkeMultiCloud/src/V1/UpdateAwsNodePoolRequest.php index 924292883975..e118a1b99de6 100644 --- a/GkeMultiCloud/src/V1/UpdateAwsNodePoolRequest.php +++ b/GkeMultiCloud/src/V1/UpdateAwsNodePoolRequest.php @@ -21,13 +21,13 @@ class UpdateAwsNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AwsNodePool aws_node_pool = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $aws_node_pool = null; + protected $aws_node_pool = null; /** * If set, only validate the request, but don't actually update the node pool. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * Required. Mask of fields to update. At least one path must be supplied in * this field. The elements of the repeated paths field can only include these @@ -65,7 +65,7 @@ class UpdateAwsNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\GkeMultiCloud\V1\AwsNodePool $awsNodePool Required. The [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] diff --git a/GkeMultiCloud/src/V1/UpdateAzureClusterRequest.php b/GkeMultiCloud/src/V1/UpdateAzureClusterRequest.php index ad9a78e9826b..19ebd29cfa43 100644 --- a/GkeMultiCloud/src/V1/UpdateAzureClusterRequest.php +++ b/GkeMultiCloud/src/V1/UpdateAzureClusterRequest.php @@ -21,13 +21,13 @@ class UpdateAzureClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureCluster azure_cluster = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_cluster = null; + protected $azure_cluster = null; /** * If set, only validate the request, but do not actually update the cluster. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * Required. Mask of fields to update. At least one path must be supplied in * this field. The elements of the repeated paths field can only include these @@ -52,7 +52,7 @@ class UpdateAzureClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\GkeMultiCloud\V1\AzureCluster $azureCluster Required. The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] diff --git a/GkeMultiCloud/src/V1/UpdateAzureNodePoolRequest.php b/GkeMultiCloud/src/V1/UpdateAzureNodePoolRequest.php index 3ff6adc3ec5e..bb297a85b6dd 100644 --- a/GkeMultiCloud/src/V1/UpdateAzureNodePoolRequest.php +++ b/GkeMultiCloud/src/V1/UpdateAzureNodePoolRequest.php @@ -21,13 +21,13 @@ class UpdateAzureNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.AzureNodePool azure_node_pool = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $azure_node_pool = null; + protected $azure_node_pool = null; /** * If set, only validate the request, but don't actually update the node pool. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * Required. Mask of fields to update. At least one path must be supplied in * this field. The elements of the repeated paths field can only include these @@ -42,7 +42,7 @@ class UpdateAzureNodePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\GkeMultiCloud\V1\AzureNodePool $azureNodePool Required. The [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] diff --git a/GkeMultiCloud/src/V1/UpdateSettings.php b/GkeMultiCloud/src/V1/UpdateSettings.php index 95f5635ea2eb..69dd63b604e0 100644 --- a/GkeMultiCloud/src/V1/UpdateSettings.php +++ b/GkeMultiCloud/src/V1/UpdateSettings.php @@ -39,7 +39,7 @@ class UpdateSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.gkemulticloud.v1.SurgeSettings surge_settings = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $surge_settings = null; + protected $surge_settings = null; /** * Constructor. diff --git a/GkeMultiCloud/src/V1/WorkloadIdentityConfig.php b/GkeMultiCloud/src/V1/WorkloadIdentityConfig.php index 97be28306de1..261f7d8542a3 100644 --- a/GkeMultiCloud/src/V1/WorkloadIdentityConfig.php +++ b/GkeMultiCloud/src/V1/WorkloadIdentityConfig.php @@ -20,20 +20,20 @@ class WorkloadIdentityConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string issuer_uri = 1; */ - private $issuer_uri = ''; + protected $issuer_uri = ''; /** * The Workload Identity Pool associated to the cluster. * * Generated from protobuf field string workload_pool = 2; */ - private $workload_pool = ''; + protected $workload_pool = ''; /** * The ID of the OIDC Identity Provider (IdP) associated to the Workload * Identity Pool. * * Generated from protobuf field string identity_provider = 3; */ - private $identity_provider = ''; + protected $identity_provider = ''; /** * Constructor. diff --git a/GkeMultiCloud/tests/Unit/V1/AttachedClustersClientTest.php b/GkeMultiCloud/tests/Unit/V1/AttachedClustersClientTest.php deleted file mode 100644 index c40f10fc4218..000000000000 --- a/GkeMultiCloud/tests/Unit/V1/AttachedClustersClientTest.php +++ /dev/null @@ -1,1007 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return AttachedClustersClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new AttachedClustersClient($options); - } - - /** @test */ - public function createAttachedClusterTest() - { - $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/createAttachedClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $platformVersion = 'platformVersion1813514508'; - $distribution = 'distribution-1580708220'; - $clusterRegion = 'clusterRegion993903833'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $kubernetesVersion = 'kubernetesVersion50850015'; - $expectedResponse = new AttachedCluster(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setPlatformVersion($platformVersion); - $expectedResponse->setDistribution($distribution); - $expectedResponse->setClusterRegion($clusterRegion); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setKubernetesVersion($kubernetesVersion); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createAttachedClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $attachedCluster = new AttachedCluster(); - $attachedClusterOidcConfig = new AttachedOidcConfig(); - $attachedCluster->setOidcConfig($attachedClusterOidcConfig); - $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; - $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); - $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; - $attachedCluster->setDistribution($attachedClusterDistribution); - $attachedClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $attachedClusterFleet->setProject($fleetProject); - $attachedCluster->setFleet($attachedClusterFleet); - $attachedClusterId = 'attachedClusterId-249426181'; - $response = $gapicClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); - $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.gkemulticloud.v1.AttachedClusters/CreateAttachedCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getAttachedCluster(); - $this->assertProtobufEquals($attachedCluster, $actualValue); - $actualValue = $actualApiRequestObject->getAttachedClusterId(); - $this->assertProtobufEquals($attachedClusterId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAttachedClusterTest'); - $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 createAttachedClusterExceptionTest() - { - $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/createAttachedClusterTest'); - $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]'); - $attachedCluster = new AttachedCluster(); - $attachedClusterOidcConfig = new AttachedOidcConfig(); - $attachedCluster->setOidcConfig($attachedClusterOidcConfig); - $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; - $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); - $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; - $attachedCluster->setDistribution($attachedClusterDistribution); - $attachedClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $attachedClusterFleet->setProject($fleetProject); - $attachedCluster->setFleet($attachedClusterFleet); - $attachedClusterId = 'attachedClusterId-249426181'; - $response = $gapicClient->createAttachedCluster($formattedParent, $attachedCluster, $attachedClusterId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAttachedClusterTest'); - 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 deleteAttachedClusterTest() - { - $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/deleteAttachedClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteAttachedClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - $response = $gapicClient->deleteAttachedCluster($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.gkemulticloud.v1.AttachedClusters/DeleteAttachedCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAttachedClusterTest'); - $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 deleteAttachedClusterExceptionTest() - { - $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/deleteAttachedClusterTest'); - $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->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - $response = $gapicClient->deleteAttachedCluster($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAttachedClusterTest'); - 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 generateAttachedClusterAgentTokenTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $accessToken = 'accessToken-1938933922'; - $expiresIn = 833810928; - $tokenType = 'tokenType101507520'; - $expectedResponse = new GenerateAttachedClusterAgentTokenResponse(); - $expectedResponse->setAccessToken($accessToken); - $expectedResponse->setExpiresIn($expiresIn); - $expectedResponse->setTokenType($tokenType); - $transport->addResponse($expectedResponse); - // Mock request - $formattedAttachedCluster = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - $subjectToken = 'subjectToken454811942'; - $subjectTokenType = 'subjectTokenType-697160013'; - $version = 'version351608024'; - $response = $gapicClient->generateAttachedClusterAgentToken($formattedAttachedCluster, $subjectToken, $subjectTokenType, $version); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterAgentToken', $actualFuncCall); - $actualValue = $actualRequestObject->getAttachedCluster(); - $this->assertProtobufEquals($formattedAttachedCluster, $actualValue); - $actualValue = $actualRequestObject->getSubjectToken(); - $this->assertProtobufEquals($subjectToken, $actualValue); - $actualValue = $actualRequestObject->getSubjectTokenType(); - $this->assertProtobufEquals($subjectTokenType, $actualValue); - $actualValue = $actualRequestObject->getVersion(); - $this->assertProtobufEquals($version, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateAttachedClusterAgentTokenExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedAttachedCluster = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - $subjectToken = 'subjectToken454811942'; - $subjectTokenType = 'subjectTokenType-697160013'; - $version = 'version351608024'; - try { - $gapicClient->generateAttachedClusterAgentToken($formattedAttachedCluster, $subjectToken, $subjectTokenType, $version); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateAttachedClusterInstallManifestTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $manifest = 'manifest130625071'; - $expectedResponse = new GenerateAttachedClusterInstallManifestResponse(); - $expectedResponse->setManifest($manifest); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $attachedClusterId = 'attachedClusterId-249426181'; - $platformVersion = 'platformVersion1813514508'; - $response = $gapicClient->generateAttachedClusterInstallManifest($formattedParent, $attachedClusterId, $platformVersion); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterInstallManifest', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getAttachedClusterId(); - $this->assertProtobufEquals($attachedClusterId, $actualValue); - $actualValue = $actualRequestObject->getPlatformVersion(); - $this->assertProtobufEquals($platformVersion, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateAttachedClusterInstallManifestExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $attachedClusterId = 'attachedClusterId-249426181'; - $platformVersion = 'platformVersion1813514508'; - try { - $gapicClient->generateAttachedClusterInstallManifest($formattedParent, $attachedClusterId, $platformVersion); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAttachedClusterTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $platformVersion = 'platformVersion1813514508'; - $distribution = 'distribution-1580708220'; - $clusterRegion = 'clusterRegion993903833'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $kubernetesVersion = 'kubernetesVersion50850015'; - $expectedResponse = new AttachedCluster(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setPlatformVersion($platformVersion); - $expectedResponse->setDistribution($distribution); - $expectedResponse->setClusterRegion($clusterRegion); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setKubernetesVersion($kubernetesVersion); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - $response = $gapicClient->getAttachedCluster($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.gkemulticloud.v1.AttachedClusters/GetAttachedCluster', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAttachedClusterExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - try { - $gapicClient->getAttachedCluster($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 getAttachedServerConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new AttachedServerConfig(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->attachedServerConfigName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->getAttachedServerConfig($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.gkemulticloud.v1.AttachedClusters/GetAttachedServerConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAttachedServerConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->attachedServerConfigName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->getAttachedServerConfig($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 importAttachedClusterTest() - { - $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/importAttachedClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $platformVersion2 = 'platformVersion2-969276993'; - $distribution2 = 'distribution21357826359'; - $clusterRegion = 'clusterRegion993903833'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $kubernetesVersion = 'kubernetesVersion50850015'; - $expectedResponse = new AttachedCluster(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setPlatformVersion($platformVersion2); - $expectedResponse->setDistribution($distribution2); - $expectedResponse->setClusterRegion($clusterRegion); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setKubernetesVersion($kubernetesVersion); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/importAttachedClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $fleetMembership = 'fleetMembership1817977703'; - $platformVersion = 'platformVersion1813514508'; - $distribution = 'distribution-1580708220'; - $response = $gapicClient->importAttachedCluster($formattedParent, $fleetMembership, $platformVersion, $distribution); - $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.gkemulticloud.v1.AttachedClusters/ImportAttachedCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getFleetMembership(); - $this->assertProtobufEquals($fleetMembership, $actualValue); - $actualValue = $actualApiRequestObject->getPlatformVersion(); - $this->assertProtobufEquals($platformVersion, $actualValue); - $actualValue = $actualApiRequestObject->getDistribution(); - $this->assertProtobufEquals($distribution, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/importAttachedClusterTest'); - $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 importAttachedClusterExceptionTest() - { - $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/importAttachedClusterTest'); - $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]'); - $fleetMembership = 'fleetMembership1817977703'; - $platformVersion = 'platformVersion1813514508'; - $distribution = 'distribution-1580708220'; - $response = $gapicClient->importAttachedCluster($formattedParent, $fleetMembership, $platformVersion, $distribution); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/importAttachedClusterTest'); - 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 listAttachedClustersTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $attachedClustersElement = new AttachedCluster(); - $attachedClusters = [ - $attachedClustersElement, - ]; - $expectedResponse = new ListAttachedClustersResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAttachedClusters($attachedClusters); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listAttachedClusters($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAttachedClusters()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/ListAttachedClusters', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAttachedClustersExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listAttachedClusters($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 updateAttachedClusterTest() - { - $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/updateAttachedClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $platformVersion = 'platformVersion1813514508'; - $distribution = 'distribution-1580708220'; - $clusterRegion = 'clusterRegion993903833'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $kubernetesVersion = 'kubernetesVersion50850015'; - $expectedResponse = new AttachedCluster(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setPlatformVersion($platformVersion); - $expectedResponse->setDistribution($distribution); - $expectedResponse->setClusterRegion($clusterRegion); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setKubernetesVersion($kubernetesVersion); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateAttachedClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $attachedCluster = new AttachedCluster(); - $attachedClusterOidcConfig = new AttachedOidcConfig(); - $attachedCluster->setOidcConfig($attachedClusterOidcConfig); - $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; - $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); - $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; - $attachedCluster->setDistribution($attachedClusterDistribution); - $attachedClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $attachedClusterFleet->setProject($fleetProject); - $attachedCluster->setFleet($attachedClusterFleet); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAttachedCluster($attachedCluster, $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.gkemulticloud.v1.AttachedClusters/UpdateAttachedCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAttachedCluster(); - $this->assertProtobufEquals($attachedCluster, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAttachedClusterTest'); - $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 updateAttachedClusterExceptionTest() - { - $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/updateAttachedClusterTest'); - $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 - $attachedCluster = new AttachedCluster(); - $attachedClusterOidcConfig = new AttachedOidcConfig(); - $attachedCluster->setOidcConfig($attachedClusterOidcConfig); - $attachedClusterPlatformVersion = 'attachedClusterPlatformVersion-208126385'; - $attachedCluster->setPlatformVersion($attachedClusterPlatformVersion); - $attachedClusterDistribution = 'attachedClusterDistribution1692601690'; - $attachedCluster->setDistribution($attachedClusterDistribution); - $attachedClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $attachedClusterFleet->setProject($fleetProject); - $attachedCluster->setFleet($attachedClusterFleet); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAttachedCluster($attachedCluster, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAttachedClusterTest'); - 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()); - } -} diff --git a/GkeMultiCloud/tests/Unit/V1/AwsClustersClientTest.php b/GkeMultiCloud/tests/Unit/V1/AwsClustersClientTest.php deleted file mode 100644 index 332408855849..000000000000 --- a/GkeMultiCloud/tests/Unit/V1/AwsClustersClientTest.php +++ /dev/null @@ -1,1824 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return AwsClustersClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new AwsClustersClient($options); - } - - /** @test */ - public function createAwsClusterTest() - { - $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/createAwsClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $awsRegion = 'awsRegion-1887255946'; - $endpoint = 'endpoint1741102485'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $clusterCaCertificate = 'clusterCaCertificate1324742683'; - $expectedResponse = new AwsCluster(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setAwsRegion($awsRegion); - $expectedResponse->setEndpoint($endpoint); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setClusterCaCertificate($clusterCaCertificate); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createAwsClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $awsCluster = new AwsCluster(); - $awsClusterNetworking = new AwsClusterNetworking(); - $networkingVpcId = 'networkingVpcId-1154507440'; - $awsClusterNetworking->setVpcId($networkingVpcId); - $networkingPodAddressCidrBlocks = []; - $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); - $networkingServiceAddressCidrBlocks = []; - $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); - $awsCluster->setNetworking($awsClusterNetworking); - $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; - $awsCluster->setAwsRegion($awsClusterAwsRegion); - $awsClusterControlPlane = new AwsControlPlane(); - $controlPlaneVersion = 'controlPlaneVersion648040665'; - $awsClusterControlPlane->setVersion($controlPlaneVersion); - $controlPlaneSubnetIds = []; - $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); - $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; - $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); - $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); - $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; - $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); - $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); - $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); - $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; - $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); - $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); - $controlPlaneConfigEncryption = new AwsConfigEncryption(); - $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; - $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); - $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); - $awsCluster->setControlPlane($awsClusterControlPlane); - $awsClusterAuthorization = new AwsAuthorization(); - $awsCluster->setAuthorization($awsClusterAuthorization); - $awsClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $awsClusterFleet->setProject($fleetProject); - $awsCluster->setFleet($awsClusterFleet); - $awsClusterId = 'awsClusterId938438658'; - $response = $gapicClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); - $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.gkemulticloud.v1.AwsClusters/CreateAwsCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getAwsCluster(); - $this->assertProtobufEquals($awsCluster, $actualValue); - $actualValue = $actualApiRequestObject->getAwsClusterId(); - $this->assertProtobufEquals($awsClusterId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAwsClusterTest'); - $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 createAwsClusterExceptionTest() - { - $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/createAwsClusterTest'); - $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]'); - $awsCluster = new AwsCluster(); - $awsClusterNetworking = new AwsClusterNetworking(); - $networkingVpcId = 'networkingVpcId-1154507440'; - $awsClusterNetworking->setVpcId($networkingVpcId); - $networkingPodAddressCidrBlocks = []; - $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); - $networkingServiceAddressCidrBlocks = []; - $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); - $awsCluster->setNetworking($awsClusterNetworking); - $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; - $awsCluster->setAwsRegion($awsClusterAwsRegion); - $awsClusterControlPlane = new AwsControlPlane(); - $controlPlaneVersion = 'controlPlaneVersion648040665'; - $awsClusterControlPlane->setVersion($controlPlaneVersion); - $controlPlaneSubnetIds = []; - $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); - $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; - $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); - $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); - $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; - $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); - $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); - $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); - $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; - $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); - $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); - $controlPlaneConfigEncryption = new AwsConfigEncryption(); - $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; - $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); - $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); - $awsCluster->setControlPlane($awsClusterControlPlane); - $awsClusterAuthorization = new AwsAuthorization(); - $awsCluster->setAuthorization($awsClusterAuthorization); - $awsClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $awsClusterFleet->setProject($fleetProject); - $awsCluster->setFleet($awsClusterFleet); - $awsClusterId = 'awsClusterId938438658'; - $response = $gapicClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAwsClusterTest'); - 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 createAwsNodePoolTest() - { - $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/createAwsNodePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $version = 'version351608024'; - $subnetId = 'subnetId373593405'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $expectedResponse = new AwsNodePool(); - $expectedResponse->setName($name); - $expectedResponse->setVersion($version); - $expectedResponse->setSubnetId($subnetId); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createAwsNodePoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $awsNodePool = new AwsNodePool(); - $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; - $awsNodePool->setVersion($awsNodePoolVersion); - $awsNodePoolConfig = new AwsNodeConfig(); - $configIamInstanceProfile = 'configIamInstanceProfile805825313'; - $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); - $configConfigEncryption = new AwsConfigEncryption(); - $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; - $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); - $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); - $awsNodePool->setConfig($awsNodePoolConfig); - $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); - $autoscalingMinNodeCount = 1464441581; - $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); - $autoscalingMaxNodeCount = 1938867647; - $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); - $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); - $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; - $awsNodePool->setSubnetId($awsNodePoolSubnetId); - $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); - $maxPodsConstraintMaxPodsPerNode = 1072618940; - $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); - $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); - $awsNodePoolId = 'awsNodePoolId1958033635'; - $response = $gapicClient->createAwsNodePool($formattedParent, $awsNodePool, $awsNodePoolId); - $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.gkemulticloud.v1.AwsClusters/CreateAwsNodePool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getAwsNodePool(); - $this->assertProtobufEquals($awsNodePool, $actualValue); - $actualValue = $actualApiRequestObject->getAwsNodePoolId(); - $this->assertProtobufEquals($awsNodePoolId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAwsNodePoolTest'); - $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 createAwsNodePoolExceptionTest() - { - $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/createAwsNodePoolTest'); - $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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $awsNodePool = new AwsNodePool(); - $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; - $awsNodePool->setVersion($awsNodePoolVersion); - $awsNodePoolConfig = new AwsNodeConfig(); - $configIamInstanceProfile = 'configIamInstanceProfile805825313'; - $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); - $configConfigEncryption = new AwsConfigEncryption(); - $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; - $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); - $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); - $awsNodePool->setConfig($awsNodePoolConfig); - $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); - $autoscalingMinNodeCount = 1464441581; - $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); - $autoscalingMaxNodeCount = 1938867647; - $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); - $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); - $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; - $awsNodePool->setSubnetId($awsNodePoolSubnetId); - $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); - $maxPodsConstraintMaxPodsPerNode = 1072618940; - $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); - $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); - $awsNodePoolId = 'awsNodePoolId1958033635'; - $response = $gapicClient->createAwsNodePool($formattedParent, $awsNodePool, $awsNodePoolId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAwsNodePoolTest'); - 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 deleteAwsClusterTest() - { - $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/deleteAwsClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteAwsClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $response = $gapicClient->deleteAwsCluster($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.gkemulticloud.v1.AwsClusters/DeleteAwsCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAwsClusterTest'); - $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 deleteAwsClusterExceptionTest() - { - $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/deleteAwsClusterTest'); - $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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $response = $gapicClient->deleteAwsCluster($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAwsClusterTest'); - 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 deleteAwsNodePoolTest() - { - $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/deleteAwsNodePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteAwsNodePoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $response = $gapicClient->deleteAwsNodePool($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.gkemulticloud.v1.AwsClusters/DeleteAwsNodePool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAwsNodePoolTest'); - $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 deleteAwsNodePoolExceptionTest() - { - $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/deleteAwsNodePoolTest'); - $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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $response = $gapicClient->deleteAwsNodePool($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAwsNodePoolTest'); - 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 generateAwsAccessTokenTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $accessToken = 'accessToken-1938933922'; - $expectedResponse = new GenerateAwsAccessTokenResponse(); - $expectedResponse->setAccessToken($accessToken); - $transport->addResponse($expectedResponse); - // Mock request - $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $response = $gapicClient->generateAwsAccessToken($formattedAwsCluster); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GenerateAwsAccessToken', $actualFuncCall); - $actualValue = $actualRequestObject->getAwsCluster(); - $this->assertProtobufEquals($formattedAwsCluster, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateAwsAccessTokenExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - try { - $gapicClient->generateAwsAccessToken($formattedAwsCluster); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateAwsClusterAgentTokenTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $accessToken = 'accessToken-1938933922'; - $expiresIn = 833810928; - $tokenType = 'tokenType101507520'; - $expectedResponse = new GenerateAwsClusterAgentTokenResponse(); - $expectedResponse->setAccessToken($accessToken); - $expectedResponse->setExpiresIn($expiresIn); - $expectedResponse->setTokenType($tokenType); - $transport->addResponse($expectedResponse); - // Mock request - $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $subjectToken = 'subjectToken454811942'; - $subjectTokenType = 'subjectTokenType-697160013'; - $version = 'version351608024'; - $response = $gapicClient->generateAwsClusterAgentToken($formattedAwsCluster, $subjectToken, $subjectTokenType, $version); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GenerateAwsClusterAgentToken', $actualFuncCall); - $actualValue = $actualRequestObject->getAwsCluster(); - $this->assertProtobufEquals($formattedAwsCluster, $actualValue); - $actualValue = $actualRequestObject->getSubjectToken(); - $this->assertProtobufEquals($subjectToken, $actualValue); - $actualValue = $actualRequestObject->getSubjectTokenType(); - $this->assertProtobufEquals($subjectTokenType, $actualValue); - $actualValue = $actualRequestObject->getVersion(); - $this->assertProtobufEquals($version, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateAwsClusterAgentTokenExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $subjectToken = 'subjectToken454811942'; - $subjectTokenType = 'subjectTokenType-697160013'; - $version = 'version351608024'; - try { - $gapicClient->generateAwsClusterAgentToken($formattedAwsCluster, $subjectToken, $subjectTokenType, $version); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAwsClusterTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $awsRegion = 'awsRegion-1887255946'; - $endpoint = 'endpoint1741102485'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $clusterCaCertificate = 'clusterCaCertificate1324742683'; - $expectedResponse = new AwsCluster(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setAwsRegion($awsRegion); - $expectedResponse->setEndpoint($endpoint); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setClusterCaCertificate($clusterCaCertificate); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $response = $gapicClient->getAwsCluster($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.gkemulticloud.v1.AwsClusters/GetAwsCluster', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAwsClusterExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - try { - $gapicClient->getAwsCluster($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 getAwsJsonWebKeysTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new AwsJsonWebKeys(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $response = $gapicClient->getAwsJsonWebKeys($formattedAwsCluster); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsJsonWebKeys', $actualFuncCall); - $actualValue = $actualRequestObject->getAwsCluster(); - $this->assertProtobufEquals($formattedAwsCluster, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAwsJsonWebKeysExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - try { - $gapicClient->getAwsJsonWebKeys($formattedAwsCluster); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAwsNodePoolTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $version = 'version351608024'; - $subnetId = 'subnetId373593405'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $expectedResponse = new AwsNodePool(); - $expectedResponse->setName($name2); - $expectedResponse->setVersion($version); - $expectedResponse->setSubnetId($subnetId); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $response = $gapicClient->getAwsNodePool($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.gkemulticloud.v1.AwsClusters/GetAwsNodePool', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAwsNodePoolExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - try { - $gapicClient->getAwsNodePool($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 getAwsOpenIdConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $issuer = 'issuer-1179159879'; - $jwksUri = 'jwksUri1465527714'; - $expectedResponse = new AwsOpenIdConfig(); - $expectedResponse->setIssuer($issuer); - $expectedResponse->setJwksUri($jwksUri); - $transport->addResponse($expectedResponse); - // Mock request - $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $response = $gapicClient->getAwsOpenIdConfig($formattedAwsCluster); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/GetAwsOpenIdConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getAwsCluster(); - $this->assertProtobufEquals($formattedAwsCluster, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAwsOpenIdConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - try { - $gapicClient->getAwsOpenIdConfig($formattedAwsCluster); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAwsServerConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new AwsServerConfig(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->awsServerConfigName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->getAwsServerConfig($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.gkemulticloud.v1.AwsClusters/GetAwsServerConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAwsServerConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->awsServerConfigName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->getAwsServerConfig($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 listAwsClustersTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $awsClustersElement = new AwsCluster(); - $awsClusters = [ - $awsClustersElement, - ]; - $expectedResponse = new ListAwsClustersResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAwsClusters($awsClusters); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listAwsClusters($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAwsClusters()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsClusters', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAwsClustersExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listAwsClusters($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 listAwsNodePoolsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $awsNodePoolsElement = new AwsNodePool(); - $awsNodePools = [ - $awsNodePoolsElement, - ]; - $expectedResponse = new ListAwsNodePoolsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAwsNodePools($awsNodePools); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $response = $gapicClient->listAwsNodePools($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAwsNodePools()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AwsClusters/ListAwsNodePools', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAwsNodePoolsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - try { - $gapicClient->listAwsNodePools($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 rollbackAwsNodePoolUpdateTest() - { - $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/rollbackAwsNodePoolUpdateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $version = 'version351608024'; - $subnetId = 'subnetId373593405'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $expectedResponse = new AwsNodePool(); - $expectedResponse->setName($name2); - $expectedResponse->setVersion($version); - $expectedResponse->setSubnetId($subnetId); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/rollbackAwsNodePoolUpdateTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $response = $gapicClient->rollbackAwsNodePoolUpdate($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.gkemulticloud.v1.AwsClusters/RollbackAwsNodePoolUpdate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/rollbackAwsNodePoolUpdateTest'); - $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 rollbackAwsNodePoolUpdateExceptionTest() - { - $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/rollbackAwsNodePoolUpdateTest'); - $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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $response = $gapicClient->rollbackAwsNodePoolUpdate($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/rollbackAwsNodePoolUpdateTest'); - 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 updateAwsClusterTest() - { - $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/updateAwsClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $awsRegion = 'awsRegion-1887255946'; - $endpoint = 'endpoint1741102485'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $clusterCaCertificate = 'clusterCaCertificate1324742683'; - $expectedResponse = new AwsCluster(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setAwsRegion($awsRegion); - $expectedResponse->setEndpoint($endpoint); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setClusterCaCertificate($clusterCaCertificate); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateAwsClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $awsCluster = new AwsCluster(); - $awsClusterNetworking = new AwsClusterNetworking(); - $networkingVpcId = 'networkingVpcId-1154507440'; - $awsClusterNetworking->setVpcId($networkingVpcId); - $networkingPodAddressCidrBlocks = []; - $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); - $networkingServiceAddressCidrBlocks = []; - $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); - $awsCluster->setNetworking($awsClusterNetworking); - $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; - $awsCluster->setAwsRegion($awsClusterAwsRegion); - $awsClusterControlPlane = new AwsControlPlane(); - $controlPlaneVersion = 'controlPlaneVersion648040665'; - $awsClusterControlPlane->setVersion($controlPlaneVersion); - $controlPlaneSubnetIds = []; - $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); - $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; - $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); - $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); - $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; - $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); - $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); - $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); - $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; - $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); - $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); - $controlPlaneConfigEncryption = new AwsConfigEncryption(); - $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; - $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); - $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); - $awsCluster->setControlPlane($awsClusterControlPlane); - $awsClusterAuthorization = new AwsAuthorization(); - $awsCluster->setAuthorization($awsClusterAuthorization); - $awsClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $awsClusterFleet->setProject($fleetProject); - $awsCluster->setFleet($awsClusterFleet); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAwsCluster($awsCluster, $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.gkemulticloud.v1.AwsClusters/UpdateAwsCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAwsCluster(); - $this->assertProtobufEquals($awsCluster, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAwsClusterTest'); - $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 updateAwsClusterExceptionTest() - { - $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/updateAwsClusterTest'); - $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 - $awsCluster = new AwsCluster(); - $awsClusterNetworking = new AwsClusterNetworking(); - $networkingVpcId = 'networkingVpcId-1154507440'; - $awsClusterNetworking->setVpcId($networkingVpcId); - $networkingPodAddressCidrBlocks = []; - $awsClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); - $networkingServiceAddressCidrBlocks = []; - $awsClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); - $awsCluster->setNetworking($awsClusterNetworking); - $awsClusterAwsRegion = 'awsClusterAwsRegion574122132'; - $awsCluster->setAwsRegion($awsClusterAwsRegion); - $awsClusterControlPlane = new AwsControlPlane(); - $controlPlaneVersion = 'controlPlaneVersion648040665'; - $awsClusterControlPlane->setVersion($controlPlaneVersion); - $controlPlaneSubnetIds = []; - $awsClusterControlPlane->setSubnetIds($controlPlaneSubnetIds); - $controlPlaneIamInstanceProfile = 'controlPlaneIamInstanceProfile1905273246'; - $awsClusterControlPlane->setIamInstanceProfile($controlPlaneIamInstanceProfile); - $controlPlaneDatabaseEncryption = new AwsDatabaseEncryption(); - $databaseEncryptionKmsKeyArn = 'databaseEncryptionKmsKeyArn1858324593'; - $controlPlaneDatabaseEncryption->setKmsKeyArn($databaseEncryptionKmsKeyArn); - $awsClusterControlPlane->setDatabaseEncryption($controlPlaneDatabaseEncryption); - $controlPlaneAwsServicesAuthentication = new AwsServicesAuthentication(); - $awsServicesAuthenticationRoleArn = 'awsServicesAuthenticationRoleArn1905212596'; - $controlPlaneAwsServicesAuthentication->setRoleArn($awsServicesAuthenticationRoleArn); - $awsClusterControlPlane->setAwsServicesAuthentication($controlPlaneAwsServicesAuthentication); - $controlPlaneConfigEncryption = new AwsConfigEncryption(); - $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; - $controlPlaneConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); - $awsClusterControlPlane->setConfigEncryption($controlPlaneConfigEncryption); - $awsCluster->setControlPlane($awsClusterControlPlane); - $awsClusterAuthorization = new AwsAuthorization(); - $awsCluster->setAuthorization($awsClusterAuthorization); - $awsClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $awsClusterFleet->setProject($fleetProject); - $awsCluster->setFleet($awsClusterFleet); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAwsCluster($awsCluster, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAwsClusterTest'); - 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 updateAwsNodePoolTest() - { - $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/updateAwsNodePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $version = 'version351608024'; - $subnetId = 'subnetId373593405'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $expectedResponse = new AwsNodePool(); - $expectedResponse->setName($name); - $expectedResponse->setVersion($version); - $expectedResponse->setSubnetId($subnetId); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateAwsNodePoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $awsNodePool = new AwsNodePool(); - $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; - $awsNodePool->setVersion($awsNodePoolVersion); - $awsNodePoolConfig = new AwsNodeConfig(); - $configIamInstanceProfile = 'configIamInstanceProfile805825313'; - $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); - $configConfigEncryption = new AwsConfigEncryption(); - $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; - $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); - $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); - $awsNodePool->setConfig($awsNodePoolConfig); - $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); - $autoscalingMinNodeCount = 1464441581; - $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); - $autoscalingMaxNodeCount = 1938867647; - $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); - $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); - $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; - $awsNodePool->setSubnetId($awsNodePoolSubnetId); - $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); - $maxPodsConstraintMaxPodsPerNode = 1072618940; - $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); - $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAwsNodePool($awsNodePool, $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.gkemulticloud.v1.AwsClusters/UpdateAwsNodePool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAwsNodePool(); - $this->assertProtobufEquals($awsNodePool, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAwsNodePoolTest'); - $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 updateAwsNodePoolExceptionTest() - { - $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/updateAwsNodePoolTest'); - $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 - $awsNodePool = new AwsNodePool(); - $awsNodePoolVersion = 'awsNodePoolVersion-617231107'; - $awsNodePool->setVersion($awsNodePoolVersion); - $awsNodePoolConfig = new AwsNodeConfig(); - $configIamInstanceProfile = 'configIamInstanceProfile805825313'; - $awsNodePoolConfig->setIamInstanceProfile($configIamInstanceProfile); - $configConfigEncryption = new AwsConfigEncryption(); - $configEncryptionKmsKeyArn = 'configEncryptionKmsKeyArn-992257206'; - $configConfigEncryption->setKmsKeyArn($configEncryptionKmsKeyArn); - $awsNodePoolConfig->setConfigEncryption($configConfigEncryption); - $awsNodePool->setConfig($awsNodePoolConfig); - $awsNodePoolAutoscaling = new AwsNodePoolAutoscaling(); - $autoscalingMinNodeCount = 1464441581; - $awsNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); - $autoscalingMaxNodeCount = 1938867647; - $awsNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); - $awsNodePool->setAutoscaling($awsNodePoolAutoscaling); - $awsNodePoolSubnetId = 'awsNodePoolSubnetId-2035401261'; - $awsNodePool->setSubnetId($awsNodePoolSubnetId); - $awsNodePoolMaxPodsConstraint = new MaxPodsConstraint(); - $maxPodsConstraintMaxPodsPerNode = 1072618940; - $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); - $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAwsNodePool($awsNodePool, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAwsNodePoolTest'); - 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()); - } -} diff --git a/GkeMultiCloud/tests/Unit/V1/AzureClustersClientTest.php b/GkeMultiCloud/tests/Unit/V1/AzureClustersClientTest.php deleted file mode 100644 index dfe1627b3cff..000000000000 --- a/GkeMultiCloud/tests/Unit/V1/AzureClustersClientTest.php +++ /dev/null @@ -1,2065 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return AzureClustersClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new AzureClustersClient($options); - } - - /** @test */ - public function createAzureClientTest() - { - $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/createAzureClientTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $tenantId = 'tenantId-1852780336'; - $applicationId = 'applicationId-1287148950'; - $reconciling = false; - $pemCertificate = 'pemCertificate1234463984'; - $uid = 'uid115792'; - $expectedResponse = new AzureClient(); - $expectedResponse->setName($name); - $expectedResponse->setTenantId($tenantId); - $expectedResponse->setApplicationId($applicationId); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setPemCertificate($pemCertificate); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createAzureClientTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $azureClient = new AzureClient(); - $azureClientTenantId = 'azureClientTenantId-567307073'; - $azureClient->setTenantId($azureClientTenantId); - $azureClientApplicationId = 'azureClientApplicationId264838513'; - $azureClient->setApplicationId($azureClientApplicationId); - $azureClientId = 'azureClientId315645023'; - $response = $gapicClient->createAzureClient($formattedParent, $azureClient, $azureClientId); - $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.gkemulticloud.v1.AzureClusters/CreateAzureClient', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getAzureClient(); - $this->assertProtobufEquals($azureClient, $actualValue); - $actualValue = $actualApiRequestObject->getAzureClientId(); - $this->assertProtobufEquals($azureClientId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAzureClientTest'); - $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 createAzureClientExceptionTest() - { - $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/createAzureClientTest'); - $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]'); - $azureClient = new AzureClient(); - $azureClientTenantId = 'azureClientTenantId-567307073'; - $azureClient->setTenantId($azureClientTenantId); - $azureClientApplicationId = 'azureClientApplicationId264838513'; - $azureClient->setApplicationId($azureClientApplicationId); - $azureClientId = 'azureClientId315645023'; - $response = $gapicClient->createAzureClient($formattedParent, $azureClient, $azureClientId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAzureClientTest'); - 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 createAzureClusterTest() - { - $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/createAzureClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $azureRegion = 'azureRegion-253373788'; - $resourceGroupId = 'resourceGroupId-1092054036'; - $azureClient = 'azureClient-676290693'; - $endpoint = 'endpoint1741102485'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $clusterCaCertificate = 'clusterCaCertificate1324742683'; - $expectedResponse = new AzureCluster(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setAzureRegion($azureRegion); - $expectedResponse->setResourceGroupId($resourceGroupId); - $expectedResponse->setAzureClient($azureClient); - $expectedResponse->setEndpoint($endpoint); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setClusterCaCertificate($clusterCaCertificate); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createAzureClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $azureCluster = new AzureCluster(); - $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; - $azureCluster->setAzureRegion($azureClusterAzureRegion); - $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; - $azureCluster->setResourceGroupId($azureClusterResourceGroupId); - $azureClusterNetworking = new AzureClusterNetworking(); - $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; - $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); - $networkingPodAddressCidrBlocks = []; - $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); - $networkingServiceAddressCidrBlocks = []; - $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); - $azureCluster->setNetworking($azureClusterNetworking); - $azureClusterControlPlane = new AzureControlPlane(); - $controlPlaneVersion = 'controlPlaneVersion648040665'; - $azureClusterControlPlane->setVersion($controlPlaneVersion); - $controlPlaneSshConfig = new AzureSshConfig(); - $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; - $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); - $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); - $azureCluster->setControlPlane($azureClusterControlPlane); - $azureClusterAuthorization = new AzureAuthorization(); - $azureCluster->setAuthorization($azureClusterAuthorization); - $azureClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $azureClusterFleet->setProject($fleetProject); - $azureCluster->setFleet($azureClusterFleet); - $azureClusterId = 'azureClusterId332577072'; - $response = $gapicClient->createAzureCluster($formattedParent, $azureCluster, $azureClusterId); - $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.gkemulticloud.v1.AzureClusters/CreateAzureCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getAzureCluster(); - $this->assertProtobufEquals($azureCluster, $actualValue); - $actualValue = $actualApiRequestObject->getAzureClusterId(); - $this->assertProtobufEquals($azureClusterId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAzureClusterTest'); - $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 createAzureClusterExceptionTest() - { - $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/createAzureClusterTest'); - $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]'); - $azureCluster = new AzureCluster(); - $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; - $azureCluster->setAzureRegion($azureClusterAzureRegion); - $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; - $azureCluster->setResourceGroupId($azureClusterResourceGroupId); - $azureClusterNetworking = new AzureClusterNetworking(); - $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; - $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); - $networkingPodAddressCidrBlocks = []; - $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); - $networkingServiceAddressCidrBlocks = []; - $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); - $azureCluster->setNetworking($azureClusterNetworking); - $azureClusterControlPlane = new AzureControlPlane(); - $controlPlaneVersion = 'controlPlaneVersion648040665'; - $azureClusterControlPlane->setVersion($controlPlaneVersion); - $controlPlaneSshConfig = new AzureSshConfig(); - $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; - $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); - $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); - $azureCluster->setControlPlane($azureClusterControlPlane); - $azureClusterAuthorization = new AzureAuthorization(); - $azureCluster->setAuthorization($azureClusterAuthorization); - $azureClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $azureClusterFleet->setProject($fleetProject); - $azureCluster->setFleet($azureClusterFleet); - $azureClusterId = 'azureClusterId332577072'; - $response = $gapicClient->createAzureCluster($formattedParent, $azureCluster, $azureClusterId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAzureClusterTest'); - 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 createAzureNodePoolTest() - { - $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/createAzureNodePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $version = 'version351608024'; - $subnetId = 'subnetId373593405'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $azureAvailabilityZone = 'azureAvailabilityZone541920864'; - $expectedResponse = new AzureNodePool(); - $expectedResponse->setName($name); - $expectedResponse->setVersion($version); - $expectedResponse->setSubnetId($subnetId); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createAzureNodePoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $azureNodePool = new AzureNodePool(); - $azureNodePoolVersion = 'azureNodePoolVersion349490987'; - $azureNodePool->setVersion($azureNodePoolVersion); - $azureNodePoolConfig = new AzureNodeConfig(); - $configSshConfig = new AzureSshConfig(); - $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; - $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); - $azureNodePoolConfig->setSshConfig($configSshConfig); - $azureNodePool->setConfig($azureNodePoolConfig); - $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; - $azureNodePool->setSubnetId($azureNodePoolSubnetId); - $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); - $autoscalingMinNodeCount = 1464441581; - $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); - $autoscalingMaxNodeCount = 1938867647; - $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); - $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); - $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); - $maxPodsConstraintMaxPodsPerNode = 1072618940; - $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); - $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); - $azureNodePoolId = 'azureNodePoolId-454365551'; - $response = $gapicClient->createAzureNodePool($formattedParent, $azureNodePool, $azureNodePoolId); - $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.gkemulticloud.v1.AzureClusters/CreateAzureNodePool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getAzureNodePool(); - $this->assertProtobufEquals($azureNodePool, $actualValue); - $actualValue = $actualApiRequestObject->getAzureNodePoolId(); - $this->assertProtobufEquals($azureNodePoolId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAzureNodePoolTest'); - $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 createAzureNodePoolExceptionTest() - { - $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/createAzureNodePoolTest'); - $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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $azureNodePool = new AzureNodePool(); - $azureNodePoolVersion = 'azureNodePoolVersion349490987'; - $azureNodePool->setVersion($azureNodePoolVersion); - $azureNodePoolConfig = new AzureNodeConfig(); - $configSshConfig = new AzureSshConfig(); - $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; - $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); - $azureNodePoolConfig->setSshConfig($configSshConfig); - $azureNodePool->setConfig($azureNodePoolConfig); - $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; - $azureNodePool->setSubnetId($azureNodePoolSubnetId); - $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); - $autoscalingMinNodeCount = 1464441581; - $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); - $autoscalingMaxNodeCount = 1938867647; - $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); - $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); - $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); - $maxPodsConstraintMaxPodsPerNode = 1072618940; - $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); - $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); - $azureNodePoolId = 'azureNodePoolId-454365551'; - $response = $gapicClient->createAzureNodePool($formattedParent, $azureNodePool, $azureNodePoolId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAzureNodePoolTest'); - 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 deleteAzureClientTest() - { - $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/deleteAzureClientTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteAzureClientTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - $response = $gapicClient->deleteAzureClient($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.gkemulticloud.v1.AzureClusters/DeleteAzureClient', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAzureClientTest'); - $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 deleteAzureClientExceptionTest() - { - $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/deleteAzureClientTest'); - $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->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - $response = $gapicClient->deleteAzureClient($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAzureClientTest'); - 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 deleteAzureClusterTest() - { - $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/deleteAzureClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteAzureClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $response = $gapicClient->deleteAzureCluster($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.gkemulticloud.v1.AzureClusters/DeleteAzureCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAzureClusterTest'); - $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 deleteAzureClusterExceptionTest() - { - $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/deleteAzureClusterTest'); - $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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $response = $gapicClient->deleteAzureCluster($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAzureClusterTest'); - 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 deleteAzureNodePoolTest() - { - $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/deleteAzureNodePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteAzureNodePoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - $response = $gapicClient->deleteAzureNodePool($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.gkemulticloud.v1.AzureClusters/DeleteAzureNodePool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAzureNodePoolTest'); - $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 deleteAzureNodePoolExceptionTest() - { - $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/deleteAzureNodePoolTest'); - $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->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - $response = $gapicClient->deleteAzureNodePool($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAzureNodePoolTest'); - 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 generateAzureAccessTokenTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $accessToken = 'accessToken-1938933922'; - $expectedResponse = new GenerateAzureAccessTokenResponse(); - $expectedResponse->setAccessToken($accessToken); - $transport->addResponse($expectedResponse); - // Mock request - $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $response = $gapicClient->generateAzureAccessToken($formattedAzureCluster); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GenerateAzureAccessToken', $actualFuncCall); - $actualValue = $actualRequestObject->getAzureCluster(); - $this->assertProtobufEquals($formattedAzureCluster, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateAzureAccessTokenExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - try { - $gapicClient->generateAzureAccessToken($formattedAzureCluster); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateAzureClusterAgentTokenTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $accessToken = 'accessToken-1938933922'; - $expiresIn = 833810928; - $tokenType = 'tokenType101507520'; - $expectedResponse = new GenerateAzureClusterAgentTokenResponse(); - $expectedResponse->setAccessToken($accessToken); - $expectedResponse->setExpiresIn($expiresIn); - $expectedResponse->setTokenType($tokenType); - $transport->addResponse($expectedResponse); - // Mock request - $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $subjectToken = 'subjectToken454811942'; - $subjectTokenType = 'subjectTokenType-697160013'; - $version = 'version351608024'; - $response = $gapicClient->generateAzureClusterAgentToken($formattedAzureCluster, $subjectToken, $subjectTokenType, $version); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GenerateAzureClusterAgentToken', $actualFuncCall); - $actualValue = $actualRequestObject->getAzureCluster(); - $this->assertProtobufEquals($formattedAzureCluster, $actualValue); - $actualValue = $actualRequestObject->getSubjectToken(); - $this->assertProtobufEquals($subjectToken, $actualValue); - $actualValue = $actualRequestObject->getSubjectTokenType(); - $this->assertProtobufEquals($subjectTokenType, $actualValue); - $actualValue = $actualRequestObject->getVersion(); - $this->assertProtobufEquals($version, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function generateAzureClusterAgentTokenExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $subjectToken = 'subjectToken454811942'; - $subjectTokenType = 'subjectTokenType-697160013'; - $version = 'version351608024'; - try { - $gapicClient->generateAzureClusterAgentToken($formattedAzureCluster, $subjectToken, $subjectTokenType, $version); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAzureClientTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $tenantId = 'tenantId-1852780336'; - $applicationId = 'applicationId-1287148950'; - $reconciling = false; - $pemCertificate = 'pemCertificate1234463984'; - $uid = 'uid115792'; - $expectedResponse = new AzureClient(); - $expectedResponse->setName($name2); - $expectedResponse->setTenantId($tenantId); - $expectedResponse->setApplicationId($applicationId); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setPemCertificate($pemCertificate); - $expectedResponse->setUid($uid); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - $response = $gapicClient->getAzureClient($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.gkemulticloud.v1.AzureClusters/GetAzureClient', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAzureClientExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - try { - $gapicClient->getAzureClient($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 getAzureClusterTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $azureRegion = 'azureRegion-253373788'; - $resourceGroupId = 'resourceGroupId-1092054036'; - $azureClient = 'azureClient-676290693'; - $endpoint = 'endpoint1741102485'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $clusterCaCertificate = 'clusterCaCertificate1324742683'; - $expectedResponse = new AzureCluster(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setAzureRegion($azureRegion); - $expectedResponse->setResourceGroupId($resourceGroupId); - $expectedResponse->setAzureClient($azureClient); - $expectedResponse->setEndpoint($endpoint); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setClusterCaCertificate($clusterCaCertificate); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $response = $gapicClient->getAzureCluster($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.gkemulticloud.v1.AzureClusters/GetAzureCluster', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAzureClusterExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - try { - $gapicClient->getAzureCluster($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 getAzureJsonWebKeysTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new AzureJsonWebKeys(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $response = $gapicClient->getAzureJsonWebKeys($formattedAzureCluster); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureJsonWebKeys', $actualFuncCall); - $actualValue = $actualRequestObject->getAzureCluster(); - $this->assertProtobufEquals($formattedAzureCluster, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAzureJsonWebKeysExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - try { - $gapicClient->getAzureJsonWebKeys($formattedAzureCluster); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAzureNodePoolTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $version = 'version351608024'; - $subnetId = 'subnetId373593405'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $azureAvailabilityZone = 'azureAvailabilityZone541920864'; - $expectedResponse = new AzureNodePool(); - $expectedResponse->setName($name2); - $expectedResponse->setVersion($version); - $expectedResponse->setSubnetId($subnetId); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - $response = $gapicClient->getAzureNodePool($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.gkemulticloud.v1.AzureClusters/GetAzureNodePool', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAzureNodePoolExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - try { - $gapicClient->getAzureNodePool($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 getAzureOpenIdConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $issuer = 'issuer-1179159879'; - $jwksUri = 'jwksUri1465527714'; - $expectedResponse = new AzureOpenIdConfig(); - $expectedResponse->setIssuer($issuer); - $expectedResponse->setJwksUri($jwksUri); - $transport->addResponse($expectedResponse); - // Mock request - $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $response = $gapicClient->getAzureOpenIdConfig($formattedAzureCluster); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GetAzureOpenIdConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getAzureCluster(); - $this->assertProtobufEquals($formattedAzureCluster, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAzureOpenIdConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - try { - $gapicClient->getAzureOpenIdConfig($formattedAzureCluster); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAzureServerConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new AzureServerConfig(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->azureServerConfigName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->getAzureServerConfig($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.gkemulticloud.v1.AzureClusters/GetAzureServerConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAzureServerConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->azureServerConfigName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->getAzureServerConfig($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 listAzureClientsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $azureClientsElement = new AzureClient(); - $azureClients = [ - $azureClientsElement, - ]; - $expectedResponse = new ListAzureClientsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAzureClients($azureClients); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listAzureClients($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAzureClients()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClients', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAzureClientsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listAzureClients($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 listAzureClustersTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $azureClustersElement = new AzureCluster(); - $azureClusters = [ - $azureClustersElement, - ]; - $expectedResponse = new ListAzureClustersResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAzureClusters($azureClusters); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listAzureClusters($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAzureClusters()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClusters', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAzureClustersExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listAzureClusters($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 listAzureNodePoolsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $azureNodePoolsElement = new AzureNodePool(); - $azureNodePools = [ - $azureNodePoolsElement, - ]; - $expectedResponse = new ListAzureNodePoolsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAzureNodePools($azureNodePools); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $response = $gapicClient->listAzureNodePools($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAzureNodePools()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/ListAzureNodePools', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAzureNodePoolsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - try { - $gapicClient->listAzureNodePools($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 updateAzureClusterTest() - { - $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/updateAzureClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $azureRegion = 'azureRegion-253373788'; - $resourceGroupId = 'resourceGroupId-1092054036'; - $azureClient = 'azureClient-676290693'; - $endpoint = 'endpoint1741102485'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $clusterCaCertificate = 'clusterCaCertificate1324742683'; - $expectedResponse = new AzureCluster(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setAzureRegion($azureRegion); - $expectedResponse->setResourceGroupId($resourceGroupId); - $expectedResponse->setAzureClient($azureClient); - $expectedResponse->setEndpoint($endpoint); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setClusterCaCertificate($clusterCaCertificate); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateAzureClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $azureCluster = new AzureCluster(); - $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; - $azureCluster->setAzureRegion($azureClusterAzureRegion); - $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; - $azureCluster->setResourceGroupId($azureClusterResourceGroupId); - $azureClusterNetworking = new AzureClusterNetworking(); - $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; - $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); - $networkingPodAddressCidrBlocks = []; - $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); - $networkingServiceAddressCidrBlocks = []; - $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); - $azureCluster->setNetworking($azureClusterNetworking); - $azureClusterControlPlane = new AzureControlPlane(); - $controlPlaneVersion = 'controlPlaneVersion648040665'; - $azureClusterControlPlane->setVersion($controlPlaneVersion); - $controlPlaneSshConfig = new AzureSshConfig(); - $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; - $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); - $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); - $azureCluster->setControlPlane($azureClusterControlPlane); - $azureClusterAuthorization = new AzureAuthorization(); - $azureCluster->setAuthorization($azureClusterAuthorization); - $azureClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $azureClusterFleet->setProject($fleetProject); - $azureCluster->setFleet($azureClusterFleet); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAzureCluster($azureCluster, $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.gkemulticloud.v1.AzureClusters/UpdateAzureCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAzureCluster(); - $this->assertProtobufEquals($azureCluster, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAzureClusterTest'); - $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 updateAzureClusterExceptionTest() - { - $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/updateAzureClusterTest'); - $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 - $azureCluster = new AzureCluster(); - $azureClusterAzureRegion = 'azureClusterAzureRegion-1036501768'; - $azureCluster->setAzureRegion($azureClusterAzureRegion); - $azureClusterResourceGroupId = 'azureClusterResourceGroupId-1683734495'; - $azureCluster->setResourceGroupId($azureClusterResourceGroupId); - $azureClusterNetworking = new AzureClusterNetworking(); - $networkingVirtualNetworkId = 'networkingVirtualNetworkId-516550606'; - $azureClusterNetworking->setVirtualNetworkId($networkingVirtualNetworkId); - $networkingPodAddressCidrBlocks = []; - $azureClusterNetworking->setPodAddressCidrBlocks($networkingPodAddressCidrBlocks); - $networkingServiceAddressCidrBlocks = []; - $azureClusterNetworking->setServiceAddressCidrBlocks($networkingServiceAddressCidrBlocks); - $azureCluster->setNetworking($azureClusterNetworking); - $azureClusterControlPlane = new AzureControlPlane(); - $controlPlaneVersion = 'controlPlaneVersion648040665'; - $azureClusterControlPlane->setVersion($controlPlaneVersion); - $controlPlaneSshConfig = new AzureSshConfig(); - $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; - $controlPlaneSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); - $azureClusterControlPlane->setSshConfig($controlPlaneSshConfig); - $azureCluster->setControlPlane($azureClusterControlPlane); - $azureClusterAuthorization = new AzureAuthorization(); - $azureCluster->setAuthorization($azureClusterAuthorization); - $azureClusterFleet = new Fleet(); - $fleetProject = 'fleetProject604893675'; - $azureClusterFleet->setProject($fleetProject); - $azureCluster->setFleet($azureClusterFleet); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAzureCluster($azureCluster, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAzureClusterTest'); - 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 updateAzureNodePoolTest() - { - $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/updateAzureNodePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $version = 'version351608024'; - $subnetId = 'subnetId373593405'; - $uid = 'uid115792'; - $reconciling = false; - $etag = 'etag3123477'; - $azureAvailabilityZone = 'azureAvailabilityZone541920864'; - $expectedResponse = new AzureNodePool(); - $expectedResponse->setName($name); - $expectedResponse->setVersion($version); - $expectedResponse->setSubnetId($subnetId); - $expectedResponse->setUid($uid); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateAzureNodePoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $azureNodePool = new AzureNodePool(); - $azureNodePoolVersion = 'azureNodePoolVersion349490987'; - $azureNodePool->setVersion($azureNodePoolVersion); - $azureNodePoolConfig = new AzureNodeConfig(); - $configSshConfig = new AzureSshConfig(); - $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; - $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); - $azureNodePoolConfig->setSshConfig($configSshConfig); - $azureNodePool->setConfig($azureNodePoolConfig); - $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; - $azureNodePool->setSubnetId($azureNodePoolSubnetId); - $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); - $autoscalingMinNodeCount = 1464441581; - $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); - $autoscalingMaxNodeCount = 1938867647; - $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); - $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); - $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); - $maxPodsConstraintMaxPodsPerNode = 1072618940; - $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); - $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAzureNodePool($azureNodePool, $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.gkemulticloud.v1.AzureClusters/UpdateAzureNodePool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAzureNodePool(); - $this->assertProtobufEquals($azureNodePool, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAzureNodePoolTest'); - $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 updateAzureNodePoolExceptionTest() - { - $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/updateAzureNodePoolTest'); - $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 - $azureNodePool = new AzureNodePool(); - $azureNodePoolVersion = 'azureNodePoolVersion349490987'; - $azureNodePool->setVersion($azureNodePoolVersion); - $azureNodePoolConfig = new AzureNodeConfig(); - $configSshConfig = new AzureSshConfig(); - $sshConfigAuthorizedKey = 'sshConfigAuthorizedKey1626409850'; - $configSshConfig->setAuthorizedKey($sshConfigAuthorizedKey); - $azureNodePoolConfig->setSshConfig($configSshConfig); - $azureNodePool->setConfig($azureNodePoolConfig); - $azureNodePoolSubnetId = 'azureNodePoolSubnetId-2131787419'; - $azureNodePool->setSubnetId($azureNodePoolSubnetId); - $azureNodePoolAutoscaling = new AzureNodePoolAutoscaling(); - $autoscalingMinNodeCount = 1464441581; - $azureNodePoolAutoscaling->setMinNodeCount($autoscalingMinNodeCount); - $autoscalingMaxNodeCount = 1938867647; - $azureNodePoolAutoscaling->setMaxNodeCount($autoscalingMaxNodeCount); - $azureNodePool->setAutoscaling($azureNodePoolAutoscaling); - $azureNodePoolMaxPodsConstraint = new MaxPodsConstraint(); - $maxPodsConstraintMaxPodsPerNode = 1072618940; - $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); - $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); - $updateMask = new FieldMask(); - $response = $gapicClient->updateAzureNodePool($azureNodePool, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateAzureNodePoolTest'); - 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()); - } -} diff --git a/GkeMultiCloud/tests/Unit/V1/Client/AttachedClustersClientTest.php b/GkeMultiCloud/tests/Unit/V1/Client/AttachedClustersClientTest.php index 67d612dd5cc3..d8503301b261 100644 --- a/GkeMultiCloud/tests/Unit/V1/Client/AttachedClustersClientTest.php +++ b/GkeMultiCloud/tests/Unit/V1/Client/AttachedClustersClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return AttachedClustersClient */ @@ -204,12 +206,15 @@ public function createAttachedClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -282,8 +287,7 @@ public function deleteAttachedClusterTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - $request = (new DeleteAttachedClusterRequest()) - ->setName($formattedName); + $request = (new DeleteAttachedClusterRequest())->setName($formattedName); $response = $gapicClient->deleteAttachedCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -339,17 +343,19 @@ public function deleteAttachedClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - $request = (new DeleteAttachedClusterRequest()) - ->setName($formattedName); + $request = (new DeleteAttachedClusterRequest())->setName($formattedName); $response = $gapicClient->deleteAttachedCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -405,7 +411,10 @@ public function generateAttachedClusterAgentTokenTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterAgentToken', $actualFuncCall); + $this->assertSame( + '/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterAgentToken', + $actualFuncCall + ); $actualValue = $actualRequestObject->getAttachedCluster(); $this->assertProtobufEquals($formattedAttachedCluster, $actualValue); $actualValue = $actualRequestObject->getSubjectToken(); @@ -428,12 +437,15 @@ public function generateAttachedClusterAgentTokenExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedAttachedCluster = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); @@ -485,7 +497,10 @@ public function generateAttachedClusterInstallManifestTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterInstallManifest', $actualFuncCall); + $this->assertSame( + '/google.cloud.gkemulticloud.v1.AttachedClusters/GenerateAttachedClusterInstallManifest', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getAttachedClusterId(); @@ -506,12 +521,15 @@ public function generateAttachedClusterInstallManifestExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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]'); @@ -565,8 +583,7 @@ public function getAttachedClusterTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - $request = (new GetAttachedClusterRequest()) - ->setName($formattedName); + $request = (new GetAttachedClusterRequest())->setName($formattedName); $response = $gapicClient->getAttachedCluster($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -590,17 +607,19 @@ public function getAttachedClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->attachedClusterName('[PROJECT]', '[LOCATION]', '[ATTACHED_CLUSTER]'); - $request = (new GetAttachedClusterRequest()) - ->setName($formattedName); + $request = (new GetAttachedClusterRequest())->setName($formattedName); try { $gapicClient->getAttachedCluster($request); // If the $gapicClient method call did not throw, fail the test @@ -629,8 +648,7 @@ public function getAttachedServerConfigTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->attachedServerConfigName('[PROJECT]', '[LOCATION]'); - $request = (new GetAttachedServerConfigRequest()) - ->setName($formattedName); + $request = (new GetAttachedServerConfigRequest())->setName($formattedName); $response = $gapicClient->getAttachedServerConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -654,17 +672,19 @@ public function getAttachedServerConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->attachedServerConfigName('[PROJECT]', '[LOCATION]'); - $request = (new GetAttachedServerConfigRequest()) - ->setName($formattedName); + $request = (new GetAttachedServerConfigRequest())->setName($formattedName); try { $gapicClient->getAttachedServerConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -796,12 +816,15 @@ public function importAttachedClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -846,17 +869,14 @@ public function listAttachedClustersTest() // Mock response $nextPageToken = ''; $attachedClustersElement = new AttachedCluster(); - $attachedClusters = [ - $attachedClustersElement, - ]; + $attachedClusters = [$attachedClustersElement]; $expectedResponse = new ListAttachedClustersResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAttachedClusters($attachedClusters); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListAttachedClustersRequest()) - ->setParent($formattedParent); + $request = (new ListAttachedClustersRequest())->setParent($formattedParent); $response = $gapicClient->listAttachedClusters($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -883,17 +903,19 @@ public function listAttachedClustersExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListAttachedClustersRequest()) - ->setParent($formattedParent); + $request = (new ListAttachedClustersRequest())->setParent($formattedParent); try { $gapicClient->listAttachedClusters($request); // If the $gapicClient method call did not throw, fail the test @@ -1027,12 +1049,15 @@ public function updateAttachedClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $attachedCluster = new AttachedCluster(); diff --git a/GkeMultiCloud/tests/Unit/V1/Client/AwsClustersClientTest.php b/GkeMultiCloud/tests/Unit/V1/Client/AwsClustersClientTest.php index 6f139fc7e8f7..e5e7e198b86e 100644 --- a/GkeMultiCloud/tests/Unit/V1/Client/AwsClustersClientTest.php +++ b/GkeMultiCloud/tests/Unit/V1/Client/AwsClustersClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return AwsClustersClient */ @@ -247,12 +249,15 @@ public function createAwsClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -450,12 +455,15 @@ public function createAwsNodePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); @@ -540,8 +548,7 @@ public function deleteAwsClusterTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new DeleteAwsClusterRequest()) - ->setName($formattedName); + $request = (new DeleteAwsClusterRequest())->setName($formattedName); $response = $gapicClient->deleteAwsCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -597,17 +604,19 @@ public function deleteAwsClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new DeleteAwsClusterRequest()) - ->setName($formattedName); + $request = (new DeleteAwsClusterRequest())->setName($formattedName); $response = $gapicClient->deleteAwsCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -661,8 +670,7 @@ public function deleteAwsNodePoolTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $request = (new DeleteAwsNodePoolRequest()) - ->setName($formattedName); + $request = (new DeleteAwsNodePoolRequest())->setName($formattedName); $response = $gapicClient->deleteAwsNodePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -718,17 +726,19 @@ public function deleteAwsNodePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $request = (new DeleteAwsNodePoolRequest()) - ->setName($formattedName); + $request = (new DeleteAwsNodePoolRequest())->setName($formattedName); $response = $gapicClient->deleteAwsNodePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -766,8 +776,7 @@ public function generateAwsAccessTokenTest() $transport->addResponse($expectedResponse); // Mock request $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new GenerateAwsAccessTokenRequest()) - ->setAwsCluster($formattedAwsCluster); + $request = (new GenerateAwsAccessTokenRequest())->setAwsCluster($formattedAwsCluster); $response = $gapicClient->generateAwsAccessToken($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -791,17 +800,19 @@ public function generateAwsAccessTokenExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new GenerateAwsAccessTokenRequest()) - ->setAwsCluster($formattedAwsCluster); + $request = (new GenerateAwsAccessTokenRequest())->setAwsCluster($formattedAwsCluster); try { $gapicClient->generateAwsAccessToken($request); // If the $gapicClient method call did not throw, fail the test @@ -871,12 +882,15 @@ public function generateAwsClusterAgentTokenExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); @@ -930,8 +944,7 @@ public function getAwsClusterTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new GetAwsClusterRequest()) - ->setName($formattedName); + $request = (new GetAwsClusterRequest())->setName($formattedName); $response = $gapicClient->getAwsCluster($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -955,17 +968,19 @@ public function getAwsClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new GetAwsClusterRequest()) - ->setName($formattedName); + $request = (new GetAwsClusterRequest())->setName($formattedName); try { $gapicClient->getAwsCluster($request); // If the $gapicClient method call did not throw, fail the test @@ -992,8 +1007,7 @@ public function getAwsJsonWebKeysTest() $transport->addResponse($expectedResponse); // Mock request $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new GetAwsJsonWebKeysRequest()) - ->setAwsCluster($formattedAwsCluster); + $request = (new GetAwsJsonWebKeysRequest())->setAwsCluster($formattedAwsCluster); $response = $gapicClient->getAwsJsonWebKeys($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1017,17 +1031,19 @@ public function getAwsJsonWebKeysExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new GetAwsJsonWebKeysRequest()) - ->setAwsCluster($formattedAwsCluster); + $request = (new GetAwsJsonWebKeysRequest())->setAwsCluster($formattedAwsCluster); try { $gapicClient->getAwsJsonWebKeys($request); // If the $gapicClient method call did not throw, fail the test @@ -1066,8 +1082,7 @@ public function getAwsNodePoolTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $request = (new GetAwsNodePoolRequest()) - ->setName($formattedName); + $request = (new GetAwsNodePoolRequest())->setName($formattedName); $response = $gapicClient->getAwsNodePool($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1091,17 +1106,19 @@ public function getAwsNodePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $request = (new GetAwsNodePoolRequest()) - ->setName($formattedName); + $request = (new GetAwsNodePoolRequest())->setName($formattedName); try { $gapicClient->getAwsNodePool($request); // If the $gapicClient method call did not throw, fail the test @@ -1132,8 +1149,7 @@ public function getAwsOpenIdConfigTest() $transport->addResponse($expectedResponse); // Mock request $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new GetAwsOpenIdConfigRequest()) - ->setAwsCluster($formattedAwsCluster); + $request = (new GetAwsOpenIdConfigRequest())->setAwsCluster($formattedAwsCluster); $response = $gapicClient->getAwsOpenIdConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1157,17 +1173,19 @@ public function getAwsOpenIdConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedAwsCluster = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new GetAwsOpenIdConfigRequest()) - ->setAwsCluster($formattedAwsCluster); + $request = (new GetAwsOpenIdConfigRequest())->setAwsCluster($formattedAwsCluster); try { $gapicClient->getAwsOpenIdConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -1196,8 +1214,7 @@ public function getAwsServerConfigTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->awsServerConfigName('[PROJECT]', '[LOCATION]'); - $request = (new GetAwsServerConfigRequest()) - ->setName($formattedName); + $request = (new GetAwsServerConfigRequest())->setName($formattedName); $response = $gapicClient->getAwsServerConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1221,17 +1238,19 @@ public function getAwsServerConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->awsServerConfigName('[PROJECT]', '[LOCATION]'); - $request = (new GetAwsServerConfigRequest()) - ->setName($formattedName); + $request = (new GetAwsServerConfigRequest())->setName($formattedName); try { $gapicClient->getAwsServerConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -1256,17 +1275,14 @@ public function listAwsClustersTest() // Mock response $nextPageToken = ''; $awsClustersElement = new AwsCluster(); - $awsClusters = [ - $awsClustersElement, - ]; + $awsClusters = [$awsClustersElement]; $expectedResponse = new ListAwsClustersResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAwsClusters($awsClusters); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListAwsClustersRequest()) - ->setParent($formattedParent); + $request = (new ListAwsClustersRequest())->setParent($formattedParent); $response = $gapicClient->listAwsClusters($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1293,17 +1309,19 @@ public function listAwsClustersExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListAwsClustersRequest()) - ->setParent($formattedParent); + $request = (new ListAwsClustersRequest())->setParent($formattedParent); try { $gapicClient->listAwsClusters($request); // If the $gapicClient method call did not throw, fail the test @@ -1328,17 +1346,14 @@ public function listAwsNodePoolsTest() // Mock response $nextPageToken = ''; $awsNodePoolsElement = new AwsNodePool(); - $awsNodePools = [ - $awsNodePoolsElement, - ]; + $awsNodePools = [$awsNodePoolsElement]; $expectedResponse = new ListAwsNodePoolsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAwsNodePools($awsNodePools); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new ListAwsNodePoolsRequest()) - ->setParent($formattedParent); + $request = (new ListAwsNodePoolsRequest())->setParent($formattedParent); $response = $gapicClient->listAwsNodePools($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1365,17 +1380,19 @@ public function listAwsNodePoolsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]'); - $request = (new ListAwsNodePoolsRequest()) - ->setParent($formattedParent); + $request = (new ListAwsNodePoolsRequest())->setParent($formattedParent); try { $gapicClient->listAwsNodePools($request); // If the $gapicClient method call did not throw, fail the test @@ -1432,8 +1449,7 @@ public function rollbackAwsNodePoolUpdateTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $request = (new RollbackAwsNodePoolUpdateRequest()) - ->setName($formattedName); + $request = (new RollbackAwsNodePoolUpdateRequest())->setName($formattedName); $response = $gapicClient->rollbackAwsNodePoolUpdate($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1489,17 +1505,19 @@ public function rollbackAwsNodePoolUpdateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->awsNodePoolName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]', '[AWS_NODE_POOL]'); - $request = (new RollbackAwsNodePoolUpdateRequest()) - ->setName($formattedName); + $request = (new RollbackAwsNodePoolUpdateRequest())->setName($formattedName); $response = $gapicClient->rollbackAwsNodePoolUpdate($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1606,9 +1624,7 @@ public function updateAwsClusterTest() $awsClusterFleet->setProject($fleetProject); $awsCluster->setFleet($awsClusterFleet); $updateMask = new FieldMask(); - $request = (new UpdateAwsClusterRequest()) - ->setAwsCluster($awsCluster) - ->setUpdateMask($updateMask); + $request = (new UpdateAwsClusterRequest())->setAwsCluster($awsCluster)->setUpdateMask($updateMask); $response = $gapicClient->updateAwsCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1666,12 +1682,15 @@ public function updateAwsClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $awsCluster = new AwsCluster(); @@ -1712,9 +1731,7 @@ public function updateAwsClusterExceptionTest() $awsClusterFleet->setProject($fleetProject); $awsCluster->setFleet($awsClusterFleet); $updateMask = new FieldMask(); - $request = (new UpdateAwsClusterRequest()) - ->setAwsCluster($awsCluster) - ->setUpdateMask($updateMask); + $request = (new UpdateAwsClusterRequest())->setAwsCluster($awsCluster)->setUpdateMask($updateMask); $response = $gapicClient->updateAwsCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1803,9 +1820,7 @@ public function updateAwsNodePoolTest() $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); $updateMask = new FieldMask(); - $request = (new UpdateAwsNodePoolRequest()) - ->setAwsNodePool($awsNodePool) - ->setUpdateMask($updateMask); + $request = (new UpdateAwsNodePoolRequest())->setAwsNodePool($awsNodePool)->setUpdateMask($updateMask); $response = $gapicClient->updateAwsNodePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1863,12 +1878,15 @@ public function updateAwsNodePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $awsNodePool = new AwsNodePool(); @@ -1895,9 +1913,7 @@ public function updateAwsNodePoolExceptionTest() $awsNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); $awsNodePool->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint); $updateMask = new FieldMask(); - $request = (new UpdateAwsNodePoolRequest()) - ->setAwsNodePool($awsNodePool) - ->setUpdateMask($updateMask); + $request = (new UpdateAwsNodePoolRequest())->setAwsNodePool($awsNodePool)->setUpdateMask($updateMask); $response = $gapicClient->updateAwsNodePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/GkeMultiCloud/tests/Unit/V1/Client/AzureClustersClientTest.php b/GkeMultiCloud/tests/Unit/V1/Client/AzureClustersClientTest.php index a16b92d02cae..1f78f62733b8 100644 --- a/GkeMultiCloud/tests/Unit/V1/Client/AzureClustersClientTest.php +++ b/GkeMultiCloud/tests/Unit/V1/Client/AzureClustersClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return AzureClustersClient */ @@ -214,12 +216,15 @@ public function createAzureClientExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -397,12 +402,15 @@ public function createAzureClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -590,12 +598,15 @@ public function createAzureNodePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); @@ -678,8 +689,7 @@ public function deleteAzureClientTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - $request = (new DeleteAzureClientRequest()) - ->setName($formattedName); + $request = (new DeleteAzureClientRequest())->setName($formattedName); $response = $gapicClient->deleteAzureClient($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -735,17 +745,19 @@ public function deleteAzureClientExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - $request = (new DeleteAzureClientRequest()) - ->setName($formattedName); + $request = (new DeleteAzureClientRequest())->setName($formattedName); $response = $gapicClient->deleteAzureClient($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -799,8 +811,7 @@ public function deleteAzureClusterTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new DeleteAzureClusterRequest()) - ->setName($formattedName); + $request = (new DeleteAzureClusterRequest())->setName($formattedName); $response = $gapicClient->deleteAzureCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -856,17 +867,19 @@ public function deleteAzureClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new DeleteAzureClusterRequest()) - ->setName($formattedName); + $request = (new DeleteAzureClusterRequest())->setName($formattedName); $response = $gapicClient->deleteAzureCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -919,9 +932,13 @@ public function deleteAzureNodePoolTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - $request = (new DeleteAzureNodePoolRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->azureNodePoolName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]', + '[AZURE_NODE_POOL]' + ); + $request = (new DeleteAzureNodePoolRequest())->setName($formattedName); $response = $gapicClient->deleteAzureNodePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -977,17 +994,24 @@ public function deleteAzureNodePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - $request = (new DeleteAzureNodePoolRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->azureNodePoolName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]', + '[AZURE_NODE_POOL]' + ); + $request = (new DeleteAzureNodePoolRequest())->setName($formattedName); $response = $gapicClient->deleteAzureNodePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1025,8 +1049,7 @@ public function generateAzureAccessTokenTest() $transport->addResponse($expectedResponse); // Mock request $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new GenerateAzureAccessTokenRequest()) - ->setAzureCluster($formattedAzureCluster); + $request = (new GenerateAzureAccessTokenRequest())->setAzureCluster($formattedAzureCluster); $response = $gapicClient->generateAzureAccessToken($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1050,17 +1073,19 @@ public function generateAzureAccessTokenExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new GenerateAzureAccessTokenRequest()) - ->setAzureCluster($formattedAzureCluster); + $request = (new GenerateAzureAccessTokenRequest())->setAzureCluster($formattedAzureCluster); try { $gapicClient->generateAzureAccessToken($request); // If the $gapicClient method call did not throw, fail the test @@ -1107,7 +1132,10 @@ public function generateAzureClusterAgentTokenTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkemulticloud.v1.AzureClusters/GenerateAzureClusterAgentToken', $actualFuncCall); + $this->assertSame( + '/google.cloud.gkemulticloud.v1.AzureClusters/GenerateAzureClusterAgentToken', + $actualFuncCall + ); $actualValue = $actualRequestObject->getAzureCluster(); $this->assertProtobufEquals($formattedAzureCluster, $actualValue); $actualValue = $actualRequestObject->getSubjectToken(); @@ -1130,12 +1158,15 @@ public function generateAzureClusterAgentTokenExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); @@ -1185,8 +1216,7 @@ public function getAzureClientTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - $request = (new GetAzureClientRequest()) - ->setName($formattedName); + $request = (new GetAzureClientRequest())->setName($formattedName); $response = $gapicClient->getAzureClient($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1210,17 +1240,19 @@ public function getAzureClientExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]'); - $request = (new GetAzureClientRequest()) - ->setName($formattedName); + $request = (new GetAzureClientRequest())->setName($formattedName); try { $gapicClient->getAzureClient($request); // If the $gapicClient method call did not throw, fail the test @@ -1267,8 +1299,7 @@ public function getAzureClusterTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new GetAzureClusterRequest()) - ->setName($formattedName); + $request = (new GetAzureClusterRequest())->setName($formattedName); $response = $gapicClient->getAzureCluster($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1292,17 +1323,19 @@ public function getAzureClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new GetAzureClusterRequest()) - ->setName($formattedName); + $request = (new GetAzureClusterRequest())->setName($formattedName); try { $gapicClient->getAzureCluster($request); // If the $gapicClient method call did not throw, fail the test @@ -1329,8 +1362,7 @@ public function getAzureJsonWebKeysTest() $transport->addResponse($expectedResponse); // Mock request $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new GetAzureJsonWebKeysRequest()) - ->setAzureCluster($formattedAzureCluster); + $request = (new GetAzureJsonWebKeysRequest())->setAzureCluster($formattedAzureCluster); $response = $gapicClient->getAzureJsonWebKeys($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1354,17 +1386,19 @@ public function getAzureJsonWebKeysExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new GetAzureJsonWebKeysRequest()) - ->setAzureCluster($formattedAzureCluster); + $request = (new GetAzureJsonWebKeysRequest())->setAzureCluster($formattedAzureCluster); try { $gapicClient->getAzureJsonWebKeys($request); // If the $gapicClient method call did not throw, fail the test @@ -1404,9 +1438,13 @@ public function getAzureNodePoolTest() $expectedResponse->setAzureAvailabilityZone($azureAvailabilityZone); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - $request = (new GetAzureNodePoolRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->azureNodePoolName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]', + '[AZURE_NODE_POOL]' + ); + $request = (new GetAzureNodePoolRequest())->setName($formattedName); $response = $gapicClient->getAzureNodePool($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1430,17 +1468,24 @@ public function getAzureNodePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->azureNodePoolName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]', '[AZURE_NODE_POOL]'); - $request = (new GetAzureNodePoolRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->azureNodePoolName( + '[PROJECT]', + '[LOCATION]', + '[AZURE_CLUSTER]', + '[AZURE_NODE_POOL]' + ); + $request = (new GetAzureNodePoolRequest())->setName($formattedName); try { $gapicClient->getAzureNodePool($request); // If the $gapicClient method call did not throw, fail the test @@ -1471,8 +1516,7 @@ public function getAzureOpenIdConfigTest() $transport->addResponse($expectedResponse); // Mock request $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new GetAzureOpenIdConfigRequest()) - ->setAzureCluster($formattedAzureCluster); + $request = (new GetAzureOpenIdConfigRequest())->setAzureCluster($formattedAzureCluster); $response = $gapicClient->getAzureOpenIdConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1496,17 +1540,19 @@ public function getAzureOpenIdConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedAzureCluster = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new GetAzureOpenIdConfigRequest()) - ->setAzureCluster($formattedAzureCluster); + $request = (new GetAzureOpenIdConfigRequest())->setAzureCluster($formattedAzureCluster); try { $gapicClient->getAzureOpenIdConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -1535,8 +1581,7 @@ public function getAzureServerConfigTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->azureServerConfigName('[PROJECT]', '[LOCATION]'); - $request = (new GetAzureServerConfigRequest()) - ->setName($formattedName); + $request = (new GetAzureServerConfigRequest())->setName($formattedName); $response = $gapicClient->getAzureServerConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1560,17 +1605,19 @@ public function getAzureServerConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->azureServerConfigName('[PROJECT]', '[LOCATION]'); - $request = (new GetAzureServerConfigRequest()) - ->setName($formattedName); + $request = (new GetAzureServerConfigRequest())->setName($formattedName); try { $gapicClient->getAzureServerConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -1595,17 +1642,14 @@ public function listAzureClientsTest() // Mock response $nextPageToken = ''; $azureClientsElement = new AzureClient(); - $azureClients = [ - $azureClientsElement, - ]; + $azureClients = [$azureClientsElement]; $expectedResponse = new ListAzureClientsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAzureClients($azureClients); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListAzureClientsRequest()) - ->setParent($formattedParent); + $request = (new ListAzureClientsRequest())->setParent($formattedParent); $response = $gapicClient->listAzureClients($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1632,17 +1676,19 @@ public function listAzureClientsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListAzureClientsRequest()) - ->setParent($formattedParent); + $request = (new ListAzureClientsRequest())->setParent($formattedParent); try { $gapicClient->listAzureClients($request); // If the $gapicClient method call did not throw, fail the test @@ -1667,17 +1713,14 @@ public function listAzureClustersTest() // Mock response $nextPageToken = ''; $azureClustersElement = new AzureCluster(); - $azureClusters = [ - $azureClustersElement, - ]; + $azureClusters = [$azureClustersElement]; $expectedResponse = new ListAzureClustersResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAzureClusters($azureClusters); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListAzureClustersRequest()) - ->setParent($formattedParent); + $request = (new ListAzureClustersRequest())->setParent($formattedParent); $response = $gapicClient->listAzureClusters($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1704,17 +1747,19 @@ public function listAzureClustersExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListAzureClustersRequest()) - ->setParent($formattedParent); + $request = (new ListAzureClustersRequest())->setParent($formattedParent); try { $gapicClient->listAzureClusters($request); // If the $gapicClient method call did not throw, fail the test @@ -1739,17 +1784,14 @@ public function listAzureNodePoolsTest() // Mock response $nextPageToken = ''; $azureNodePoolsElement = new AzureNodePool(); - $azureNodePools = [ - $azureNodePoolsElement, - ]; + $azureNodePools = [$azureNodePoolsElement]; $expectedResponse = new ListAzureNodePoolsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAzureNodePools($azureNodePools); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new ListAzureNodePoolsRequest()) - ->setParent($formattedParent); + $request = (new ListAzureNodePoolsRequest())->setParent($formattedParent); $response = $gapicClient->listAzureNodePools($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1776,17 +1818,19 @@ public function listAzureNodePoolsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->azureClusterName('[PROJECT]', '[LOCATION]', '[AZURE_CLUSTER]'); - $request = (new ListAzureNodePoolsRequest()) - ->setParent($formattedParent); + $request = (new ListAzureNodePoolsRequest())->setParent($formattedParent); try { $gapicClient->listAzureNodePools($request); // If the $gapicClient method call did not throw, fail the test @@ -1878,9 +1922,7 @@ public function updateAzureClusterTest() $azureClusterFleet->setProject($fleetProject); $azureCluster->setFleet($azureClusterFleet); $updateMask = new FieldMask(); - $request = (new UpdateAzureClusterRequest()) - ->setAzureCluster($azureCluster) - ->setUpdateMask($updateMask); + $request = (new UpdateAzureClusterRequest())->setAzureCluster($azureCluster)->setUpdateMask($updateMask); $response = $gapicClient->updateAzureCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1938,12 +1980,15 @@ public function updateAzureClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $azureCluster = new AzureCluster(); @@ -1974,9 +2019,7 @@ public function updateAzureClusterExceptionTest() $azureClusterFleet->setProject($fleetProject); $azureCluster->setFleet($azureClusterFleet); $updateMask = new FieldMask(); - $request = (new UpdateAzureClusterRequest()) - ->setAzureCluster($azureCluster) - ->setUpdateMask($updateMask); + $request = (new UpdateAzureClusterRequest())->setAzureCluster($azureCluster)->setUpdateMask($updateMask); $response = $gapicClient->updateAzureCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2065,9 +2108,7 @@ public function updateAzureNodePoolTest() $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); $updateMask = new FieldMask(); - $request = (new UpdateAzureNodePoolRequest()) - ->setAzureNodePool($azureNodePool) - ->setUpdateMask($updateMask); + $request = (new UpdateAzureNodePoolRequest())->setAzureNodePool($azureNodePool)->setUpdateMask($updateMask); $response = $gapicClient->updateAzureNodePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2125,12 +2166,15 @@ public function updateAzureNodePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $azureNodePool = new AzureNodePool(); @@ -2155,9 +2199,7 @@ public function updateAzureNodePoolExceptionTest() $azureNodePoolMaxPodsConstraint->setMaxPodsPerNode($maxPodsConstraintMaxPodsPerNode); $azureNodePool->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint); $updateMask = new FieldMask(); - $request = (new UpdateAzureNodePoolRequest()) - ->setAzureNodePool($azureNodePool) - ->setUpdateMask($updateMask); + $request = (new UpdateAzureNodePoolRequest())->setAzureNodePool($azureNodePool)->setUpdateMask($updateMask); $response = $gapicClient->updateAzureNodePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/Run/.OwlBot.yaml b/Run/.OwlBot.yaml index 6be4af6a49bf..cfde76614889 100644 --- a/Run/.OwlBot.yaml +++ b/Run/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/run/v2/.*-php/(.*) - dest: /owl-bot-staging/Run/v2/$1 + - source: /google/cloud/run/(v2)/.*-php/(.*) + dest: /owl-bot-staging/Run/$1/$2 api-name: Run diff --git a/Run/README.md b/Run/README.md index ba959c95256d..9c669e5a211f 100644 --- a/Run/README.md +++ b/Run/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/Run/owlbot.py b/Run/owlbot.py index 52d48b710831..3825cc9e5b5d 100644 --- a/Run/owlbot.py +++ b/Run/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. @@ -30,13 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php" - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -47,33 +41,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', @@ -82,8 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) + '--print-width=120']) diff --git a/Run/src/V2/BinaryAuthorization.php b/Run/src/V2/BinaryAuthorization.php index 22ed7c36f4b0..498720af47ce 100644 --- a/Run/src/V2/BinaryAuthorization.php +++ b/Run/src/V2/BinaryAuthorization.php @@ -23,7 +23,7 @@ class BinaryAuthorization extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string breakglass_justification = 2; */ - private $breakglass_justification = ''; + protected $breakglass_justification = ''; protected $binauthz_method; /** diff --git a/Run/src/V2/CancelExecutionRequest.php b/Run/src/V2/CancelExecutionRequest.php index 55edb901d52f..771e535b0e3a 100644 --- a/Run/src/V2/CancelExecutionRequest.php +++ b/Run/src/V2/CancelExecutionRequest.php @@ -23,21 +23,21 @@ class CancelExecutionRequest 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 = ''; /** * Indicates that the request should be validated without actually * cancelling any resources. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * A system-generated fingerprint for this version of the resource. * This may be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 3; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The name of the Execution to cancel. diff --git a/Run/src/V2/Client/ExecutionsClient.php b/Run/src/V2/Client/ExecutionsClient.php index 689fd2f390d0..62672d5e245e 100644 --- a/Run/src/V2/Client/ExecutionsClient.php +++ b/Run/src/V2/Client/ExecutionsClient.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 execution * resource. diff --git a/Run/src/V2/Client/JobsClient.php b/Run/src/V2/Client/JobsClient.php index 1a8056deff88..8eb9b061a8f5 100644 --- a/Run/src/V2/Client/JobsClient.php +++ b/Run/src/V2/Client/JobsClient.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 connector * resource. @@ -593,8 +612,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/Run/src/V2/Client/RevisionsClient.php b/Run/src/V2/Client/RevisionsClient.php index 95ec5f4e6b7a..0830fc8121dc 100644 --- a/Run/src/V2/Client/RevisionsClient.php +++ b/Run/src/V2/Client/RevisionsClient.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 revision * resource. diff --git a/Run/src/V2/Client/ServicesClient.php b/Run/src/V2/Client/ServicesClient.php index b50bd3a5820c..a60001d105bb 100644 --- a/Run/src/V2/Client/ServicesClient.php +++ b/Run/src/V2/Client/ServicesClient.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 connector * resource. @@ -566,8 +585,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/Run/src/V2/Client/TasksClient.php b/Run/src/V2/Client/TasksClient.php index 9811514e1c2d..9efcb0bbc594 100644 --- a/Run/src/V2/Client/TasksClient.php +++ b/Run/src/V2/Client/TasksClient.php @@ -1,6 +1,6 @@ render([ 'project' => $project, 'location' => $location, diff --git a/Run/src/V2/Condition.php b/Run/src/V2/Condition.php index b2a1e905ddb7..1150a60c6473 100644 --- a/Run/src/V2/Condition.php +++ b/Run/src/V2/Condition.php @@ -24,31 +24,31 @@ class Condition extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string type = 1; */ - private $type = ''; + protected $type = ''; /** * State of the condition. * * Generated from protobuf field .google.cloud.run.v2.Condition.State state = 2; */ - private $state = 0; + protected $state = 0; /** * Human readable message indicating details about the current status. * * Generated from protobuf field string message = 3; */ - private $message = ''; + protected $message = ''; /** * Last time the condition transitioned from one status to another. * * Generated from protobuf field .google.protobuf.Timestamp last_transition_time = 4; */ - private $last_transition_time = null; + protected $last_transition_time = null; /** * How to interpret failures of this condition, one of Error, Warning, Info * * Generated from protobuf field .google.cloud.run.v2.Condition.Severity severity = 5; */ - private $severity = 0; + protected $severity = 0; protected $reasons; /** diff --git a/Run/src/V2/Container.php b/Run/src/V2/Container.php index ba2f943a7587..1dc5d80d18b9 100644 --- a/Run/src/V2/Container.php +++ b/Run/src/V2/Container.php @@ -24,7 +24,7 @@ class Container extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Required. Name of the container image in Dockerhub, Google Artifact * Registry, or Google Container Registry. If the host is not provided, @@ -32,7 +32,7 @@ class Container extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string image = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $image = ''; + protected $image = ''; /** * Entrypoint array. Not executed within a shell. * The docker image's ENTRYPOINT is used if this is not provided. @@ -58,7 +58,7 @@ class Container extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.ResourceRequirements resources = 6; */ - private $resources = null; + protected $resources = null; /** * List of ports to expose from the container. Only a single port can be * specified. The specified ports must be listening on all interfaces @@ -82,14 +82,14 @@ class Container extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string working_dir = 9; */ - private $working_dir = ''; + protected $working_dir = ''; /** * Periodic probe of container liveness. * Container will be restarted if the probe fails. * * Generated from protobuf field .google.cloud.run.v2.Probe liveness_probe = 10; */ - private $liveness_probe = null; + protected $liveness_probe = null; /** * Startup probe of application within the container. * All other probes are disabled if a startup probe is provided, until it @@ -98,7 +98,7 @@ class Container extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.Probe startup_probe = 11; */ - private $startup_probe = null; + protected $startup_probe = null; /** * Names of the containers that must start before this container. * diff --git a/Run/src/V2/ContainerPort.php b/Run/src/V2/ContainerPort.php index b41bd6a4b818..9fad73b12eed 100644 --- a/Run/src/V2/ContainerPort.php +++ b/Run/src/V2/ContainerPort.php @@ -21,14 +21,14 @@ class ContainerPort extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Port number the container listens on. * This must be a valid TCP port number, 0 < container_port < 65536. * * Generated from protobuf field int32 container_port = 3; */ - private $container_port = 0; + protected $container_port = 0; /** * Constructor. diff --git a/Run/src/V2/CreateJobRequest.php b/Run/src/V2/CreateJobRequest.php index 04227877baac..f201e0ba2b8c 100644 --- a/Run/src/V2/CreateJobRequest.php +++ b/Run/src/V2/CreateJobRequest.php @@ -22,27 +22,27 @@ class CreateJobRequest 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 Job instance to create. * * Generated from protobuf field .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $job = null; + protected $job = null; /** * Required. The unique identifier for the Job. The name of the job becomes * {parent}/jobs/{job_id}. * * Generated from protobuf field string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $job_id = ''; + protected $job_id = ''; /** * Indicates that the request should be validated and default values * populated, without persisting the request or creating any resources. * * Generated from protobuf field bool validate_only = 4; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The location and project in which this Job should be created. diff --git a/Run/src/V2/CreateServiceRequest.php b/Run/src/V2/CreateServiceRequest.php index 3b03a0c74b45..7a5677b8d359 100644 --- a/Run/src/V2/CreateServiceRequest.php +++ b/Run/src/V2/CreateServiceRequest.php @@ -22,13 +22,13 @@ class CreateServiceRequest 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 Service instance to create. * * Generated from protobuf field .google.cloud.run.v2.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $service = null; + protected $service = null; /** * Required. The unique identifier for the Service. It must begin with letter, * and cannot end with hyphen; must contain fewer than 50 characters. @@ -36,14 +36,14 @@ class CreateServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $service_id = ''; + protected $service_id = ''; /** * Indicates that the request should be validated and default values * populated, without persisting the request or creating any resources. * * Generated from protobuf field bool validate_only = 4; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The location and project in which this service should be created. diff --git a/Run/src/V2/DeleteExecutionRequest.php b/Run/src/V2/DeleteExecutionRequest.php index 42aa3f40f6b4..ea7d31e245fe 100644 --- a/Run/src/V2/DeleteExecutionRequest.php +++ b/Run/src/V2/DeleteExecutionRequest.php @@ -23,21 +23,21 @@ 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 = ''; /** * Indicates that the request should be validated without actually * deleting any resources. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * A system-generated fingerprint for this version of the resource. * This may be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 3; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The name of the Execution to delete. diff --git a/Run/src/V2/DeleteJobRequest.php b/Run/src/V2/DeleteJobRequest.php index 459cc1ccc66e..0c4f53d97680 100644 --- a/Run/src/V2/DeleteJobRequest.php +++ b/Run/src/V2/DeleteJobRequest.php @@ -22,21 +22,21 @@ class DeleteJobRequest 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 = ''; /** * Indicates that the request should be validated without actually * deleting any resources. * * Generated from protobuf field bool validate_only = 3; */ - private $validate_only = false; + protected $validate_only = false; /** * A system-generated fingerprint for this version of the * resource. May be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 4; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The full name of the Job. diff --git a/Run/src/V2/DeleteRevisionRequest.php b/Run/src/V2/DeleteRevisionRequest.php index 54543d7168ee..0b7bb2e76937 100644 --- a/Run/src/V2/DeleteRevisionRequest.php +++ b/Run/src/V2/DeleteRevisionRequest.php @@ -24,21 +24,21 @@ class DeleteRevisionRequest 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 = ''; /** * Indicates that the request should be validated without actually * deleting any resources. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * A system-generated fingerprint for this version of the * resource. This may be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 3; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The name of the Revision to delete. diff --git a/Run/src/V2/DeleteServiceRequest.php b/Run/src/V2/DeleteServiceRequest.php index 43cd4df65f86..16182d4a1603 100644 --- a/Run/src/V2/DeleteServiceRequest.php +++ b/Run/src/V2/DeleteServiceRequest.php @@ -22,21 +22,21 @@ class DeleteServiceRequest 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 = ''; /** * Indicates that the request should be validated without actually * deleting any resources. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * A system-generated fingerprint for this version of the * resource. May be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 3; */ - private $etag = ''; + protected $etag = ''; /** * @param string $name Required. The full name of the Service. diff --git a/Run/src/V2/EmptyDirVolumeSource.php b/Run/src/V2/EmptyDirVolumeSource.php index 564f714ca0c8..be49c7f974ba 100644 --- a/Run/src/V2/EmptyDirVolumeSource.php +++ b/Run/src/V2/EmptyDirVolumeSource.php @@ -24,7 +24,7 @@ class EmptyDirVolumeSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.EmptyDirVolumeSource.Medium medium = 1; */ - private $medium = 0; + protected $medium = 0; /** * Limit on the storage usable by this EmptyDir volume. * The size limit is also applicable for memory medium. @@ -38,7 +38,7 @@ class EmptyDirVolumeSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string size_limit = 2; */ - private $size_limit = ''; + protected $size_limit = ''; /** * Constructor. diff --git a/Run/src/V2/EnvVar.php b/Run/src/V2/EnvVar.php index 8a2edd12cd61..68821da16bfa 100644 --- a/Run/src/V2/EnvVar.php +++ b/Run/src/V2/EnvVar.php @@ -21,7 +21,7 @@ class EnvVar extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; protected $values; /** diff --git a/Run/src/V2/EnvVarSource.php b/Run/src/V2/EnvVarSource.php index d53fdf13aa43..99ffb8e651c0 100644 --- a/Run/src/V2/EnvVarSource.php +++ b/Run/src/V2/EnvVarSource.php @@ -20,7 +20,7 @@ class EnvVarSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.SecretKeySelector secret_key_ref = 1; */ - private $secret_key_ref = null; + protected $secret_key_ref = null; /** * Constructor. diff --git a/Run/src/V2/Execution.php b/Run/src/V2/Execution.php index 895236f01f5f..b72c09e5f964 100644 --- a/Run/src/V2/Execution.php +++ b/Run/src/V2/Execution.php @@ -22,7 +22,7 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Server assigned unique identifier for the Execution. The value * is a UUID4 string and guaranteed to remain unchanged until the resource is @@ -30,14 +30,14 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. A number that monotonically increases every time the user * modifies the desired state. * * Generated from protobuf field int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $generation = 0; + protected $generation = 0; /** * Output only. Unstructured key value map that can be used to organize and * categorize objects. User-provided labels are shared with Google's billing @@ -65,7 +65,7 @@ class Execution extends \Google\Protobuf\Internal\Message * * 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. Represents time when the execution started to run. * It is not guaranteed to be set in happens-before order across separate @@ -73,27 +73,27 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Represents time when the execution was completed. It is not * guaranteed to be set in happens-before order across separate operations. * * Generated from protobuf field .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $completion_time = null; + protected $completion_time = null; /** * Output only. The last-modified time. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. For a deleted resource, the deletion time. It is only * populated as a response to a Delete request. * * Generated from protobuf field .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $delete_time = null; + protected $delete_time = null; /** * Output only. For a deleted resource, the time after which it will be * permamently deleted. It is only populated as a response to a Delete @@ -101,7 +101,7 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $expire_time = null; + protected $expire_time = null; /** * The least stable launch stage needed to create this resource, as defined by * [Google Cloud Platform Launch @@ -114,13 +114,13 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.api.LaunchStage launch_stage = 11; */ - private $launch_stage = 0; + protected $launch_stage = 0; /** * Output only. The name of the parent Job. * * Generated from protobuf field string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $job = ''; + protected $job = ''; /** * Output only. Specifies the maximum desired number of tasks the execution * should run at any given time. Must be <= task_count. The actual number of @@ -130,7 +130,7 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 parallelism = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $parallelism = 0; + protected $parallelism = 0; /** * Output only. Specifies the desired number of tasks the execution should * run. Setting to 1 means that parallelism is limited to 1 and the success of @@ -138,13 +138,13 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 task_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $task_count = 0; + protected $task_count = 0; /** * Output only. The template used to create tasks for this execution. * * Generated from protobuf field .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $template = null; + protected $template = null; /** * Output only. Indicates whether the resource's reconciliation is still in * progress. See comments in `Job.reconciling` for additional information on @@ -152,7 +152,7 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. The Condition of this Execution, containing its readiness * status, and detailed error information in case it did not reach the desired @@ -168,57 +168,57 @@ class Execution extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 observed_generation = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $observed_generation = 0; + protected $observed_generation = 0; /** * Output only. The number of actively running tasks. * * Generated from protobuf field int32 running_count = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $running_count = 0; + protected $running_count = 0; /** * Output only. The number of tasks which reached phase Succeeded. * * Generated from protobuf field int32 succeeded_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $succeeded_count = 0; + protected $succeeded_count = 0; /** * Output only. The number of tasks which reached phase Failed. * * Generated from protobuf field int32 failed_count = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $failed_count = 0; + protected $failed_count = 0; /** * Output only. The number of tasks which reached phase Cancelled. * * Generated from protobuf field int32 cancelled_count = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $cancelled_count = 0; + protected $cancelled_count = 0; /** * Output only. The number of tasks which have retried at least once. * * Generated from protobuf field int32 retried_count = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $retried_count = 0; + protected $retried_count = 0; /** * Output only. URI where logs for this execution can be found in Cloud * Console. * * Generated from protobuf field string log_uri = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $log_uri = ''; + protected $log_uri = ''; /** * Output only. Reserved for future use. * * Generated from protobuf field bool satisfies_pzs = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $satisfies_pzs = false; + protected $satisfies_pzs = false; /** * Output only. A system-generated fingerprint for this version of the * resource. May be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/Run/src/V2/ExecutionReference.php b/Run/src/V2/ExecutionReference.php index 582d1586dfc3..9f24bfccf464 100644 --- a/Run/src/V2/ExecutionReference.php +++ b/Run/src/V2/ExecutionReference.php @@ -21,19 +21,19 @@ class ExecutionReference extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Creation timestamp of the execution. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; */ - private $create_time = null; + protected $create_time = null; /** * Creation timestamp of the execution. * * Generated from protobuf field .google.protobuf.Timestamp completion_time = 3; */ - private $completion_time = null; + protected $completion_time = null; /** * Constructor. diff --git a/Run/src/V2/ExecutionTemplate.php b/Run/src/V2/ExecutionTemplate.php index a83d420eb07b..18ee4a6bffb3 100644 --- a/Run/src/V2/ExecutionTemplate.php +++ b/Run/src/V2/ExecutionTemplate.php @@ -57,7 +57,7 @@ class ExecutionTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 parallelism = 3; */ - private $parallelism = 0; + protected $parallelism = 0; /** * Specifies the desired number of tasks the execution should run. * Setting to 1 means that parallelism is limited to 1 and the success of @@ -65,14 +65,14 @@ class ExecutionTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 task_count = 4; */ - private $task_count = 0; + protected $task_count = 0; /** * Required. Describes the task(s) that will be created when executing an * execution. * * Generated from protobuf field .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $template = null; + protected $template = null; /** * Constructor. diff --git a/Run/src/V2/ExecutionsClient.php b/Run/src/V2/ExecutionsClient.php deleted file mode 100644 index 639aa00bec49..000000000000 --- a/Run/src/V2/ExecutionsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.run.v2.Executions/GetExecution', - $argument, - ['\Google\Cloud\Run\V2\Execution', 'decode'], - $metadata, $options); - } - - /** - * Lists Executions from a Job. - * @param \Google\Cloud\Run\V2\ListExecutionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListExecutions(\Google\Cloud\Run\V2\ListExecutionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Executions/ListExecutions', - $argument, - ['\Google\Cloud\Run\V2\ListExecutionsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes an Execution. - * @param \Google\Cloud\Run\V2\DeleteExecutionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteExecution(\Google\Cloud\Run\V2\DeleteExecutionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Executions/DeleteExecution', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - -} diff --git a/Run/src/V2/GCSVolumeSource.php b/Run/src/V2/GCSVolumeSource.php index 2d5a6249d394..9124dcdc42f5 100644 --- a/Run/src/V2/GCSVolumeSource.php +++ b/Run/src/V2/GCSVolumeSource.php @@ -20,13 +20,13 @@ class GCSVolumeSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string bucket = 1; */ - private $bucket = ''; + protected $bucket = ''; /** * If true, mount the GCS bucket as read-only * * Generated from protobuf field bool read_only = 2; */ - private $read_only = false; + protected $read_only = false; /** * Constructor. diff --git a/Run/src/V2/GRPCAction.php b/Run/src/V2/GRPCAction.php index 2b18f67dac57..ded612ce62c9 100644 --- a/Run/src/V2/GRPCAction.php +++ b/Run/src/V2/GRPCAction.php @@ -22,7 +22,7 @@ class GRPCAction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 port = 1; */ - private $port = 0; + protected $port = 0; /** * Service is the name of the service to place in the gRPC HealthCheckRequest * (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md ). If @@ -30,7 +30,7 @@ class GRPCAction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service = 2; */ - private $service = ''; + protected $service = ''; /** * Constructor. diff --git a/Run/src/V2/Gapic/ExecutionsGapicClient.php b/Run/src/V2/Gapic/ExecutionsGapicClient.php deleted file mode 100644 index 739094c97491..000000000000 --- a/Run/src/V2/Gapic/ExecutionsGapicClient.php +++ /dev/null @@ -1,687 +0,0 @@ -executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - * $operationResponse = $executionsClient->cancelExecution($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 = $executionsClient->cancelExecution($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $executionsClient->resumeOperation($operationName, 'cancelExecution'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $executionsClient->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\Run\V2\Client\ExecutionsClient}. - */ -class ExecutionsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.run.v2.Executions'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'run.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'run.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 $executionNameTemplate; - - private static $jobNameTemplate; - - 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/executions_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/executions_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/executions_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/executions_rest_client_config.php', - ], - ], - ]; - } - - private static function getExecutionNameTemplate() - { - if (self::$executionNameTemplate == null) { - self::$executionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/jobs/{job}/executions/{execution}' - ); - } - - return self::$executionNameTemplate; - } - - private static function getJobNameTemplate() - { - if (self::$jobNameTemplate == null) { - self::$jobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/jobs/{job}' - ); - } - - return self::$jobNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'execution' => self::getExecutionNameTemplate(), - 'job' => self::getJobNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a execution - * resource. - * - * @param string $project - * @param string $location - * @param string $job - * @param string $execution - * - * @return string The formatted execution resource. - */ - public static function executionName($project, $location, $job, $execution) - { - return self::getExecutionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'job' => $job, - 'execution' => $execution, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a job - * resource. - * - * @param string $project - * @param string $location - * @param string $job - * - * @return string The formatted job resource. - */ - public static function jobName($project, $location, $job) - { - return self::getJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'job' => $job, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - execution: projects/{project}/locations/{location}/jobs/{job}/executions/{execution} - * - job: projects/{project}/locations/{location}/jobs/{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" - ); - } - - /** - * 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 'run.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 an Execution. - * - * Sample code: - * ``` - * $executionsClient = new ExecutionsClient(); - * try { - * $formattedName = $executionsClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - * $operationResponse = $executionsClient->cancelExecution($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 = $executionsClient->cancelExecution($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $executionsClient->resumeOperation($operationName, 'cancelExecution'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $executionsClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Execution to cancel. - * Format: - * `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, - * where `{project}` can be project id or number. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated without actually - * cancelling any resources. - * @type string $etag - * A system-generated fingerprint for this version of the resource. - * This may be used to detect modification conflict during updates. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 cancelExecution($name, array $optionalArgs = []) - { - $request = new CancelExecutionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - 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( - 'CancelExecution', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes an Execution. - * - * Sample code: - * ``` - * $executionsClient = new ExecutionsClient(); - * try { - * $formattedName = $executionsClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - * $operationResponse = $executionsClient->deleteExecution($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 = $executionsClient->deleteExecution($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $executionsClient->resumeOperation($operationName, 'deleteExecution'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $executionsClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Execution to delete. - * Format: - * `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, - * where `{project}` can be project id or number. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated without actually - * deleting any resources. - * @type string $etag - * A system-generated fingerprint for this version of the resource. - * This may be used to detect modification conflict during updates. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - 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(); - } - - /** - * Gets information about an Execution. - * - * Sample code: - * ``` - * $executionsClient = new ExecutionsClient(); - * try { - * $formattedName = $executionsClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - * $response = $executionsClient->getExecution($formattedName); - * } finally { - * $executionsClient->close(); - * } - * ``` - * - * @param string $name Required. The full name of the Execution. - * Format: - * `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, - * where `{project}` can be project id or number. - * @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\Run\V2\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(); - } - - /** - * Lists Executions from a Job. - * - * Sample code: - * ``` - * $executionsClient = new ExecutionsClient(); - * try { - * $formattedParent = $executionsClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - * // Iterate over pages of elements - * $pagedResponse = $executionsClient->listExecutions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $executionsClient->listExecutions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $executionsClient->close(); - * } - * ``` - * - * @param string $parent Required. The Execution from which the Executions should be listed. - * To list all Executions across Jobs, use "-" instead of Job name. - * Format: `projects/{project}/locations/{location}/jobs/{job}`, where - * `{project}` can be project id or number. - * @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 bool $showDeleted - * If true, returns deleted (but unexpired) resources along with active ones. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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['showDeleted'])) { - $request->setShowDeleted($optionalArgs['showDeleted']); - } - - $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 - ); - } -} diff --git a/Run/src/V2/Gapic/JobsGapicClient.php b/Run/src/V2/Gapic/JobsGapicClient.php deleted file mode 100644 index 85ce5aa10543..000000000000 --- a/Run/src/V2/Gapic/JobsGapicClient.php +++ /dev/null @@ -1,1233 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $job = new Job(); - * $jobId = 'job_id'; - * $operationResponse = $jobsClient->createJob($formattedParent, $job, $jobId); - * $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 = $jobsClient->createJob($formattedParent, $job, $jobId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobsClient->resumeOperation($operationName, 'createJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobsClient->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\Run\V2\Client\JobsClient}. - */ -class JobsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.run.v2.Jobs'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'run.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'run.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 $connectorNameTemplate; - - private static $cryptoKeyNameTemplate; - - private static $executionNameTemplate; - - private static $jobNameTemplate; - - private static $locationNameTemplate; - - private static $secretNameTemplate; - - private static $secretVersionNameTemplate; - - 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/jobs_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/jobs_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/jobs_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . '/../resources/jobs_rest_client_config.php', - ], - ], - ]; - } - - private static function getConnectorNameTemplate() - { - if (self::$connectorNameTemplate == null) { - self::$connectorNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/connectors/{connector}' - ); - } - - return self::$connectorNameTemplate; - } - - private static function getCryptoKeyNameTemplate() - { - if (self::$cryptoKeyNameTemplate == null) { - self::$cryptoKeyNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ); - } - - return self::$cryptoKeyNameTemplate; - } - - private static function getExecutionNameTemplate() - { - if (self::$executionNameTemplate == null) { - self::$executionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/jobs/{job}/executions/{execution}' - ); - } - - return self::$executionNameTemplate; - } - - private static function getJobNameTemplate() - { - if (self::$jobNameTemplate == null) { - self::$jobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/jobs/{job}' - ); - } - - return self::$jobNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getSecretNameTemplate() - { - if (self::$secretNameTemplate == null) { - self::$secretNameTemplate = new PathTemplate( - 'projects/{project}/secrets/{secret}' - ); - } - - return self::$secretNameTemplate; - } - - private static function getSecretVersionNameTemplate() - { - if (self::$secretVersionNameTemplate == null) { - self::$secretVersionNameTemplate = new PathTemplate( - 'projects/{project}/secrets/{secret}/versions/{version}' - ); - } - - return self::$secretVersionNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'connector' => self::getConnectorNameTemplate(), - 'cryptoKey' => self::getCryptoKeyNameTemplate(), - 'execution' => self::getExecutionNameTemplate(), - 'job' => self::getJobNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'secret' => self::getSecretNameTemplate(), - 'secretVersion' => self::getSecretVersionNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a connector - * resource. - * - * @param string $project - * @param string $location - * @param string $connector - * - * @return string The formatted connector resource. - */ - public static function connectorName($project, $location, $connector) - { - return self::getConnectorNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'connector' => $connector, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName( - $project, - $location, - $keyRing, - $cryptoKey - ) { - return self::getCryptoKeyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a execution - * resource. - * - * @param string $project - * @param string $location - * @param string $job - * @param string $execution - * - * @return string The formatted execution resource. - */ - public static function executionName($project, $location, $job, $execution) - { - return self::getExecutionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'job' => $job, - 'execution' => $execution, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a job - * resource. - * - * @param string $project - * @param string $location - * @param string $job - * - * @return string The formatted job resource. - */ - public static function jobName($project, $location, $job) - { - return self::getJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'job' => $job, - ]); - } - - /** - * 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 secret - * resource. - * - * @param string $project - * @param string $secret - * - * @return string The formatted secret resource. - */ - public static function secretName($project, $secret) - { - return self::getSecretNameTemplate()->render([ - 'project' => $project, - 'secret' => $secret, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * secret_version resource. - * - * @param string $project - * @param string $secret - * @param string $version - * - * @return string The formatted secret_version resource. - */ - public static function secretVersionName($project, $secret, $version) - { - return self::getSecretVersionNameTemplate()->render([ - 'project' => $project, - 'secret' => $secret, - '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 - * - connector: projects/{project}/locations/{location}/connectors/{connector} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - execution: projects/{project}/locations/{location}/jobs/{job}/executions/{execution} - * - job: projects/{project}/locations/{location}/jobs/{job} - * - location: projects/{project}/locations/{location} - * - secret: projects/{project}/secrets/{secret} - * - secretVersion: projects/{project}/secrets/{secret}/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 'run.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 Job. - * - * Sample code: - * ``` - * $jobsClient = new JobsClient(); - * try { - * $formattedParent = $jobsClient->locationName('[PROJECT]', '[LOCATION]'); - * $job = new Job(); - * $jobId = 'job_id'; - * $operationResponse = $jobsClient->createJob($formattedParent, $job, $jobId); - * $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 = $jobsClient->createJob($formattedParent, $job, $jobId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobsClient->resumeOperation($operationName, 'createJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobsClient->close(); - * } - * ``` - * - * @param string $parent Required. The location and project in which this Job should be created. - * Format: projects/{project}/locations/{location}, where {project} can be - * project id or number. - * @param Job $job Required. The Job instance to create. - * @param string $jobId Required. The unique identifier for the Job. The name of the job becomes - * {parent}/jobs/{job_id}. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated and default values - * populated, without persisting the request or creating any 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\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createJob($parent, $job, $jobId, array $optionalArgs = []) - { - $request = new CreateJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setJob($job); - $request->setJobId($jobId); - $requestParamHeaders['location'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a Job. - * - * Sample code: - * ``` - * $jobsClient = new JobsClient(); - * try { - * $formattedName = $jobsClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - * $operationResponse = $jobsClient->deleteJob($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 = $jobsClient->deleteJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobsClient->resumeOperation($operationName, 'deleteJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobsClient->close(); - * } - * ``` - * - * @param string $name Required. The full name of the Job. - * Format: projects/{project}/locations/{location}/jobs/{job}, where {project} - * can be project id or number. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated without actually - * deleting any resources. - * @type string $etag - * A system-generated fingerprint for this version of the - * resource. May be used to detect modification conflict during updates. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteJob($name, array $optionalArgs = []) - { - $request = new DeleteJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['location'] = $name; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - 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( - 'DeleteJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets the IAM Access Control policy currently in effect for the given Job. - * This result does not include any inherited policies. - * - * Sample code: - * ``` - * $jobsClient = new JobsClient(); - * try { - * $resource = 'resource'; - * $response = $jobsClient->getIamPolicy($resource); - * } finally { - * $jobsClient->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 - )->wait(); - } - - /** - * Gets information about a Job. - * - * Sample code: - * ``` - * $jobsClient = new JobsClient(); - * try { - * $formattedName = $jobsClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - * $response = $jobsClient->getJob($formattedName); - * } finally { - * $jobsClient->close(); - * } - * ``` - * - * @param string $name Required. The full name of the Job. - * Format: projects/{project}/locations/{location}/jobs/{job}, where {project} - * can be project id or number. - * @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\Run\V2\Job - * - * @throws ApiException if the remote call fails - */ - public function getJob($name, array $optionalArgs = []) - { - $request = new GetJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['location'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetJob', - Job::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists Jobs. - * - * Sample code: - * ``` - * $jobsClient = new JobsClient(); - * try { - * $formattedParent = $jobsClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $jobsClient->listJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $jobsClient->listJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $jobsClient->close(); - * } - * ``` - * - * @param string $parent Required. The location and project to list resources on. - * Format: projects/{project}/locations/{location}, where {project} can be - * project id or number. - * @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 bool $showDeleted - * If true, returns deleted (but unexpired) resources along with active ones. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 listJobs($parent, array $optionalArgs = []) - { - $request = new ListJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['location'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['showDeleted'])) { - $request->setShowDeleted($optionalArgs['showDeleted']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListJobs', - $optionalArgs, - ListJobsResponse::class, - $request - ); - } - - /** - * Triggers creation of a new Execution of this Job. - * - * Sample code: - * ``` - * $jobsClient = new JobsClient(); - * try { - * $formattedName = $jobsClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - * $operationResponse = $jobsClient->runJob($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 = $jobsClient->runJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobsClient->resumeOperation($operationName, 'runJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobsClient->close(); - * } - * ``` - * - * @param string $name Required. The full name of the Job. - * Format: projects/{project}/locations/{location}/jobs/{job}, where {project} - * can be project id or number. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated without actually - * deleting any resources. - * @type string $etag - * A system-generated fingerprint for this version of the - * resource. May be used to detect modification conflict during updates. - * @type Overrides $overrides - * Overrides specification for a given execution of a job. If provided, - * overrides will be applied to update the execution or task spec. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 runJob($name, array $optionalArgs = []) - { - $request = new RunJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['location'] = $name; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - if (isset($optionalArgs['etag'])) { - $request->setEtag($optionalArgs['etag']); - } - - if (isset($optionalArgs['overrides'])) { - $request->setOverrides($optionalArgs['overrides']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'RunJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Sets the IAM Access control policy for the specified Job. Overwrites - * any existing policy. - * - * Sample code: - * ``` - * $jobsClient = new JobsClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $jobsClient->setIamPolicy($resource, $policy); - * } finally { - * $jobsClient->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 - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified Project. - * - * There are no permissions required for making this API call. - * - * Sample code: - * ``` - * $jobsClient = new JobsClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $jobsClient->testIamPermissions($resource, $permissions); - * } finally { - * $jobsClient->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 - )->wait(); - } - - /** - * Updates a Job. - * - * Sample code: - * ``` - * $jobsClient = new JobsClient(); - * try { - * $job = new Job(); - * $operationResponse = $jobsClient->updateJob($job); - * $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 = $jobsClient->updateJob($job); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $jobsClient->resumeOperation($operationName, 'updateJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $jobsClient->close(); - * } - * ``` - * - * @param Job $job Required. The Job to be updated. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated and default values - * populated, without persisting the request or updating any resources. - * @type bool $allowMissing - * If set to true, and if the Job does not exist, it will create a new - * one. Caller must have both create and update permissions for this call if - * this is set to 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\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateJob($job, array $optionalArgs = []) - { - $request = new UpdateJobRequest(); - $requestParamHeaders = []; - $request->setJob($job); - $requestParamHeaders['location'] = $job->getName(); - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - 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->startOperationsCall( - 'UpdateJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } -} diff --git a/Run/src/V2/Gapic/RevisionsGapicClient.php b/Run/src/V2/Gapic/RevisionsGapicClient.php deleted file mode 100644 index 800f56365b1e..000000000000 --- a/Run/src/V2/Gapic/RevisionsGapicClient.php +++ /dev/null @@ -1,598 +0,0 @@ -revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - * $operationResponse = $revisionsClient->deleteRevision($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 = $revisionsClient->deleteRevision($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $revisionsClient->resumeOperation($operationName, 'deleteRevision'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $revisionsClient->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\Run\V2\Client\RevisionsClient}. - */ -class RevisionsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.run.v2.Revisions'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'run.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'run.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 $revisionNameTemplate; - - private static $serviceNameTemplate; - - 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/revisions_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/revisions_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/revisions_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/revisions_rest_client_config.php', - ], - ], - ]; - } - - private static function getRevisionNameTemplate() - { - if (self::$revisionNameTemplate == null) { - self::$revisionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/revisions/{revision}' - ); - } - - return self::$revisionNameTemplate; - } - - private static function getServiceNameTemplate() - { - if (self::$serviceNameTemplate == null) { - self::$serviceNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ); - } - - return self::$serviceNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'revision' => self::getRevisionNameTemplate(), - 'service' => self::getServiceNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a revision - * resource. - * - * @param string $project - * @param string $location - * @param string $service - * @param string $revision - * - * @return string The formatted revision resource. - */ - public static function revisionName( - $project, - $location, - $service, - $revision - ) { - return self::getRevisionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'service' => $service, - 'revision' => $revision, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a service - * resource. - * - * @param string $project - * @param string $location - * @param string $service - * - * @return string The formatted service resource. - */ - public static function serviceName($project, $location, $service) - { - return self::getServiceNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'service' => $service, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - revision: projects/{project}/locations/{location}/services/{service}/revisions/{revision} - * - service: projects/{project}/locations/{location}/services/{service} - * - * 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 'run.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); - } - - /** - * Deletes a Revision. - * - * Sample code: - * ``` - * $revisionsClient = new RevisionsClient(); - * try { - * $formattedName = $revisionsClient->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - * $operationResponse = $revisionsClient->deleteRevision($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 = $revisionsClient->deleteRevision($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $revisionsClient->resumeOperation($operationName, 'deleteRevision'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $revisionsClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the Revision to delete. - * Format: - * projects/{project}/locations/{location}/services/{service}/revisions/{revision} - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated without actually - * deleting any resources. - * @type string $etag - * A system-generated fingerprint for this version of the - * resource. This may be used to detect modification conflict during updates. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteRevision($name, array $optionalArgs = []) - { - $request = new DeleteRevisionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['location'] = $name; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - 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( - 'DeleteRevision', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a Revision. - * - * Sample code: - * ``` - * $revisionsClient = new RevisionsClient(); - * try { - * $formattedName = $revisionsClient->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - * $response = $revisionsClient->getRevision($formattedName); - * } finally { - * $revisionsClient->close(); - * } - * ``` - * - * @param string $name Required. The full name of the Revision. - * Format: - * projects/{project}/locations/{location}/services/{service}/revisions/{revision} - * @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\Run\V2\Revision - * - * @throws ApiException if the remote call fails - */ - public function getRevision($name, array $optionalArgs = []) - { - $request = new GetRevisionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['location'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetRevision', - Revision::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists Revisions from a given Service, or from a given location. - * - * Sample code: - * ``` - * $revisionsClient = new RevisionsClient(); - * try { - * $formattedParent = $revisionsClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - * // Iterate over pages of elements - * $pagedResponse = $revisionsClient->listRevisions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $revisionsClient->listRevisions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $revisionsClient->close(); - * } - * ``` - * - * @param string $parent Required. The Service from which the Revisions should be listed. - * To list all Revisions across Services, use "-" instead of Service name. - * Format: - * projects/{project}/locations/{location}/services/{service} - * @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 bool $showDeleted - * If true, returns deleted (but unexpired) resources along with active ones. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 listRevisions($parent, array $optionalArgs = []) - { - $request = new ListRevisionsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['location'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['showDeleted'])) { - $request->setShowDeleted($optionalArgs['showDeleted']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListRevisions', - $optionalArgs, - ListRevisionsResponse::class, - $request - ); - } -} diff --git a/Run/src/V2/Gapic/ServicesGapicClient.php b/Run/src/V2/Gapic/ServicesGapicClient.php deleted file mode 100644 index 0efb1e922207..000000000000 --- a/Run/src/V2/Gapic/ServicesGapicClient.php +++ /dev/null @@ -1,1148 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $service = new Service(); - * $serviceId = 'service_id'; - * $operationResponse = $servicesClient->createService($formattedParent, $service, $serviceId); - * $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 = $servicesClient->createService($formattedParent, $service, $serviceId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $servicesClient->resumeOperation($operationName, 'createService'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $servicesClient->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\Run\V2\Client\ServicesClient}. - */ -class ServicesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.run.v2.Services'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'run.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'run.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 $connectorNameTemplate; - - private static $cryptoKeyNameTemplate; - - private static $locationNameTemplate; - - private static $revisionNameTemplate; - - private static $secretNameTemplate; - - private static $secretVersionNameTemplate; - - private static $serviceNameTemplate; - - 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/services_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/services_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/services_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/services_rest_client_config.php', - ], - ], - ]; - } - - private static function getConnectorNameTemplate() - { - if (self::$connectorNameTemplate == null) { - self::$connectorNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/connectors/{connector}' - ); - } - - return self::$connectorNameTemplate; - } - - private static function getCryptoKeyNameTemplate() - { - if (self::$cryptoKeyNameTemplate == null) { - self::$cryptoKeyNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' - ); - } - - return self::$cryptoKeyNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getRevisionNameTemplate() - { - if (self::$revisionNameTemplate == null) { - self::$revisionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/revisions/{revision}' - ); - } - - return self::$revisionNameTemplate; - } - - private static function getSecretNameTemplate() - { - if (self::$secretNameTemplate == null) { - self::$secretNameTemplate = new PathTemplate( - 'projects/{project}/secrets/{secret}' - ); - } - - return self::$secretNameTemplate; - } - - private static function getSecretVersionNameTemplate() - { - if (self::$secretVersionNameTemplate == null) { - self::$secretVersionNameTemplate = new PathTemplate( - 'projects/{project}/secrets/{secret}/versions/{version}' - ); - } - - return self::$secretVersionNameTemplate; - } - - private static function getServiceNameTemplate() - { - if (self::$serviceNameTemplate == null) { - self::$serviceNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ); - } - - return self::$serviceNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'connector' => self::getConnectorNameTemplate(), - 'cryptoKey' => self::getCryptoKeyNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'revision' => self::getRevisionNameTemplate(), - 'secret' => self::getSecretNameTemplate(), - 'secretVersion' => self::getSecretVersionNameTemplate(), - 'service' => self::getServiceNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a connector - * resource. - * - * @param string $project - * @param string $location - * @param string $connector - * - * @return string The formatted connector resource. - */ - public static function connectorName($project, $location, $connector) - { - return self::getConnectorNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'connector' => $connector, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName( - $project, - $location, - $keyRing, - $cryptoKey - ) { - return self::getCryptoKeyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * 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 revision - * resource. - * - * @param string $project - * @param string $location - * @param string $service - * @param string $revision - * - * @return string The formatted revision resource. - */ - public static function revisionName( - $project, - $location, - $service, - $revision - ) { - return self::getRevisionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'service' => $service, - 'revision' => $revision, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a secret - * resource. - * - * @param string $project - * @param string $secret - * - * @return string The formatted secret resource. - */ - public static function secretName($project, $secret) - { - return self::getSecretNameTemplate()->render([ - 'project' => $project, - 'secret' => $secret, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * secret_version resource. - * - * @param string $project - * @param string $secret - * @param string $version - * - * @return string The formatted secret_version resource. - */ - public static function secretVersionName($project, $secret, $version) - { - return self::getSecretVersionNameTemplate()->render([ - 'project' => $project, - 'secret' => $secret, - 'version' => $version, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a service - * resource. - * - * @param string $project - * @param string $location - * @param string $service - * - * @return string The formatted service resource. - */ - public static function serviceName($project, $location, $service) - { - return self::getServiceNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'service' => $service, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - connector: projects/{project}/locations/{location}/connectors/{connector} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - location: projects/{project}/locations/{location} - * - revision: projects/{project}/locations/{location}/services/{service}/revisions/{revision} - * - secret: projects/{project}/secrets/{secret} - * - secretVersion: projects/{project}/secrets/{secret}/versions/{version} - * - service: projects/{project}/locations/{location}/services/{service} - * - * 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 'run.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 Service in a given project and location. - * - * Sample code: - * ``` - * $servicesClient = new ServicesClient(); - * try { - * $formattedParent = $servicesClient->locationName('[PROJECT]', '[LOCATION]'); - * $service = new Service(); - * $serviceId = 'service_id'; - * $operationResponse = $servicesClient->createService($formattedParent, $service, $serviceId); - * $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 = $servicesClient->createService($formattedParent, $service, $serviceId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $servicesClient->resumeOperation($operationName, 'createService'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $servicesClient->close(); - * } - * ``` - * - * @param string $parent Required. The location and project in which this service should be created. - * Format: projects/{project}/locations/{location}, where {project} can be - * project id or number. Only lowercase characters, digits, and hyphens. - * @param Service $service Required. The Service instance to create. - * @param string $serviceId Required. The unique identifier for the Service. It must begin with letter, - * and cannot end with hyphen; must contain fewer than 50 characters. - * The name of the service becomes {parent}/services/{service_id}. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated and default values - * populated, without persisting the request or creating any 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\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createService( - $parent, - $service, - $serviceId, - array $optionalArgs = [] - ) { - $request = new CreateServiceRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setService($service); - $request->setServiceId($serviceId); - $requestParamHeaders['location'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateService', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a Service. - * This will cause the Service to stop serving traffic and will delete all - * revisions. - * - * Sample code: - * ``` - * $servicesClient = new ServicesClient(); - * try { - * $formattedName = $servicesClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - * $operationResponse = $servicesClient->deleteService($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 = $servicesClient->deleteService($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $servicesClient->resumeOperation($operationName, 'deleteService'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $servicesClient->close(); - * } - * ``` - * - * @param string $name Required. The full name of the Service. - * Format: projects/{project}/locations/{location}/services/{service}, where - * {project} can be project id or number. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated without actually - * deleting any resources. - * @type string $etag - * A system-generated fingerprint for this version of the - * resource. May be used to detect modification conflict during updates. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteService($name, array $optionalArgs = []) - { - $request = new DeleteServiceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['location'] = $name; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - 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( - 'DeleteService', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets the IAM Access Control policy currently in effect for the given - * Cloud Run Service. This result does not include any inherited policies. - * - * Sample code: - * ``` - * $servicesClient = new ServicesClient(); - * try { - * $resource = 'resource'; - * $response = $servicesClient->getIamPolicy($resource); - * } finally { - * $servicesClient->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 - )->wait(); - } - - /** - * Gets information about a Service. - * - * Sample code: - * ``` - * $servicesClient = new ServicesClient(); - * try { - * $formattedName = $servicesClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - * $response = $servicesClient->getService($formattedName); - * } finally { - * $servicesClient->close(); - * } - * ``` - * - * @param string $name Required. The full name of the Service. - * Format: projects/{project}/locations/{location}/services/{service}, where - * {project} can be project id or number. - * @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\Run\V2\Service - * - * @throws ApiException if the remote call fails - */ - public function getService($name, array $optionalArgs = []) - { - $request = new GetServiceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['location'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetService', - Service::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists Services. - * - * Sample code: - * ``` - * $servicesClient = new ServicesClient(); - * try { - * $formattedParent = $servicesClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $servicesClient->listServices($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $servicesClient->listServices($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $servicesClient->close(); - * } - * ``` - * - * @param string $parent Required. The location and project to list resources on. - * Location must be a valid Google Cloud region, and cannot be the "-" - * wildcard. Format: projects/{project}/locations/{location}, where {project} - * can be project id or number. - * @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 bool $showDeleted - * If true, returns deleted (but unexpired) resources along with active ones. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 listServices($parent, array $optionalArgs = []) - { - $request = new ListServicesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['location'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['showDeleted'])) { - $request->setShowDeleted($optionalArgs['showDeleted']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListServices', - $optionalArgs, - ListServicesResponse::class, - $request - ); - } - - /** - * Sets the IAM Access control policy for the specified Service. Overwrites - * any existing policy. - * - * Sample code: - * ``` - * $servicesClient = new ServicesClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $servicesClient->setIamPolicy($resource, $policy); - * } finally { - * $servicesClient->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 - )->wait(); - } - - /** - * Returns permissions that a caller has on the specified Project. - * - * There are no permissions required for making this API call. - * - * Sample code: - * ``` - * $servicesClient = new ServicesClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $servicesClient->testIamPermissions($resource, $permissions); - * } finally { - * $servicesClient->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 - )->wait(); - } - - /** - * Updates a Service. - * - * Sample code: - * ``` - * $servicesClient = new ServicesClient(); - * try { - * $service = new Service(); - * $operationResponse = $servicesClient->updateService($service); - * $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 = $servicesClient->updateService($service); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $servicesClient->resumeOperation($operationName, 'updateService'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $servicesClient->close(); - * } - * ``` - * - * @param Service $service Required. The Service to be updated. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * Indicates that the request should be validated and default values - * populated, without persisting the request or updating any resources. - * @type bool $allowMissing - * If set to true, and if the Service does not exist, it will create a new - * one. The caller must have 'run.services.create' permissions if this is set - * to true and the Service does not exist. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateService($service, array $optionalArgs = []) - { - $request = new UpdateServiceRequest(); - $requestParamHeaders = []; - $request->setService($service); - $requestParamHeaders['location'] = $service->getName(); - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - 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->startOperationsCall( - 'UpdateService', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } -} diff --git a/Run/src/V2/Gapic/TasksGapicClient.php b/Run/src/V2/Gapic/TasksGapicClient.php deleted file mode 100644 index 16f791664ae1..000000000000 --- a/Run/src/V2/Gapic/TasksGapicClient.php +++ /dev/null @@ -1,446 +0,0 @@ -taskName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]', '[TASK]'); - * $response = $tasksClient->getTask($formattedName); - * } finally { - * $tasksClient->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\Run\V2\Client\TasksClient}. - */ -class TasksGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.run.v2.Tasks'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'run.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'run.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 $executionNameTemplate; - - private static $taskNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/tasks_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/tasks_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/tasks_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . '/../resources/tasks_rest_client_config.php', - ], - ], - ]; - } - - private static function getExecutionNameTemplate() - { - if (self::$executionNameTemplate == null) { - self::$executionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/jobs/{job}/executions/{execution}' - ); - } - - return self::$executionNameTemplate; - } - - private static function getTaskNameTemplate() - { - if (self::$taskNameTemplate == null) { - self::$taskNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}' - ); - } - - return self::$taskNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'execution' => self::getExecutionNameTemplate(), - 'task' => self::getTaskNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a execution - * resource. - * - * @param string $project - * @param string $location - * @param string $job - * @param string $execution - * - * @return string The formatted execution resource. - */ - public static function executionName($project, $location, $job, $execution) - { - return self::getExecutionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'job' => $job, - 'execution' => $execution, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a task - * resource. - * - * @param string $project - * @param string $location - * @param string $job - * @param string $execution - * @param string $task - * - * @return string The formatted task resource. - */ - public static function taskName( - $project, - $location, - $job, - $execution, - $task - ) { - return self::getTaskNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'job' => $job, - 'execution' => $execution, - 'task' => $task, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - execution: projects/{project}/locations/{location}/jobs/{job}/executions/{execution} - * - task: projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task} - * - * 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 'run.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 information about a Task. - * - * Sample code: - * ``` - * $tasksClient = new TasksClient(); - * try { - * $formattedName = $tasksClient->taskName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]', '[TASK]'); - * $response = $tasksClient->getTask($formattedName); - * } finally { - * $tasksClient->close(); - * } - * ``` - * - * @param string $name Required. The full name of the Task. - * Format: - * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task} - * @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\Run\V2\Task - * - * @throws ApiException if the remote call fails - */ - public function getTask($name, array $optionalArgs = []) - { - $request = new GetTaskRequest(); - $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( - 'GetTask', - Task::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists Tasks from an Execution of a Job. - * - * Sample code: - * ``` - * $tasksClient = new TasksClient(); - * try { - * $formattedParent = $tasksClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - * // Iterate over pages of elements - * $pagedResponse = $tasksClient->listTasks($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tasksClient->listTasks($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tasksClient->close(); - * } - * ``` - * - * @param string $parent Required. The Execution from which the Tasks should be listed. - * To list all Tasks across Executions of a Job, use "-" instead of Execution - * name. To list all Tasks across Jobs, use "-" instead of Job name. Format: - * projects/{project}/locations/{location}/jobs/{job}/executions/{execution} - * @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 bool $showDeleted - * If true, returns deleted (but unexpired) resources along with active ones. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 listTasks($parent, array $optionalArgs = []) - { - $request = new ListTasksRequest(); - $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['showDeleted'])) { - $request->setShowDeleted($optionalArgs['showDeleted']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListTasks', - $optionalArgs, - ListTasksResponse::class, - $request - ); - } -} diff --git a/Run/src/V2/GetExecutionRequest.php b/Run/src/V2/GetExecutionRequest.php index 05260a8843e8..8ecf98e5ef55 100644 --- a/Run/src/V2/GetExecutionRequest.php +++ b/Run/src/V2/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 full name of the Execution. diff --git a/Run/src/V2/GetJobRequest.php b/Run/src/V2/GetJobRequest.php index 353fb8f0ca4a..8d43efd711f4 100644 --- a/Run/src/V2/GetJobRequest.php +++ b/Run/src/V2/GetJobRequest.php @@ -22,7 +22,7 @@ class GetJobRequest 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 full name of the Job. diff --git a/Run/src/V2/GetRevisionRequest.php b/Run/src/V2/GetRevisionRequest.php index d599a8da02b7..23fa3012691d 100644 --- a/Run/src/V2/GetRevisionRequest.php +++ b/Run/src/V2/GetRevisionRequest.php @@ -22,7 +22,7 @@ class GetRevisionRequest 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 full name of the Revision. diff --git a/Run/src/V2/GetServiceRequest.php b/Run/src/V2/GetServiceRequest.php index c0ca460670f7..4a5aeb399c01 100644 --- a/Run/src/V2/GetServiceRequest.php +++ b/Run/src/V2/GetServiceRequest.php @@ -22,7 +22,7 @@ class GetServiceRequest 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 full name of the Service. diff --git a/Run/src/V2/GetTaskRequest.php b/Run/src/V2/GetTaskRequest.php index b587c8487fc6..925a9bb98395 100644 --- a/Run/src/V2/GetTaskRequest.php +++ b/Run/src/V2/GetTaskRequest.php @@ -22,7 +22,7 @@ class GetTaskRequest 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 full name of the Task. diff --git a/Run/src/V2/HTTPGetAction.php b/Run/src/V2/HTTPGetAction.php index 9347c6c1c602..4882d0e40246 100644 --- a/Run/src/V2/HTTPGetAction.php +++ b/Run/src/V2/HTTPGetAction.php @@ -20,7 +20,7 @@ class HTTPGetAction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string path = 1; */ - private $path = ''; + protected $path = ''; /** * Custom headers to set in the request. HTTP allows repeated headers. * @@ -34,7 +34,7 @@ class HTTPGetAction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 port = 5; */ - private $port = 0; + protected $port = 0; /** * Constructor. diff --git a/Run/src/V2/HTTPHeader.php b/Run/src/V2/HTTPHeader.php index 52d4c6c234d7..e01d0a887329 100644 --- a/Run/src/V2/HTTPHeader.php +++ b/Run/src/V2/HTTPHeader.php @@ -20,13 +20,13 @@ class HTTPHeader extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; /** * The header field value * * Generated from protobuf field string value = 2; */ - private $value = ''; + protected $value = ''; /** * Constructor. diff --git a/Run/src/V2/Job.php b/Run/src/V2/Job.php index 9cca73fa0038..ddc1a046cb49 100644 --- a/Run/src/V2/Job.php +++ b/Run/src/V2/Job.php @@ -23,7 +23,7 @@ class Job extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. Server assigned unique identifier for the Execution. The value * is a UUID4 string and guaranteed to remain unchanged until the resource is @@ -31,14 +31,14 @@ class Job extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. A number that monotonically increases every time the user * modifies the desired state. * * Generated from protobuf field int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $generation = 0; + protected $generation = 0; /** * Unstructured key value map that can be used to organize and categorize * objects. @@ -75,50 +75,50 @@ class Job extends \Google\Protobuf\Internal\Message * * 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. The last-modified time. * * 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 deletion time. * * Generated from protobuf field .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $delete_time = null; + protected $delete_time = null; /** * Output only. For a deleted resource, the time after which it will be * permamently deleted. * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $expire_time = null; + protected $expire_time = null; /** * Output only. Email address of the authenticated creator. * * Generated from protobuf field string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $creator = ''; + protected $creator = ''; /** * Output only. Email address of the last authenticated modifier. * * Generated from protobuf field string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $last_modifier = ''; + protected $last_modifier = ''; /** * Arbitrary identifier for the API client. * * Generated from protobuf field string client = 12; */ - private $client = ''; + protected $client = ''; /** * Arbitrary version identifier for the API client. * * Generated from protobuf field string client_version = 13; */ - private $client_version = ''; + protected $client_version = ''; /** * The launch stage as defined by [Google Cloud Platform * Launch Stages](https://cloud.google.com/terms/launch-stages). @@ -133,33 +133,33 @@ class Job extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.api.LaunchStage launch_stage = 14; */ - private $launch_stage = 0; + protected $launch_stage = 0; /** * Settings for the Binary Authorization feature. * * Generated from protobuf field .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; */ - private $binary_authorization = null; + protected $binary_authorization = null; /** * Required. The template used to create executions for this Job. * * Generated from protobuf field .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; */ - private $template = null; + protected $template = null; /** * Output only. The generation of this Job. See comments in `reconciling` for * additional information on reconciliation process in Cloud Run. * * Generated from protobuf field int64 observed_generation = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $observed_generation = 0; + protected $observed_generation = 0; /** * Output only. The Condition of this Job, containing its readiness status, * and detailed error information in case it did not reach the desired state. * * Generated from protobuf field .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $terminal_condition = null; + protected $terminal_condition = null; /** * Output only. The Conditions of all other associated sub-resources. They * contain additional diagnostics information in case the Job does not reach @@ -174,13 +174,13 @@ class Job extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 execution_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $execution_count = 0; + protected $execution_count = 0; /** * Output only. Name of the last created execution. * * Generated from protobuf field .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $latest_created_execution = null; + protected $latest_created_execution = null; /** * Output only. Returns true if the Job is currently being acted upon by the * system to bring it into the desired state. @@ -203,20 +203,20 @@ class Job extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool reconciling = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. Reserved for future use. * * Generated from protobuf field bool satisfies_pzs = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $satisfies_pzs = false; + protected $satisfies_pzs = false; /** * Output only. A system-generated fingerprint for this version of the * resource. May be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/Run/src/V2/JobsClient.php b/Run/src/V2/JobsClient.php deleted file mode 100644 index 9d14c93d5765..000000000000 --- a/Run/src/V2/JobsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.run.v2.Jobs/CreateJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets information about a Job. - * @param \Google\Cloud\Run\V2\GetJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetJob(\Google\Cloud\Run\V2\GetJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Jobs/GetJob', - $argument, - ['\Google\Cloud\Run\V2\Job', 'decode'], - $metadata, $options); - } - - /** - * Lists Jobs. - * @param \Google\Cloud\Run\V2\ListJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListJobs(\Google\Cloud\Run\V2\ListJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Jobs/ListJobs', - $argument, - ['\Google\Cloud\Run\V2\ListJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates a Job. - * @param \Google\Cloud\Run\V2\UpdateJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateJob(\Google\Cloud\Run\V2\UpdateJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Jobs/UpdateJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a Job. - * @param \Google\Cloud\Run\V2\DeleteJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteJob(\Google\Cloud\Run\V2\DeleteJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Jobs/DeleteJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Triggers creation of a new Execution of this Job. - * @param \Google\Cloud\Run\V2\RunJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function RunJob(\Google\Cloud\Run\V2\RunJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Jobs/RunJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets the IAM Access Control policy currently in effect for the given Job. - * This result does not include any inherited policies. - * @param \Google\Cloud\Iam\V1\GetIamPolicyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Jobs/GetIamPolicy', - $argument, - ['\Google\Cloud\Iam\V1\Policy', 'decode'], - $metadata, $options); - } - - /** - * Sets the IAM Access control policy for the specified Job. Overwrites - * any existing policy. - * @param \Google\Cloud\Iam\V1\SetIamPolicyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SetIamPolicy(\Google\Cloud\Iam\V1\SetIamPolicyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Jobs/SetIamPolicy', - $argument, - ['\Google\Cloud\Iam\V1\Policy', 'decode'], - $metadata, $options); - } - - /** - * Returns permissions that a caller has on the specified Project. - * - * There are no permissions required for making this API call. - * @param \Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function TestIamPermissions(\Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Jobs/TestIamPermissions', - $argument, - ['\Google\Cloud\Iam\V1\TestIamPermissionsResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/Run/src/V2/ListExecutionsRequest.php b/Run/src/V2/ListExecutionsRequest.php index f98e664d8a9c..909879ad84ea 100644 --- a/Run/src/V2/ListExecutionsRequest.php +++ b/Run/src/V2/ListExecutionsRequest.php @@ -23,26 +23,26 @@ 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 = ''; /** * Maximum number of Executions to return in this call. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token received from a previous call to ListExecutions. * All other parameters must match. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * If true, returns deleted (but unexpired) resources along with active ones. * * Generated from protobuf field bool show_deleted = 4; */ - private $show_deleted = false; + protected $show_deleted = false; /** * @param string $parent Required. The Execution from which the Executions should be listed. diff --git a/Run/src/V2/ListExecutionsResponse.php b/Run/src/V2/ListExecutionsResponse.php index 271ab6cc00d0..66ffa08a98f2 100644 --- a/Run/src/V2/ListExecutionsResponse.php +++ b/Run/src/V2/ListExecutionsResponse.php @@ -27,7 +27,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/Run/src/V2/ListJobsRequest.php b/Run/src/V2/ListJobsRequest.php index 4729fabd9d87..076ac55e2e82 100644 --- a/Run/src/V2/ListJobsRequest.php +++ b/Run/src/V2/ListJobsRequest.php @@ -22,26 +22,26 @@ class ListJobsRequest 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 = ''; /** * Maximum number of Jobs to return in this call. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token received from a previous call to ListJobs. * All other parameters must match. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * If true, returns deleted (but unexpired) resources along with active ones. * * Generated from protobuf field bool show_deleted = 4; */ - private $show_deleted = false; + protected $show_deleted = false; /** * @param string $parent Required. The location and project to list resources on. diff --git a/Run/src/V2/ListJobsResponse.php b/Run/src/V2/ListJobsResponse.php index c81edab1880e..1d0b4c4b6c6c 100644 --- a/Run/src/V2/ListJobsResponse.php +++ b/Run/src/V2/ListJobsResponse.php @@ -27,7 +27,7 @@ class ListJobsResponse 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/Run/src/V2/ListRevisionsRequest.php b/Run/src/V2/ListRevisionsRequest.php index 2ebc3cf9638a..01cde2b85c98 100644 --- a/Run/src/V2/ListRevisionsRequest.php +++ b/Run/src/V2/ListRevisionsRequest.php @@ -23,26 +23,26 @@ class ListRevisionsRequest 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 = ''; /** * Maximum number of revisions to return in this call. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token received from a previous call to ListRevisions. * All other parameters must match. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * If true, returns deleted (but unexpired) resources along with active ones. * * Generated from protobuf field bool show_deleted = 4; */ - private $show_deleted = false; + protected $show_deleted = false; /** * @param string $parent Required. The Service from which the Revisions should be listed. diff --git a/Run/src/V2/ListRevisionsResponse.php b/Run/src/V2/ListRevisionsResponse.php index 8e70e94c15a2..e4a2db90f4f3 100644 --- a/Run/src/V2/ListRevisionsResponse.php +++ b/Run/src/V2/ListRevisionsResponse.php @@ -27,7 +27,7 @@ class ListRevisionsResponse 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/Run/src/V2/ListServicesRequest.php b/Run/src/V2/ListServicesRequest.php index b0f6b04af52b..1cd78b619338 100644 --- a/Run/src/V2/ListServicesRequest.php +++ b/Run/src/V2/ListServicesRequest.php @@ -23,26 +23,26 @@ class ListServicesRequest 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 = ''; /** * Maximum number of Services to return in this call. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token received from a previous call to ListServices. * All other parameters must match. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * If true, returns deleted (but unexpired) resources along with active ones. * * Generated from protobuf field bool show_deleted = 4; */ - private $show_deleted = false; + protected $show_deleted = false; /** * @param string $parent Required. The location and project to list resources on. diff --git a/Run/src/V2/ListServicesResponse.php b/Run/src/V2/ListServicesResponse.php index c298a4b0f8a2..06cdb054df84 100644 --- a/Run/src/V2/ListServicesResponse.php +++ b/Run/src/V2/ListServicesResponse.php @@ -27,7 +27,7 @@ class ListServicesResponse 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/Run/src/V2/ListTasksRequest.php b/Run/src/V2/ListTasksRequest.php index 2bcd77611718..421799f38195 100644 --- a/Run/src/V2/ListTasksRequest.php +++ b/Run/src/V2/ListTasksRequest.php @@ -23,26 +23,26 @@ class ListTasksRequest 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 = ''; /** * Maximum number of Tasks to return in this call. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token received from a previous call to ListTasks. * All other parameters must match. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * If true, returns deleted (but unexpired) resources along with active ones. * * Generated from protobuf field bool show_deleted = 4; */ - private $show_deleted = false; + protected $show_deleted = false; /** * @param string $parent Required. The Execution from which the Tasks should be listed. diff --git a/Run/src/V2/ListTasksResponse.php b/Run/src/V2/ListTasksResponse.php index afbed5046a30..17804baa0f8d 100644 --- a/Run/src/V2/ListTasksResponse.php +++ b/Run/src/V2/ListTasksResponse.php @@ -27,7 +27,7 @@ class ListTasksResponse 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/Run/src/V2/NFSVolumeSource.php b/Run/src/V2/NFSVolumeSource.php index 3ea4eb8e4092..398d0ef74dba 100644 --- a/Run/src/V2/NFSVolumeSource.php +++ b/Run/src/V2/NFSVolumeSource.php @@ -20,19 +20,19 @@ class NFSVolumeSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string server = 1; */ - private $server = ''; + protected $server = ''; /** * Path that is exported by the NFS server. * * Generated from protobuf field string path = 2; */ - private $path = ''; + protected $path = ''; /** * If true, mount the NFS volume as read only * * Generated from protobuf field bool read_only = 3; */ - private $read_only = false; + protected $read_only = false; /** * Constructor. diff --git a/Run/src/V2/Probe.php b/Run/src/V2/Probe.php index 4a2813aef89d..ca921a33189a 100644 --- a/Run/src/V2/Probe.php +++ b/Run/src/V2/Probe.php @@ -24,7 +24,7 @@ class Probe extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 initial_delay_seconds = 1; */ - private $initial_delay_seconds = 0; + protected $initial_delay_seconds = 0; /** * Number of seconds after which the probe times out. * Defaults to 1 second. Minimum value is 1. Maximum value is 3600. @@ -32,7 +32,7 @@ class Probe extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 timeout_seconds = 2; */ - private $timeout_seconds = 0; + protected $timeout_seconds = 0; /** * How often (in seconds) to perform the probe. * Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe @@ -41,14 +41,14 @@ class Probe extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 period_seconds = 3; */ - private $period_seconds = 0; + protected $period_seconds = 0; /** * Minimum consecutive failures for the probe to be considered failed after * having succeeded. Defaults to 3. Minimum value is 1. * * Generated from protobuf field int32 failure_threshold = 4; */ - private $failure_threshold = 0; + protected $failure_threshold = 0; protected $probe_type; /** diff --git a/Run/src/V2/ResourceRequirements.php b/Run/src/V2/ResourceRequirements.php index 7cea3a4e4a73..9ba7760c5021 100644 --- a/Run/src/V2/ResourceRequirements.php +++ b/Run/src/V2/ResourceRequirements.php @@ -34,7 +34,7 @@ class ResourceRequirements extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool cpu_idle = 2; */ - private $cpu_idle = false; + protected $cpu_idle = false; /** * Determines whether CPU should be boosted on startup of a new container * instance above the requested CPU threshold, this can help reduce cold-start @@ -42,7 +42,7 @@ class ResourceRequirements extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool startup_cpu_boost = 3; */ - private $startup_cpu_boost = false; + protected $startup_cpu_boost = false; /** * Constructor. diff --git a/Run/src/V2/Revision.php b/Run/src/V2/Revision.php index 8e066042e423..18c074852e0b 100644 --- a/Run/src/V2/Revision.php +++ b/Run/src/V2/Revision.php @@ -22,7 +22,7 @@ class Revision extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Server assigned unique identifier for the Revision. The value * is a UUID4 string and guaranteed to remain unchanged until the resource is @@ -30,14 +30,14 @@ class Revision extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. A number that monotonically increases every time the user * modifies the desired state. * * Generated from protobuf field int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $generation = 0; + protected $generation = 0; /** * Output only. Unstructured key value map that can be used to organize and * categorize objects. User-provided labels are shared with Google's billing @@ -63,20 +63,20 @@ class Revision extends \Google\Protobuf\Internal\Message * * 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. The last-modified time. * * 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. For a deleted resource, the deletion time. It is only * populated as a response to a Delete request. * * Generated from protobuf field .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $delete_time = null; + protected $delete_time = null; /** * Output only. For a deleted resource, the time after which it will be * permamently deleted. It is only populated as a response to a Delete @@ -84,7 +84,7 @@ class Revision extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $expire_time = null; + protected $expire_time = null; /** * The least stable launch stage needed to create this resource, as defined by * [Google Cloud Platform Launch @@ -97,38 +97,38 @@ class Revision extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.api.LaunchStage launch_stage = 10; */ - private $launch_stage = 0; + protected $launch_stage = 0; /** * Output only. The name of the parent service. * * Generated from protobuf field string service = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $service = ''; + protected $service = ''; /** * Scaling settings for this revision. * * Generated from protobuf field .google.cloud.run.v2.RevisionScaling scaling = 12; */ - private $scaling = null; + protected $scaling = null; /** * VPC Access configuration for this Revision. For more information, visit * https://cloud.google.com/run/docs/configuring/connecting-vpc. * * Generated from protobuf field .google.cloud.run.v2.VpcAccess vpc_access = 13; */ - private $vpc_access = null; + protected $vpc_access = null; /** * Sets the maximum number of requests that each serving instance can receive. * * Generated from protobuf field int32 max_instance_request_concurrency = 34; */ - private $max_instance_request_concurrency = 0; + protected $max_instance_request_concurrency = 0; /** * Max allowed time for an instance to respond to a request. * * Generated from protobuf field .google.protobuf.Duration timeout = 15; */ - private $timeout = null; + protected $timeout = null; /** * Email address of the IAM service account associated with the revision of * the service. The service account represents the identity of the running @@ -136,7 +136,7 @@ class Revision extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 16; */ - private $service_account = ''; + protected $service_account = ''; /** * Holds the single container that defines the unit of execution for this * Revision. @@ -155,7 +155,7 @@ class Revision extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; */ - private $execution_environment = 0; + protected $execution_environment = 0; /** * A reference to a customer managed encryption key (CMEK) to use to encrypt * this container image. For more information, go to @@ -163,20 +163,20 @@ class Revision extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string encryption_key = 21 [(.google.api.resource_reference) = { */ - private $encryption_key = ''; + protected $encryption_key = ''; /** * The action to take if the encryption key is revoked. * * Generated from protobuf field .google.cloud.run.v2.EncryptionKeyRevocationAction encryption_key_revocation_action = 23; */ - private $encryption_key_revocation_action = 0; + protected $encryption_key_revocation_action = 0; /** * If encryption_key_revocation_action is SHUTDOWN, the duration before * shutting down all instances. The minimum increment is 1 hour. * * Generated from protobuf field .google.protobuf.Duration encryption_key_shutdown_duration = 24; */ - private $encryption_key_shutdown_duration = null; + protected $encryption_key_shutdown_duration = null; /** * Output only. Indicates whether the resource's reconciliation is still in * progress. See comments in `Service.reconciling` for additional information @@ -184,7 +184,7 @@ class Revision extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool reconciling = 30 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. The Condition of this Revision, containing its readiness * status, and detailed error information in case it did not reach a serving @@ -200,38 +200,38 @@ class Revision extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 observed_generation = 32 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $observed_generation = 0; + protected $observed_generation = 0; /** * Output only. The Google Console URI to obtain logs for the Revision. * * Generated from protobuf field string log_uri = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $log_uri = ''; + protected $log_uri = ''; /** * Output only. Reserved for future use. * * Generated from protobuf field bool satisfies_pzs = 37 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $satisfies_pzs = false; + protected $satisfies_pzs = false; /** * Enable session affinity. * * Generated from protobuf field bool session_affinity = 38; */ - private $session_affinity = false; + protected $session_affinity = false; /** * Output only. The current effective scaling settings for the revision. * * Generated from protobuf field .google.cloud.run.v2.RevisionScalingStatus scaling_status = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $scaling_status = null; + protected $scaling_status = null; /** * Output only. A system-generated fingerprint for this version of the * resource. May be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/Run/src/V2/RevisionScaling.php b/Run/src/V2/RevisionScaling.php index 6576bec4211c..7281a6d77eb2 100644 --- a/Run/src/V2/RevisionScaling.php +++ b/Run/src/V2/RevisionScaling.php @@ -20,13 +20,13 @@ class RevisionScaling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 min_instance_count = 1; */ - private $min_instance_count = 0; + protected $min_instance_count = 0; /** * Maximum number of serving instances that this resource should have. * * Generated from protobuf field int32 max_instance_count = 2; */ - private $max_instance_count = 0; + protected $max_instance_count = 0; /** * Constructor. diff --git a/Run/src/V2/RevisionScalingStatus.php b/Run/src/V2/RevisionScalingStatus.php index 5b09ed3bc686..fff365b91e71 100644 --- a/Run/src/V2/RevisionScalingStatus.php +++ b/Run/src/V2/RevisionScalingStatus.php @@ -20,7 +20,7 @@ class RevisionScalingStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 desired_min_instance_count = 1; */ - private $desired_min_instance_count = 0; + protected $desired_min_instance_count = 0; /** * Constructor. diff --git a/Run/src/V2/RevisionTemplate.php b/Run/src/V2/RevisionTemplate.php index 9f570d6f71e8..faf25e43eb1b 100644 --- a/Run/src/V2/RevisionTemplate.php +++ b/Run/src/V2/RevisionTemplate.php @@ -22,7 +22,7 @@ class RevisionTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string revision = 1 [(.google.api.resource_reference) = { */ - private $revision = ''; + protected $revision = ''; /** * Unstructured key value map that can be used to organize and categorize * objects. @@ -58,20 +58,20 @@ class RevisionTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.RevisionScaling scaling = 4; */ - private $scaling = null; + protected $scaling = null; /** * VPC Access configuration to use for this Revision. For more information, * visit https://cloud.google.com/run/docs/configuring/connecting-vpc. * * Generated from protobuf field .google.cloud.run.v2.VpcAccess vpc_access = 6; */ - private $vpc_access = null; + protected $vpc_access = null; /** * Max allowed time for an instance to respond to a request. * * Generated from protobuf field .google.protobuf.Duration timeout = 8; */ - private $timeout = null; + protected $timeout = null; /** * Email address of the IAM service account associated with the revision of * the service. The service account represents the identity of the running @@ -80,7 +80,7 @@ class RevisionTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 9; */ - private $service_account = ''; + protected $service_account = ''; /** * Holds the single container that defines the unit of execution for this * Revision. @@ -99,7 +99,7 @@ class RevisionTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.ExecutionEnvironment execution_environment = 13; */ - private $execution_environment = 0; + protected $execution_environment = 0; /** * A reference to a customer managed encryption key (CMEK) to use to encrypt * this container image. For more information, go to @@ -107,25 +107,25 @@ class RevisionTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string encryption_key = 14 [(.google.api.resource_reference) = { */ - private $encryption_key = ''; + protected $encryption_key = ''; /** * Sets the maximum number of requests that each serving instance can receive. * * Generated from protobuf field int32 max_instance_request_concurrency = 15; */ - private $max_instance_request_concurrency = 0; + protected $max_instance_request_concurrency = 0; /** * Optional. Enable session affinity. * * Generated from protobuf field bool session_affinity = 19 [(.google.api.field_behavior) = OPTIONAL]; */ - private $session_affinity = false; + protected $session_affinity = false; /** * Optional. Disables health checking containers during deployment. * * Generated from protobuf field bool health_check_disabled = 20 [(.google.api.field_behavior) = OPTIONAL]; */ - private $health_check_disabled = false; + protected $health_check_disabled = false; /** * Constructor. diff --git a/Run/src/V2/RevisionsClient.php b/Run/src/V2/RevisionsClient.php deleted file mode 100644 index 9c507591c4d8..000000000000 --- a/Run/src/V2/RevisionsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.run.v2.Revisions/GetRevision', - $argument, - ['\Google\Cloud\Run\V2\Revision', 'decode'], - $metadata, $options); - } - - /** - * Lists Revisions from a given Service, or from a given location. - * @param \Google\Cloud\Run\V2\ListRevisionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListRevisions(\Google\Cloud\Run\V2\ListRevisionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Revisions/ListRevisions', - $argument, - ['\Google\Cloud\Run\V2\ListRevisionsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a Revision. - * @param \Google\Cloud\Run\V2\DeleteRevisionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteRevision(\Google\Cloud\Run\V2\DeleteRevisionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Revisions/DeleteRevision', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - -} diff --git a/Run/src/V2/RunJobRequest.php b/Run/src/V2/RunJobRequest.php index 98ff39635958..bf51806e3bcb 100644 --- a/Run/src/V2/RunJobRequest.php +++ b/Run/src/V2/RunJobRequest.php @@ -22,28 +22,28 @@ class RunJobRequest 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 = ''; /** * Indicates that the request should be validated without actually * deleting any resources. * * Generated from protobuf field bool validate_only = 2; */ - private $validate_only = false; + protected $validate_only = false; /** * A system-generated fingerprint for this version of the * resource. May be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 3; */ - private $etag = ''; + protected $etag = ''; /** * Overrides specification for a given execution of a job. If provided, * overrides will be applied to update the execution or task spec. * * Generated from protobuf field .google.cloud.run.v2.RunJobRequest.Overrides overrides = 4; */ - private $overrides = null; + protected $overrides = null; /** * @param string $name Required. The full name of the Job. diff --git a/Run/src/V2/RunJobRequest/Overrides.php b/Run/src/V2/RunJobRequest/Overrides.php index d7421acd6b03..49e4ef353b67 100644 --- a/Run/src/V2/RunJobRequest/Overrides.php +++ b/Run/src/V2/RunJobRequest/Overrides.php @@ -27,7 +27,7 @@ class Overrides extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 task_count = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $task_count = 0; + protected $task_count = 0; /** * Duration in seconds the task may be active before the system will * actively try to mark it failed and kill associated containers. Will @@ -35,7 +35,7 @@ class Overrides extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration timeout = 4; */ - private $timeout = null; + protected $timeout = null; /** * Constructor. diff --git a/Run/src/V2/RunJobRequest/Overrides/ContainerOverride.php b/Run/src/V2/RunJobRequest/Overrides/ContainerOverride.php index 772df9b0478a..4c63ef277aa6 100644 --- a/Run/src/V2/RunJobRequest/Overrides/ContainerOverride.php +++ b/Run/src/V2/RunJobRequest/Overrides/ContainerOverride.php @@ -20,7 +20,7 @@ class ContainerOverride extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Optional. Arguments to the entrypoint. Will replace existing args for * override. @@ -40,7 +40,7 @@ class ContainerOverride extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool clear_args = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $clear_args = false; + protected $clear_args = false; /** * Constructor. diff --git a/Run/src/V2/SecretKeySelector.php b/Run/src/V2/SecretKeySelector.php index 4b70681dc5d7..060822bb2454 100644 --- a/Run/src/V2/SecretKeySelector.php +++ b/Run/src/V2/SecretKeySelector.php @@ -23,7 +23,7 @@ class SecretKeySelector extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string secret = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $secret = ''; + protected $secret = ''; /** * The Cloud Secret Manager secret version. * Can be 'latest' for the latest version, an integer for a specific version, @@ -31,7 +31,7 @@ class SecretKeySelector extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 2 [(.google.api.resource_reference) = { */ - private $version = ''; + protected $version = ''; /** * Constructor. diff --git a/Run/src/V2/SecretVolumeSource.php b/Run/src/V2/SecretVolumeSource.php index 7cced09d1478..9ee40f9e029b 100644 --- a/Run/src/V2/SecretVolumeSource.php +++ b/Run/src/V2/SecretVolumeSource.php @@ -25,7 +25,7 @@ class SecretVolumeSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string secret = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $secret = ''; + protected $secret = ''; /** * If unspecified, the volume will expose a file whose name is the * secret, relative to VolumeMount.mount_path. @@ -55,7 +55,7 @@ class SecretVolumeSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 default_mode = 3; */ - private $default_mode = 0; + protected $default_mode = 0; /** * Constructor. diff --git a/Run/src/V2/Service.php b/Run/src/V2/Service.php index ce804a548993..1477a16c6bad 100644 --- a/Run/src/V2/Service.php +++ b/Run/src/V2/Service.php @@ -28,14 +28,14 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * User-provided description of the Service. This field currently has a * 512-character limit. * * Generated from protobuf field string description = 2; */ - private $description = ''; + protected $description = ''; /** * Output only. Server assigned unique identifier for the trigger. The value * is a UUID4 string and guaranteed to remain unchanged until the resource is @@ -43,7 +43,7 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. A number that monotonically increases every time the user * modifies the desired state. @@ -52,7 +52,7 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 generation = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $generation = 0; + protected $generation = 0; /** * Optional. Unstructured key value map that can be used to organize and * categorize objects. User-provided labels are shared with Google's billing @@ -87,50 +87,50 @@ class Service 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. The last-modified time. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. The deletion time. * * Generated from protobuf field .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $delete_time = null; + protected $delete_time = null; /** * Output only. For a deleted resource, the time after which it will be * permamently deleted. * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $expire_time = null; + protected $expire_time = null; /** * Output only. Email address of the authenticated creator. * * Generated from protobuf field string creator = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $creator = ''; + protected $creator = ''; /** * Output only. Email address of the last authenticated modifier. * * Generated from protobuf field string last_modifier = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $last_modifier = ''; + protected $last_modifier = ''; /** * Arbitrary identifier for the API client. * * Generated from protobuf field string client = 13; */ - private $client = ''; + protected $client = ''; /** * Arbitrary version identifier for the API client. * * Generated from protobuf field string client_version = 14; */ - private $client_version = ''; + protected $client_version = ''; /** * Provides the ingress settings for this Service. On output, returns the * currently observed ingress settings, or INGRESS_TRAFFIC_UNSPECIFIED if no @@ -138,7 +138,7 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.IngressTraffic ingress = 15; */ - private $ingress = 0; + protected $ingress = 0; /** * The launch stage as defined by [Google Cloud Platform * Launch Stages](https://cloud.google.com/terms/launch-stages). @@ -153,19 +153,19 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.api.LaunchStage launch_stage = 16; */ - private $launch_stage = 0; + protected $launch_stage = 0; /** * Settings for the Binary Authorization feature. * * Generated from protobuf field .google.cloud.run.v2.BinaryAuthorization binary_authorization = 17; */ - private $binary_authorization = null; + protected $binary_authorization = null; /** * Required. The template used to create revisions for this Service. * * Generated from protobuf field .google.cloud.run.v2.RevisionTemplate template = 18 [(.google.api.field_behavior) = REQUIRED]; */ - private $template = null; + protected $template = null; /** * Specifies how to distribute traffic over a collection of Revisions * belonging to the Service. If traffic is empty or not provided, defaults to @@ -179,13 +179,13 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.ServiceScaling scaling = 20 [(.google.api.field_behavior) = OPTIONAL]; */ - private $scaling = null; + protected $scaling = null; /** * Optional. Disables public resolution of the default URI of this service. * * Generated from protobuf field bool default_uri_disabled = 22 [(.google.api.field_behavior) = OPTIONAL]; */ - private $default_uri_disabled = false; + protected $default_uri_disabled = false; /** * Output only. The generation of this Service currently serving traffic. See * comments in `reconciling` for additional information on reconciliation @@ -195,7 +195,7 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 observed_generation = 30 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $observed_generation = 0; + protected $observed_generation = 0; /** * Output only. The Condition of this Service, containing its readiness * status, and detailed error information in case it did not reach a serving @@ -204,7 +204,7 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.Condition terminal_condition = 31 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $terminal_condition = null; + protected $terminal_condition = null; /** * Output only. The Conditions of all other associated sub-resources. They * contain additional diagnostics information in case the Service does not @@ -221,7 +221,7 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string latest_ready_revision = 33 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $latest_ready_revision = ''; + protected $latest_ready_revision = ''; /** * Output only. Name of the last created revision. See comments in * `reconciling` for additional information on reconciliation process in Cloud @@ -229,7 +229,7 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string latest_created_revision = 34 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $latest_created_revision = ''; + protected $latest_created_revision = ''; /** * Output only. Detailed status information for corresponding traffic targets. * See comments in `reconciling` for additional information on reconciliation @@ -243,7 +243,7 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 36 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uri = ''; + protected $uri = ''; /** * One or more custom audiences that you want this service to support. Specify * each custom audience as the full URL in a string. The custom audiences are @@ -259,7 +259,7 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool satisfies_pzs = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $satisfies_pzs = false; + protected $satisfies_pzs = false; /** * Output only. Returns true if the Service is currently being acted upon by * the system to bring it into the desired state. @@ -283,14 +283,14 @@ class Service extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool reconciling = 98 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. A system-generated fingerprint for this version of the * resource. May be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/Run/src/V2/ServiceScaling.php b/Run/src/V2/ServiceScaling.php index 9bf331828eab..c6dd10dcc249 100644 --- a/Run/src/V2/ServiceScaling.php +++ b/Run/src/V2/ServiceScaling.php @@ -23,7 +23,7 @@ class ServiceScaling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 min_instance_count = 1; */ - private $min_instance_count = 0; + protected $min_instance_count = 0; /** * Constructor. diff --git a/Run/src/V2/ServicesClient.php b/Run/src/V2/ServicesClient.php deleted file mode 100644 index d55275f3491b..000000000000 --- a/Run/src/V2/ServicesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.run.v2.Services/CreateService', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets information about a Service. - * @param \Google\Cloud\Run\V2\GetServiceRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetService(\Google\Cloud\Run\V2\GetServiceRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Services/GetService', - $argument, - ['\Google\Cloud\Run\V2\Service', 'decode'], - $metadata, $options); - } - - /** - * Lists Services. - * @param \Google\Cloud\Run\V2\ListServicesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListServices(\Google\Cloud\Run\V2\ListServicesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Services/ListServices', - $argument, - ['\Google\Cloud\Run\V2\ListServicesResponse', 'decode'], - $metadata, $options); - } - - /** - * Updates a Service. - * @param \Google\Cloud\Run\V2\UpdateServiceRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateService(\Google\Cloud\Run\V2\UpdateServiceRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Services/UpdateService', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a Service. - * This will cause the Service to stop serving traffic and will delete all - * revisions. - * @param \Google\Cloud\Run\V2\DeleteServiceRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteService(\Google\Cloud\Run\V2\DeleteServiceRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Services/DeleteService', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets the IAM Access Control policy currently in effect for the given - * Cloud Run Service. This result does not include any inherited policies. - * @param \Google\Cloud\Iam\V1\GetIamPolicyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Services/GetIamPolicy', - $argument, - ['\Google\Cloud\Iam\V1\Policy', 'decode'], - $metadata, $options); - } - - /** - * Sets the IAM Access control policy for the specified Service. Overwrites - * any existing policy. - * @param \Google\Cloud\Iam\V1\SetIamPolicyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SetIamPolicy(\Google\Cloud\Iam\V1\SetIamPolicyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Services/SetIamPolicy', - $argument, - ['\Google\Cloud\Iam\V1\Policy', 'decode'], - $metadata, $options); - } - - /** - * Returns permissions that a caller has on the specified Project. - * - * There are no permissions required for making this API call. - * @param \Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function TestIamPermissions(\Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Services/TestIamPermissions', - $argument, - ['\Google\Cloud\Iam\V1\TestIamPermissionsResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/Run/src/V2/TCPSocketAction.php b/Run/src/V2/TCPSocketAction.php index 60d269a9a879..3b347233e649 100644 --- a/Run/src/V2/TCPSocketAction.php +++ b/Run/src/V2/TCPSocketAction.php @@ -22,7 +22,7 @@ class TCPSocketAction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 port = 1; */ - private $port = 0; + protected $port = 0; /** * Constructor. diff --git a/Run/src/V2/Task.php b/Run/src/V2/Task.php index efc2a3298c8e..6fe2768394c2 100644 --- a/Run/src/V2/Task.php +++ b/Run/src/V2/Task.php @@ -20,7 +20,7 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Server assigned unique identifier for the Task. The value is a * UUID4 string and guaranteed to remain unchanged until the resource is @@ -28,14 +28,14 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Output only. A number that monotonically increases every time the user * modifies the desired state. * * Generated from protobuf field int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $generation = 0; + protected $generation = 0; /** * Output only. Unstructured key value map that can be used to organize and * categorize objects. User-provided labels are shared with Google's billing @@ -63,7 +63,7 @@ class Task extends \Google\Protobuf\Internal\Message * * 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. Represents time when the task was scheduled to run by the * system. It is not guaranteed to be set in happens-before order across @@ -71,7 +71,7 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp scheduled_time = 34 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $scheduled_time = null; + protected $scheduled_time = null; /** * Output only. Represents time when the task started to run. * It is not guaranteed to be set in happens-before order across separate @@ -79,27 +79,27 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $start_time = null; + protected $start_time = null; /** * Output only. Represents time when the Task was completed. It is not * guaranteed to be set in happens-before order across separate operations. * * Generated from protobuf field .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $completion_time = null; + protected $completion_time = null; /** * Output only. The last-modified time. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. For a deleted resource, the deletion time. It is only * populated as a response to a Delete request. * * Generated from protobuf field .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $delete_time = null; + protected $delete_time = null; /** * Output only. For a deleted resource, the time after which it will be * permamently deleted. It is only populated as a response to a Delete @@ -107,19 +107,19 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $expire_time = null; + protected $expire_time = null; /** * Output only. The name of the parent Job. * * Generated from protobuf field string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $job = ''; + protected $job = ''; /** * Output only. The name of the parent Execution. * * Generated from protobuf field string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $execution = ''; + protected $execution = ''; /** * Holds the single container that defines the unit of execution for this * task. @@ -138,7 +138,7 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 max_retries = 16; */ - private $max_retries = 0; + protected $max_retries = 0; /** * Max allowed time duration the Task may be active before the system will * actively try to mark it failed and kill associated containers. This applies @@ -146,7 +146,7 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration timeout = 17; */ - private $timeout = null; + protected $timeout = null; /** * Email address of the IAM service account associated with the Task of a * Job. The service account represents the identity of the @@ -155,13 +155,13 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 18; */ - private $service_account = ''; + protected $service_account = ''; /** * The execution environment being used to host this Task. * * Generated from protobuf field .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; */ - private $execution_environment = 0; + protected $execution_environment = 0; /** * Output only. Indicates whether the resource's reconciliation is still in * progress. See comments in `Job.reconciling` for additional information on @@ -169,7 +169,7 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool reconciling = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $reconciling = false; + protected $reconciling = false; /** * Output only. The Condition of this Task, containing its readiness status, * and detailed error information in case it did not reach the desired state. @@ -183,26 +183,26 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 observed_generation = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $observed_generation = 0; + protected $observed_generation = 0; /** * Output only. Index of the Task, unique per execution, and beginning at 0. * * Generated from protobuf field int32 index = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $index = 0; + protected $index = 0; /** * Output only. The number of times this Task was retried. * Tasks are retried when they fail up to the maxRetries limit. * * Generated from protobuf field int32 retried = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $retried = 0; + protected $retried = 0; /** * Output only. Result of the last attempt of this Task. * * Generated from protobuf field .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $last_attempt_result = null; + protected $last_attempt_result = null; /** * Output only. A reference to a customer managed encryption key (CMEK) to use * to encrypt this container image. For more information, go to @@ -210,7 +210,7 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $encryption_key = ''; + protected $encryption_key = ''; /** * Output only. VPC Access configuration to use for this Task. For more * information, visit @@ -218,27 +218,27 @@ class Task extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $vpc_access = null; + protected $vpc_access = null; /** * Output only. URI where logs for this execution can be found in Cloud * Console. * * Generated from protobuf field string log_uri = 32 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $log_uri = ''; + protected $log_uri = ''; /** * Output only. Reserved for future use. * * Generated from protobuf field bool satisfies_pzs = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $satisfies_pzs = false; + protected $satisfies_pzs = false; /** * Output only. A system-generated fingerprint for this version of the * resource. May be used to detect modification conflict during updates. * * Generated from protobuf field string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/Run/src/V2/TaskAttemptResult.php b/Run/src/V2/TaskAttemptResult.php index 62ac52cb2264..26a5923b91a0 100644 --- a/Run/src/V2/TaskAttemptResult.php +++ b/Run/src/V2/TaskAttemptResult.php @@ -21,7 +21,7 @@ class TaskAttemptResult extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $status = null; + protected $status = null; /** * Output only. The exit code of this attempt. * This may be unset if the container was unable to exit cleanly with a code @@ -30,7 +30,7 @@ class TaskAttemptResult extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 exit_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $exit_code = 0; + protected $exit_code = 0; /** * Constructor. diff --git a/Run/src/V2/TaskTemplate.php b/Run/src/V2/TaskTemplate.php index 78acc99eeba9..0fe94d73a5c9 100644 --- a/Run/src/V2/TaskTemplate.php +++ b/Run/src/V2/TaskTemplate.php @@ -37,7 +37,7 @@ class TaskTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration timeout = 4; */ - private $timeout = null; + protected $timeout = null; /** * Email address of the IAM service account associated with the Task of a * Job. The service account represents the identity of the @@ -46,13 +46,13 @@ class TaskTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 5; */ - private $service_account = ''; + protected $service_account = ''; /** * The execution environment being used to host this Task. * * Generated from protobuf field .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; */ - private $execution_environment = 0; + protected $execution_environment = 0; /** * A reference to a customer managed encryption key (CMEK) to use to encrypt * this container image. For more information, go to @@ -60,14 +60,14 @@ class TaskTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string encryption_key = 7 [(.google.api.resource_reference) = { */ - private $encryption_key = ''; + protected $encryption_key = ''; /** * VPC Access configuration to use for this Task. For more information, * visit https://cloud.google.com/run/docs/configuring/connecting-vpc. * * Generated from protobuf field .google.cloud.run.v2.VpcAccess vpc_access = 8; */ - private $vpc_access = null; + protected $vpc_access = null; protected $retries; /** diff --git a/Run/src/V2/TasksClient.php b/Run/src/V2/TasksClient.php deleted file mode 100644 index 65cfd5c23c1d..000000000000 --- a/Run/src/V2/TasksClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.run.v2.Tasks/GetTask', - $argument, - ['\Google\Cloud\Run\V2\Task', 'decode'], - $metadata, $options); - } - - /** - * Lists Tasks from an Execution of a Job. - * @param \Google\Cloud\Run\V2\ListTasksRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListTasks(\Google\Cloud\Run\V2\ListTasksRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.run.v2.Tasks/ListTasks', - $argument, - ['\Google\Cloud\Run\V2\ListTasksResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/Run/src/V2/TrafficTarget.php b/Run/src/V2/TrafficTarget.php index 9e1dad885ff6..b4264dd3a661 100644 --- a/Run/src/V2/TrafficTarget.php +++ b/Run/src/V2/TrafficTarget.php @@ -21,28 +21,28 @@ class TrafficTarget extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.TrafficTargetAllocationType type = 1; */ - private $type = 0; + protected $type = 0; /** * Revision to which to send this portion of traffic, if traffic allocation is * by revision. * * Generated from protobuf field string revision = 2 [(.google.api.resource_reference) = { */ - private $revision = ''; + protected $revision = ''; /** * Specifies percent of the traffic to this Revision. * This defaults to zero if unspecified. * * Generated from protobuf field int32 percent = 3; */ - private $percent = 0; + protected $percent = 0; /** * Indicates a string to be part of the URI to exclusively reference this * target. * * Generated from protobuf field string tag = 4; */ - private $tag = ''; + protected $tag = ''; /** * Constructor. diff --git a/Run/src/V2/TrafficTargetStatus.php b/Run/src/V2/TrafficTargetStatus.php index 4dc863b966f2..b03251c15e89 100644 --- a/Run/src/V2/TrafficTargetStatus.php +++ b/Run/src/V2/TrafficTargetStatus.php @@ -20,31 +20,31 @@ class TrafficTargetStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.TrafficTargetAllocationType type = 1; */ - private $type = 0; + protected $type = 0; /** * Revision to which this traffic is sent. * * Generated from protobuf field string revision = 2 [(.google.api.resource_reference) = { */ - private $revision = ''; + protected $revision = ''; /** * Specifies percent of the traffic to this Revision. * * Generated from protobuf field int32 percent = 3; */ - private $percent = 0; + protected $percent = 0; /** * Indicates the string used in the URI to exclusively reference this target. * * Generated from protobuf field string tag = 4; */ - private $tag = ''; + protected $tag = ''; /** * Displays the target URI. * * Generated from protobuf field string uri = 5; */ - private $uri = ''; + protected $uri = ''; /** * Constructor. diff --git a/Run/src/V2/UpdateJobRequest.php b/Run/src/V2/UpdateJobRequest.php index c8b9972eef69..c64cc556b577 100644 --- a/Run/src/V2/UpdateJobRequest.php +++ b/Run/src/V2/UpdateJobRequest.php @@ -20,14 +20,14 @@ class UpdateJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $job = null; + protected $job = null; /** * Indicates that the request should be validated and default values * populated, without persisting the request or updating any resources. * * Generated from protobuf field bool validate_only = 3; */ - private $validate_only = false; + protected $validate_only = false; /** * If set to true, and if the Job does not exist, it will create a new * one. Caller must have both create and update permissions for this call if @@ -35,7 +35,7 @@ class UpdateJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 4; */ - private $allow_missing = false; + protected $allow_missing = false; /** * @param \Google\Cloud\Run\V2\Job $job Required. The Job to be updated. diff --git a/Run/src/V2/UpdateServiceRequest.php b/Run/src/V2/UpdateServiceRequest.php index c493075f1ac1..2982f8686b09 100644 --- a/Run/src/V2/UpdateServiceRequest.php +++ b/Run/src/V2/UpdateServiceRequest.php @@ -20,14 +20,14 @@ class UpdateServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.run.v2.Service service = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $service = null; + protected $service = null; /** * Indicates that the request should be validated and default values * populated, without persisting the request or updating any resources. * * Generated from protobuf field bool validate_only = 3; */ - private $validate_only = false; + protected $validate_only = false; /** * If set to true, and if the Service does not exist, it will create a new * one. The caller must have 'run.services.create' permissions if this is set @@ -35,7 +35,7 @@ class UpdateServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_missing = 4; */ - private $allow_missing = false; + protected $allow_missing = false; /** * @param \Google\Cloud\Run\V2\Service $service Required. The Service to be updated. diff --git a/Run/src/V2/VersionToPath.php b/Run/src/V2/VersionToPath.php index 6d91c965c2dd..0b16674ef3ea 100644 --- a/Run/src/V2/VersionToPath.php +++ b/Run/src/V2/VersionToPath.php @@ -21,7 +21,7 @@ class VersionToPath extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string path = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $path = ''; + protected $path = ''; /** * The Cloud Secret Manager secret version. * Can be 'latest' for the latest value, or an integer or a secret alias for a @@ -29,7 +29,7 @@ class VersionToPath extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 2; */ - private $version = ''; + protected $version = ''; /** * Integer octal mode bits to use on this file, must be a value between * 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be @@ -47,7 +47,7 @@ class VersionToPath extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 mode = 3; */ - private $mode = 0; + protected $mode = 0; /** * Constructor. diff --git a/Run/src/V2/Volume.php b/Run/src/V2/Volume.php index 976f548980d8..0614cda4f015 100644 --- a/Run/src/V2/Volume.php +++ b/Run/src/V2/Volume.php @@ -20,7 +20,7 @@ class Volume extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; protected $volume_type; /** diff --git a/Run/src/V2/VolumeMount.php b/Run/src/V2/VolumeMount.php index 97b76a2d4727..979b27f20847 100644 --- a/Run/src/V2/VolumeMount.php +++ b/Run/src/V2/VolumeMount.php @@ -20,7 +20,7 @@ class VolumeMount extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $name = ''; + protected $name = ''; /** * Required. Path within the container at which the volume should be mounted. * Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must @@ -30,7 +30,7 @@ class VolumeMount extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string mount_path = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $mount_path = ''; + protected $mount_path = ''; /** * Constructor. diff --git a/Run/src/V2/VpcAccess.php b/Run/src/V2/VpcAccess.php index 96a21e2c0e18..1277f070dec8 100644 --- a/Run/src/V2/VpcAccess.php +++ b/Run/src/V2/VpcAccess.php @@ -25,14 +25,14 @@ class VpcAccess extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string connector = 1 [(.google.api.resource_reference) = { */ - private $connector = ''; + protected $connector = ''; /** * Traffic VPC egress settings. If not provided, it defaults to * PRIVATE_RANGES_ONLY. * * Generated from protobuf field .google.cloud.run.v2.VpcAccess.VpcEgress egress = 2; */ - private $egress = 0; + protected $egress = 0; /** * Direct VPC egress settings. Currently only single network interface is * supported. diff --git a/Run/src/V2/VpcAccess/NetworkInterface.php b/Run/src/V2/VpcAccess/NetworkInterface.php index e25775f46a09..bb3ebe565658 100644 --- a/Run/src/V2/VpcAccess/NetworkInterface.php +++ b/Run/src/V2/VpcAccess/NetworkInterface.php @@ -24,7 +24,7 @@ class NetworkInterface extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 1; */ - private $network = ''; + protected $network = ''; /** * The VPC subnetwork that the Cloud Run resource will get IPs from. At * least one of network or subnetwork must be specified. If both @@ -34,7 +34,7 @@ class NetworkInterface extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string subnetwork = 2; */ - private $subnetwork = ''; + protected $subnetwork = ''; /** * Network tags applied to this Cloud Run resource. * diff --git a/Run/tests/Unit/V2/Client/ExecutionsClientTest.php b/Run/tests/Unit/V2/Client/ExecutionsClientTest.php index 05628d034528..4be2b51337e5 100644 --- a/Run/tests/Unit/V2/Client/ExecutionsClientTest.php +++ b/Run/tests/Unit/V2/Client/ExecutionsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ExecutionsClient */ @@ -131,8 +133,7 @@ public function cancelExecutionTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - $request = (new CancelExecutionRequest()) - ->setName($formattedName); + $request = (new CancelExecutionRequest())->setName($formattedName); $response = $gapicClient->cancelExecution($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -188,17 +189,19 @@ public function cancelExecutionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]', '[JOB]', '[EXECUTION]'); - $request = (new CancelExecutionRequest()) - ->setName($formattedName); + $request = (new CancelExecutionRequest())->setName($formattedName); $response = $gapicClient->cancelExecution($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -284,8 +287,7 @@ public function deleteExecutionTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - $request = (new DeleteExecutionRequest()) - ->setName($formattedName); + $request = (new DeleteExecutionRequest())->setName($formattedName); $response = $gapicClient->deleteExecution($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -341,17 +343,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]', '[JOB]', '[EXECUTION]'); - $request = (new DeleteExecutionRequest()) - ->setName($formattedName); + $request = (new DeleteExecutionRequest())->setName($formattedName); $response = $gapicClient->deleteExecution($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -419,8 +423,7 @@ public function getExecutionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - $request = (new GetExecutionRequest()) - ->setName($formattedName); + $request = (new GetExecutionRequest())->setName($formattedName); $response = $gapicClient->getExecution($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -444,17 +447,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]', '[JOB]', '[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 @@ -479,17 +484,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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $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()); @@ -516,17 +518,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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $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 @@ -603,8 +607,7 @@ public function cancelExecutionAsyncTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - $request = (new CancelExecutionRequest()) - ->setName($formattedName); + $request = (new CancelExecutionRequest())->setName($formattedName); $response = $gapicClient->cancelExecutionAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/Run/tests/Unit/V2/Client/JobsClientTest.php b/Run/tests/Unit/V2/Client/JobsClientTest.php index 87993586da78..0b7d940d0c08 100644 --- a/Run/tests/Unit/V2/Client/JobsClientTest.php +++ b/Run/tests/Unit/V2/Client/JobsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return JobsClient */ @@ -202,12 +204,15 @@ public function createJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -298,8 +303,7 @@ public function deleteJobTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $request = (new DeleteJobRequest()) - ->setName($formattedName); + $request = (new DeleteJobRequest())->setName($formattedName); $response = $gapicClient->deleteJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -355,17 +359,19 @@ public function deleteJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $request = (new DeleteJobRequest()) - ->setName($formattedName); + $request = (new DeleteJobRequest())->setName($formattedName); $response = $gapicClient->deleteJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -405,8 +411,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(); @@ -430,17 +435,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 @@ -491,8 +498,7 @@ public function getJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $request = (new GetJobRequest()) - ->setName($formattedName); + $request = (new GetJobRequest())->setName($formattedName); $response = $gapicClient->getJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -516,17 +522,19 @@ public function getJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $request = (new GetJobRequest()) - ->setName($formattedName); + $request = (new GetJobRequest())->setName($formattedName); try { $gapicClient->getJob($request); // If the $gapicClient method call did not throw, fail the test @@ -551,17 +559,14 @@ public function listJobsTest() // Mock response $nextPageToken = ''; $jobsElement = new Job(); - $jobs = [ - $jobsElement, - ]; + $jobs = [$jobsElement]; $expectedResponse = new ListJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setJobs($jobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListJobsRequest()) - ->setParent($formattedParent); + $request = (new ListJobsRequest())->setParent($formattedParent); $response = $gapicClient->listJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -588,17 +593,19 @@ public function listJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListJobsRequest()) - ->setParent($formattedParent); + $request = (new ListJobsRequest())->setParent($formattedParent); try { $gapicClient->listJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -675,8 +682,7 @@ public function runJobTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $request = (new RunJobRequest()) - ->setName($formattedName); + $request = (new RunJobRequest())->setName($formattedName); $response = $gapicClient->runJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -732,17 +738,19 @@ public function runJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $request = (new RunJobRequest()) - ->setName($formattedName); + $request = (new RunJobRequest())->setName($formattedName); $response = $gapicClient->runJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -783,9 +791,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(); @@ -811,19 +817,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 @@ -851,9 +858,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(); @@ -879,19 +884,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 @@ -964,8 +970,7 @@ public function updateJobTest() $templateTemplate = new TaskTemplate(); $jobTemplate->setTemplate($templateTemplate); $job->setTemplate($jobTemplate); - $request = (new UpdateJobRequest()) - ->setJob($job); + $request = (new UpdateJobRequest())->setJob($job); $response = $gapicClient->updateJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1021,12 +1026,15 @@ public function updateJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $job = new Job(); @@ -1034,8 +1042,7 @@ public function updateJobExceptionTest() $templateTemplate = new TaskTemplate(); $jobTemplate->setTemplate($templateTemplate); $job->setTemplate($jobTemplate); - $request = (new UpdateJobRequest()) - ->setJob($job); + $request = (new UpdateJobRequest())->setJob($job); $response = $gapicClient->updateJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/Run/tests/Unit/V2/Client/RevisionsClientTest.php b/Run/tests/Unit/V2/Client/RevisionsClientTest.php index 3edcccf962cc..7c332b7facbc 100644 --- a/Run/tests/Unit/V2/Client/RevisionsClientTest.php +++ b/Run/tests/Unit/V2/Client/RevisionsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RevisionsClient */ @@ -124,8 +126,7 @@ public function deleteRevisionTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - $request = (new DeleteRevisionRequest()) - ->setName($formattedName); + $request = (new DeleteRevisionRequest())->setName($formattedName); $response = $gapicClient->deleteRevision($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -181,17 +182,19 @@ public function deleteRevisionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - $request = (new DeleteRevisionRequest()) - ->setName($formattedName); + $request = (new DeleteRevisionRequest())->setName($formattedName); $response = $gapicClient->deleteRevision($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -253,8 +256,7 @@ public function getRevisionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - $request = (new GetRevisionRequest()) - ->setName($formattedName); + $request = (new GetRevisionRequest())->setName($formattedName); $response = $gapicClient->getRevision($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -278,17 +280,19 @@ public function getRevisionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - $request = (new GetRevisionRequest()) - ->setName($formattedName); + $request = (new GetRevisionRequest())->setName($formattedName); try { $gapicClient->getRevision($request); // If the $gapicClient method call did not throw, fail the test @@ -313,17 +317,14 @@ public function listRevisionsTest() // Mock response $nextPageToken = ''; $revisionsElement = new Revision(); - $revisions = [ - $revisionsElement, - ]; + $revisions = [$revisionsElement]; $expectedResponse = new ListRevisionsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setRevisions($revisions); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $request = (new ListRevisionsRequest()) - ->setParent($formattedParent); + $request = (new ListRevisionsRequest())->setParent($formattedParent); $response = $gapicClient->listRevisions($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -350,17 +351,19 @@ public function listRevisionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $request = (new ListRevisionsRequest()) - ->setParent($formattedParent); + $request = (new ListRevisionsRequest())->setParent($formattedParent); try { $gapicClient->listRevisions($request); // If the $gapicClient method call did not throw, fail the test @@ -431,8 +434,7 @@ public function deleteRevisionAsyncTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - $request = (new DeleteRevisionRequest()) - ->setName($formattedName); + $request = (new DeleteRevisionRequest())->setName($formattedName); $response = $gapicClient->deleteRevisionAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/Run/tests/Unit/V2/Client/ServicesClientTest.php b/Run/tests/Unit/V2/Client/ServicesClientTest.php index 9c3737a33f20..e9f9c5834b8e 100644 --- a/Run/tests/Unit/V2/Client/ServicesClientTest.php +++ b/Run/tests/Unit/V2/Client/ServicesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ServicesClient */ @@ -205,12 +207,15 @@ public function createServiceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -307,8 +312,7 @@ public function deleteServiceTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $request = (new DeleteServiceRequest()) - ->setName($formattedName); + $request = (new DeleteServiceRequest())->setName($formattedName); $response = $gapicClient->deleteService($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -364,17 +368,19 @@ public function deleteServiceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $request = (new DeleteServiceRequest()) - ->setName($formattedName); + $request = (new DeleteServiceRequest())->setName($formattedName); $response = $gapicClient->deleteService($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -414,8 +420,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(); @@ -439,17 +444,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 @@ -508,8 +515,7 @@ public function getServiceTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $request = (new GetServiceRequest()) - ->setName($formattedName); + $request = (new GetServiceRequest())->setName($formattedName); $response = $gapicClient->getService($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -533,17 +539,19 @@ public function getServiceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $request = (new GetServiceRequest()) - ->setName($formattedName); + $request = (new GetServiceRequest())->setName($formattedName); try { $gapicClient->getService($request); // If the $gapicClient method call did not throw, fail the test @@ -568,17 +576,14 @@ public function listServicesTest() // Mock response $nextPageToken = ''; $servicesElement = new Service(); - $services = [ - $servicesElement, - ]; + $services = [$servicesElement]; $expectedResponse = new ListServicesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setServices($services); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListServicesRequest()) - ->setParent($formattedParent); + $request = (new ListServicesRequest())->setParent($formattedParent); $response = $gapicClient->listServices($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -605,17 +610,19 @@ public function listServicesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListServicesRequest()) - ->setParent($formattedParent); + $request = (new ListServicesRequest())->setParent($formattedParent); try { $gapicClient->listServices($request); // If the $gapicClient method call did not throw, fail the test @@ -647,9 +654,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(); @@ -675,19 +680,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 @@ -715,9 +721,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(); @@ -743,19 +747,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 @@ -834,8 +839,7 @@ public function updateServiceTest() $service = new Service(); $serviceTemplate = new RevisionTemplate(); $service->setTemplate($serviceTemplate); - $request = (new UpdateServiceRequest()) - ->setService($service); + $request = (new UpdateServiceRequest())->setService($service); $response = $gapicClient->updateService($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -891,19 +895,21 @@ public function updateServiceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $service = new Service(); $serviceTemplate = new RevisionTemplate(); $service->setTemplate($serviceTemplate); - $request = (new UpdateServiceRequest()) - ->setService($service); + $request = (new UpdateServiceRequest())->setService($service); $response = $gapicClient->updateService($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/Run/tests/Unit/V2/Client/TasksClientTest.php b/Run/tests/Unit/V2/Client/TasksClientTest.php index c4535a917a59..4369fa2836e2 100644 --- a/Run/tests/Unit/V2/Client/TasksClientTest.php +++ b/Run/tests/Unit/V2/Client/TasksClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TasksClient */ @@ -105,8 +107,7 @@ public function getTaskTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->taskName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]', '[TASK]'); - $request = (new GetTaskRequest()) - ->setName($formattedName); + $request = (new GetTaskRequest())->setName($formattedName); $response = $gapicClient->getTask($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -130,17 +131,19 @@ public function getTaskExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->taskName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]', '[TASK]'); - $request = (new GetTaskRequest()) - ->setName($formattedName); + $request = (new GetTaskRequest())->setName($formattedName); try { $gapicClient->getTask($request); // If the $gapicClient method call did not throw, fail the test @@ -165,17 +168,14 @@ public function listTasksTest() // Mock response $nextPageToken = ''; $tasksElement = new Task(); - $tasks = [ - $tasksElement, - ]; + $tasks = [$tasksElement]; $expectedResponse = new ListTasksResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTasks($tasks); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - $request = (new ListTasksRequest()) - ->setParent($formattedParent); + $request = (new ListTasksRequest())->setParent($formattedParent); $response = $gapicClient->listTasks($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -202,17 +202,19 @@ public function listTasksExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - $request = (new ListTasksRequest()) - ->setParent($formattedParent); + $request = (new ListTasksRequest())->setParent($formattedParent); try { $gapicClient->listTasks($request); // If the $gapicClient method call did not throw, fail the test @@ -269,8 +271,7 @@ public function getTaskAsyncTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->taskName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]', '[TASK]'); - $request = (new GetTaskRequest()) - ->setName($formattedName); + $request = (new GetTaskRequest())->setName($formattedName); $response = $gapicClient->getTaskAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/Run/tests/Unit/V2/ExecutionsClientTest.php b/Run/tests/Unit/V2/ExecutionsClientTest.php deleted file mode 100644 index 48cc458371e1..000000000000 --- a/Run/tests/Unit/V2/ExecutionsClientTest.php +++ /dev/null @@ -1,522 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ExecutionsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ExecutionsClient($options); - } - - /** @test */ - public function cancelExecutionTest() - { - $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/cancelExecutionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $uid = 'uid115792'; - $generation = 305703192; - $job = 'job105405'; - $parallelism = 635164956; - $taskCount = 1297805781; - $reconciling = false; - $observedGeneration = 900833007; - $runningCount = 261439119; - $succeededCount = 633694641; - $failedCount = 2013829491; - $cancelledCount = 1921113249; - $retriedCount = 1654679545; - $logUri = 'logUri342054385'; - $satisfiesPzs = false; - $etag2 = 'etag2-1293302904'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name2); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setJob($job); - $expectedResponse->setParallelism($parallelism); - $expectedResponse->setTaskCount($taskCount); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setRunningCount($runningCount); - $expectedResponse->setSucceededCount($succeededCount); - $expectedResponse->setFailedCount($failedCount); - $expectedResponse->setCancelledCount($cancelledCount); - $expectedResponse->setRetriedCount($retriedCount); - $expectedResponse->setLogUri($logUri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setEtag($etag2); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/cancelExecutionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - $response = $gapicClient->cancelExecution($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.run.v2.Executions/CancelExecution', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/cancelExecutionTest'); - $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 cancelExecutionExceptionTest() - { - $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/cancelExecutionTest'); - $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]', '[JOB]', '[EXECUTION]'); - $response = $gapicClient->cancelExecution($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/cancelExecutionTest'); - 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); - $name2 = 'name2-1052831874'; - $uid = 'uid115792'; - $generation = 305703192; - $job = 'job105405'; - $parallelism = 635164956; - $taskCount = 1297805781; - $reconciling = false; - $observedGeneration = 900833007; - $runningCount = 261439119; - $succeededCount = 633694641; - $failedCount = 2013829491; - $cancelledCount = 1921113249; - $retriedCount = 1654679545; - $logUri = 'logUri342054385'; - $satisfiesPzs = false; - $etag2 = 'etag2-1293302904'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name2); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setJob($job); - $expectedResponse->setParallelism($parallelism); - $expectedResponse->setTaskCount($taskCount); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setRunningCount($runningCount); - $expectedResponse->setSucceededCount($succeededCount); - $expectedResponse->setFailedCount($failedCount); - $expectedResponse->setCancelledCount($cancelledCount); - $expectedResponse->setRetriedCount($retriedCount); - $expectedResponse->setLogUri($logUri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setEtag($etag2); - $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]', '[JOB]', '[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.run.v2.Executions/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]', '[JOB]', '[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 getExecutionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $uid = 'uid115792'; - $generation = 305703192; - $job = 'job105405'; - $parallelism = 635164956; - $taskCount = 1297805781; - $reconciling = false; - $observedGeneration = 900833007; - $runningCount = 261439119; - $succeededCount = 633694641; - $failedCount = 2013829491; - $cancelledCount = 1921113249; - $retriedCount = 1654679545; - $logUri = 'logUri342054385'; - $satisfiesPzs = false; - $etag = 'etag3123477'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name2); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setJob($job); - $expectedResponse->setParallelism($parallelism); - $expectedResponse->setTaskCount($taskCount); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setRunningCount($runningCount); - $expectedResponse->setSucceededCount($succeededCount); - $expectedResponse->setFailedCount($failedCount); - $expectedResponse->setCancelledCount($cancelledCount); - $expectedResponse->setRetriedCount($retriedCount); - $expectedResponse->setLogUri($logUri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[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.run.v2.Executions/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]', '[JOB]', '[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 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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $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.run.v2.Executions/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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - 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()); - } -} diff --git a/Run/tests/Unit/V2/JobsClientTest.php b/Run/tests/Unit/V2/JobsClientTest.php deleted file mode 100644 index 1ac8f2a17d84..000000000000 --- a/Run/tests/Unit/V2/JobsClientTest.php +++ /dev/null @@ -1,1007 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return JobsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new JobsClient($options); - } - - /** @test */ - public function createJobTest() - { - $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/createJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $uid = 'uid115792'; - $generation = 305703192; - $creator = 'creator1028554796'; - $lastModifier = 'lastModifier-28366240'; - $client = 'client-1357712437'; - $clientVersion = 'clientVersion-1506231196'; - $observedGeneration = 900833007; - $executionCount = 1646136616; - $reconciling = false; - $satisfiesPzs = false; - $etag = 'etag3123477'; - $expectedResponse = new Job(); - $expectedResponse->setName($name); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setCreator($creator); - $expectedResponse->setLastModifier($lastModifier); - $expectedResponse->setClient($client); - $expectedResponse->setClientVersion($clientVersion); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setExecutionCount($executionCount); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $job = new Job(); - $jobTemplate = new ExecutionTemplate(); - $templateTemplate = new TaskTemplate(); - $jobTemplate->setTemplate($templateTemplate); - $job->setTemplate($jobTemplate); - $jobId = 'jobId-1154752291'; - $response = $gapicClient->createJob($formattedParent, $job, $jobId); - $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.run.v2.Jobs/CreateJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getJob(); - $this->assertProtobufEquals($job, $actualValue); - $actualValue = $actualApiRequestObject->getJobId(); - $this->assertProtobufEquals($jobId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createJobTest'); - $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 createJobExceptionTest() - { - $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/createJobTest'); - $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]'); - $job = new Job(); - $jobTemplate = new ExecutionTemplate(); - $templateTemplate = new TaskTemplate(); - $jobTemplate->setTemplate($templateTemplate); - $job->setTemplate($jobTemplate); - $jobId = 'jobId-1154752291'; - $response = $gapicClient->createJob($formattedParent, $job, $jobId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createJobTest'); - 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 deleteJobTest() - { - $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/deleteJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $uid = 'uid115792'; - $generation = 305703192; - $creator = 'creator1028554796'; - $lastModifier = 'lastModifier-28366240'; - $client = 'client-1357712437'; - $clientVersion = 'clientVersion-1506231196'; - $observedGeneration = 900833007; - $executionCount = 1646136616; - $reconciling = false; - $satisfiesPzs = false; - $etag2 = 'etag2-1293302904'; - $expectedResponse = new Job(); - $expectedResponse->setName($name2); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setCreator($creator); - $expectedResponse->setLastModifier($lastModifier); - $expectedResponse->setClient($client); - $expectedResponse->setClientVersion($clientVersion); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setExecutionCount($executionCount); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setEtag($etag2); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $response = $gapicClient->deleteJob($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.run.v2.Jobs/DeleteJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteJobTest'); - $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 deleteJobExceptionTest() - { - $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/deleteJobTest'); - $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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $response = $gapicClient->deleteJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteJobTest'); - 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 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.cloud.run.v2.Jobs/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 getJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $uid = 'uid115792'; - $generation = 305703192; - $creator = 'creator1028554796'; - $lastModifier = 'lastModifier-28366240'; - $client = 'client-1357712437'; - $clientVersion = 'clientVersion-1506231196'; - $observedGeneration = 900833007; - $executionCount = 1646136616; - $reconciling = false; - $satisfiesPzs = false; - $etag = 'etag3123477'; - $expectedResponse = new Job(); - $expectedResponse->setName($name2); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setCreator($creator); - $expectedResponse->setLastModifier($lastModifier); - $expectedResponse->setClient($client); - $expectedResponse->setClientVersion($clientVersion); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setExecutionCount($executionCount); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $response = $gapicClient->getJob($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.run.v2.Jobs/GetJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - try { - $gapicClient->getJob($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 listJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $jobsElement = new Job(); - $jobs = [ - $jobsElement, - ]; - $expectedResponse = new ListJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setJobs($jobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.run.v2.Jobs/ListJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listJobs($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 runJobTest() - { - $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/runJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $uid = 'uid115792'; - $generation = 305703192; - $job = 'job105405'; - $parallelism = 635164956; - $taskCount = 1297805781; - $reconciling = false; - $observedGeneration = 900833007; - $runningCount = 261439119; - $succeededCount = 633694641; - $failedCount = 2013829491; - $cancelledCount = 1921113249; - $retriedCount = 1654679545; - $logUri = 'logUri342054385'; - $satisfiesPzs = false; - $etag2 = 'etag2-1293302904'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name2); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setJob($job); - $expectedResponse->setParallelism($parallelism); - $expectedResponse->setTaskCount($taskCount); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setRunningCount($runningCount); - $expectedResponse->setSucceededCount($succeededCount); - $expectedResponse->setFailedCount($failedCount); - $expectedResponse->setCancelledCount($cancelledCount); - $expectedResponse->setRetriedCount($retriedCount); - $expectedResponse->setLogUri($logUri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setEtag($etag2); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/runJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $response = $gapicClient->runJob($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.run.v2.Jobs/RunJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/runJobTest'); - $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 runJobExceptionTest() - { - $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/runJobTest'); - $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->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); - $response = $gapicClient->runJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/runJobTest'); - 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 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.cloud.run.v2.Jobs/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.cloud.run.v2.Jobs/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()); - } - - /** @test */ - public function updateJobTest() - { - $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/updateJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $uid = 'uid115792'; - $generation = 305703192; - $creator = 'creator1028554796'; - $lastModifier = 'lastModifier-28366240'; - $client = 'client-1357712437'; - $clientVersion = 'clientVersion-1506231196'; - $observedGeneration = 900833007; - $executionCount = 1646136616; - $reconciling = false; - $satisfiesPzs = false; - $etag = 'etag3123477'; - $expectedResponse = new Job(); - $expectedResponse->setName($name); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setCreator($creator); - $expectedResponse->setLastModifier($lastModifier); - $expectedResponse->setClient($client); - $expectedResponse->setClientVersion($clientVersion); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setExecutionCount($executionCount); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $job = new Job(); - $jobTemplate = new ExecutionTemplate(); - $templateTemplate = new TaskTemplate(); - $jobTemplate->setTemplate($templateTemplate); - $job->setTemplate($jobTemplate); - $response = $gapicClient->updateJob($job); - $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.run.v2.Jobs/UpdateJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getJob(); - $this->assertProtobufEquals($job, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateJobTest'); - $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 updateJobExceptionTest() - { - $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/updateJobTest'); - $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 - $job = new Job(); - $jobTemplate = new ExecutionTemplate(); - $templateTemplate = new TaskTemplate(); - $jobTemplate->setTemplate($templateTemplate); - $job->setTemplate($jobTemplate); - $response = $gapicClient->updateJob($job); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateJobTest'); - 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()); - } -} diff --git a/Run/tests/Unit/V2/RevisionsClientTest.php b/Run/tests/Unit/V2/RevisionsClientTest.php deleted file mode 100644 index 986bad60c0d1..000000000000 --- a/Run/tests/Unit/V2/RevisionsClientTest.php +++ /dev/null @@ -1,361 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RevisionsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RevisionsClient($options); - } - - /** @test */ - public function deleteRevisionTest() - { - $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/deleteRevisionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $uid = 'uid115792'; - $generation = 305703192; - $service = 'service1984153269'; - $maxInstanceRequestConcurrency = 117250100; - $serviceAccount = 'serviceAccount-1948028253'; - $encryptionKey = 'encryptionKey-1122344029'; - $reconciling = false; - $observedGeneration = 900833007; - $logUri = 'logUri342054385'; - $satisfiesPzs = false; - $sessionAffinity = false; - $etag2 = 'etag2-1293302904'; - $expectedResponse = new Revision(); - $expectedResponse->setName($name2); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setService($service); - $expectedResponse->setMaxInstanceRequestConcurrency($maxInstanceRequestConcurrency); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setEncryptionKey($encryptionKey); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setLogUri($logUri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSessionAffinity($sessionAffinity); - $expectedResponse->setEtag($etag2); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteRevisionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - $response = $gapicClient->deleteRevision($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.run.v2.Revisions/DeleteRevision', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteRevisionTest'); - $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 deleteRevisionExceptionTest() - { - $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/deleteRevisionTest'); - $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->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - $response = $gapicClient->deleteRevision($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteRevisionTest'); - 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 getRevisionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $uid = 'uid115792'; - $generation = 305703192; - $service = 'service1984153269'; - $maxInstanceRequestConcurrency = 117250100; - $serviceAccount = 'serviceAccount-1948028253'; - $encryptionKey = 'encryptionKey-1122344029'; - $reconciling = false; - $observedGeneration = 900833007; - $logUri = 'logUri342054385'; - $satisfiesPzs = false; - $sessionAffinity = false; - $etag = 'etag3123477'; - $expectedResponse = new Revision(); - $expectedResponse->setName($name2); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setService($service); - $expectedResponse->setMaxInstanceRequestConcurrency($maxInstanceRequestConcurrency); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setEncryptionKey($encryptionKey); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setLogUri($logUri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSessionAffinity($sessionAffinity); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - $response = $gapicClient->getRevision($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.run.v2.Revisions/GetRevision', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRevisionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->revisionName('[PROJECT]', '[LOCATION]', '[SERVICE]', '[REVISION]'); - try { - $gapicClient->getRevision($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 listRevisionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $revisionsElement = new Revision(); - $revisions = [ - $revisionsElement, - ]; - $expectedResponse = new ListRevisionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setRevisions($revisions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $response = $gapicClient->listRevisions($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getRevisions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.run.v2.Revisions/ListRevisions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listRevisionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - try { - $gapicClient->listRevisions($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()); - } -} diff --git a/Run/tests/Unit/V2/ServicesClientTest.php b/Run/tests/Unit/V2/ServicesClientTest.php deleted file mode 100644 index f1d7ee6561e5..000000000000 --- a/Run/tests/Unit/V2/ServicesClientTest.php +++ /dev/null @@ -1,880 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ServicesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ServicesClient($options); - } - - /** @test */ - public function createServiceTest() - { - $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/createServiceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $generation = 305703192; - $creator = 'creator1028554796'; - $lastModifier = 'lastModifier-28366240'; - $client = 'client-1357712437'; - $clientVersion = 'clientVersion-1506231196'; - $defaultUriDisabled = false; - $observedGeneration = 900833007; - $latestReadyRevision = 'latestReadyRevision-853854545'; - $latestCreatedRevision = 'latestCreatedRevision452370698'; - $uri = 'uri116076'; - $satisfiesPzs = false; - $reconciling = false; - $etag = 'etag3123477'; - $expectedResponse = new Service(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setCreator($creator); - $expectedResponse->setLastModifier($lastModifier); - $expectedResponse->setClient($client); - $expectedResponse->setClientVersion($clientVersion); - $expectedResponse->setDefaultUriDisabled($defaultUriDisabled); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setLatestReadyRevision($latestReadyRevision); - $expectedResponse->setLatestCreatedRevision($latestCreatedRevision); - $expectedResponse->setUri($uri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createServiceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $service = new Service(); - $serviceTemplate = new RevisionTemplate(); - $service->setTemplate($serviceTemplate); - $serviceId = 'serviceId-1724763419'; - $response = $gapicClient->createService($formattedParent, $service, $serviceId); - $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.run.v2.Services/CreateService', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getService(); - $this->assertProtobufEquals($service, $actualValue); - $actualValue = $actualApiRequestObject->getServiceId(); - $this->assertProtobufEquals($serviceId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createServiceTest'); - $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 createServiceExceptionTest() - { - $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/createServiceTest'); - $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]'); - $service = new Service(); - $serviceTemplate = new RevisionTemplate(); - $service->setTemplate($serviceTemplate); - $serviceId = 'serviceId-1724763419'; - $response = $gapicClient->createService($formattedParent, $service, $serviceId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createServiceTest'); - 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 deleteServiceTest() - { - $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/deleteServiceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $generation = 305703192; - $creator = 'creator1028554796'; - $lastModifier = 'lastModifier-28366240'; - $client = 'client-1357712437'; - $clientVersion = 'clientVersion-1506231196'; - $defaultUriDisabled = false; - $observedGeneration = 900833007; - $latestReadyRevision = 'latestReadyRevision-853854545'; - $latestCreatedRevision = 'latestCreatedRevision452370698'; - $uri = 'uri116076'; - $satisfiesPzs = false; - $reconciling = false; - $etag2 = 'etag2-1293302904'; - $expectedResponse = new Service(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setCreator($creator); - $expectedResponse->setLastModifier($lastModifier); - $expectedResponse->setClient($client); - $expectedResponse->setClientVersion($clientVersion); - $expectedResponse->setDefaultUriDisabled($defaultUriDisabled); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setLatestReadyRevision($latestReadyRevision); - $expectedResponse->setLatestCreatedRevision($latestCreatedRevision); - $expectedResponse->setUri($uri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag2); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteServiceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $response = $gapicClient->deleteService($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.run.v2.Services/DeleteService', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); - $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 deleteServiceExceptionTest() - { - $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/deleteServiceTest'); - $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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $response = $gapicClient->deleteService($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteServiceTest'); - 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 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.cloud.run.v2.Services/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 getServiceTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $generation = 305703192; - $creator = 'creator1028554796'; - $lastModifier = 'lastModifier-28366240'; - $client = 'client-1357712437'; - $clientVersion = 'clientVersion-1506231196'; - $defaultUriDisabled = false; - $observedGeneration = 900833007; - $latestReadyRevision = 'latestReadyRevision-853854545'; - $latestCreatedRevision = 'latestCreatedRevision452370698'; - $uri = 'uri116076'; - $satisfiesPzs = false; - $reconciling = false; - $etag = 'etag3123477'; - $expectedResponse = new Service(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setCreator($creator); - $expectedResponse->setLastModifier($lastModifier); - $expectedResponse->setClient($client); - $expectedResponse->setClientVersion($clientVersion); - $expectedResponse->setDefaultUriDisabled($defaultUriDisabled); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setLatestReadyRevision($latestReadyRevision); - $expectedResponse->setLatestCreatedRevision($latestCreatedRevision); - $expectedResponse->setUri($uri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - $response = $gapicClient->getService($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.run.v2.Services/GetService', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getServiceExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]'); - try { - $gapicClient->getService($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 listServicesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $servicesElement = new Service(); - $services = [ - $servicesElement, - ]; - $expectedResponse = new ListServicesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setServices($services); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listServices($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getServices()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.run.v2.Services/ListServices', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listServicesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listServices($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 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.cloud.run.v2.Services/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.cloud.run.v2.Services/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()); - } - - /** @test */ - public function updateServiceTest() - { - $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/updateServiceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $generation = 305703192; - $creator = 'creator1028554796'; - $lastModifier = 'lastModifier-28366240'; - $client = 'client-1357712437'; - $clientVersion = 'clientVersion-1506231196'; - $defaultUriDisabled = false; - $observedGeneration = 900833007; - $latestReadyRevision = 'latestReadyRevision-853854545'; - $latestCreatedRevision = 'latestCreatedRevision452370698'; - $uri = 'uri116076'; - $satisfiesPzs = false; - $reconciling = false; - $etag = 'etag3123477'; - $expectedResponse = new Service(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setCreator($creator); - $expectedResponse->setLastModifier($lastModifier); - $expectedResponse->setClient($client); - $expectedResponse->setClientVersion($clientVersion); - $expectedResponse->setDefaultUriDisabled($defaultUriDisabled); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setLatestReadyRevision($latestReadyRevision); - $expectedResponse->setLatestCreatedRevision($latestCreatedRevision); - $expectedResponse->setUri($uri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateServiceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $service = new Service(); - $serviceTemplate = new RevisionTemplate(); - $service->setTemplate($serviceTemplate); - $response = $gapicClient->updateService($service); - $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.run.v2.Services/UpdateService', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getService(); - $this->assertProtobufEquals($service, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateServiceTest'); - $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 updateServiceExceptionTest() - { - $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/updateServiceTest'); - $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 - $service = new Service(); - $serviceTemplate = new RevisionTemplate(); - $service->setTemplate($serviceTemplate); - $response = $gapicClient->updateService($service); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateServiceTest'); - 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()); - } -} diff --git a/Run/tests/Unit/V2/TasksClientTest.php b/Run/tests/Unit/V2/TasksClientTest.php deleted file mode 100644 index 9d84ebf2bf21..000000000000 --- a/Run/tests/Unit/V2/TasksClientTest.php +++ /dev/null @@ -1,218 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TasksClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TasksClient($options); - } - - /** @test */ - public function getTaskTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $uid = 'uid115792'; - $generation = 305703192; - $job = 'job105405'; - $execution = 'execution-1090974952'; - $maxRetries = 1129288043; - $serviceAccount = 'serviceAccount-1948028253'; - $reconciling = false; - $observedGeneration = 900833007; - $index = 100346066; - $retried = 1098377527; - $encryptionKey = 'encryptionKey-1122344029'; - $logUri = 'logUri342054385'; - $satisfiesPzs = false; - $etag = 'etag3123477'; - $expectedResponse = new Task(); - $expectedResponse->setName($name2); - $expectedResponse->setUid($uid); - $expectedResponse->setGeneration($generation); - $expectedResponse->setJob($job); - $expectedResponse->setExecution($execution); - $expectedResponse->setMaxRetries($maxRetries); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setObservedGeneration($observedGeneration); - $expectedResponse->setIndex($index); - $expectedResponse->setRetried($retried); - $expectedResponse->setEncryptionKey($encryptionKey); - $expectedResponse->setLogUri($logUri); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->taskName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]', '[TASK]'); - $response = $gapicClient->getTask($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.run.v2.Tasks/GetTask', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTaskExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->taskName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]', '[TASK]'); - try { - $gapicClient->getTask($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 listTasksTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $tasksElement = new Task(); - $tasks = [ - $tasksElement, - ]; - $expectedResponse = new ListTasksResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTasks($tasks); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - $response = $gapicClient->listTasks($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTasks()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.run.v2.Tasks/ListTasks', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTasksExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->executionName('[PROJECT]', '[LOCATION]', '[JOB]', '[EXECUTION]'); - try { - $gapicClient->listTasks($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()); - } -} diff --git a/StorageInsights/README.md b/StorageInsights/README.md index 1762cd3d59ca..68f40d673e18 100644 --- a/StorageInsights/README.md +++ b/StorageInsights/README.md @@ -38,7 +38,8 @@ See the [samples directory](samples/) for a canonical list of samples. ### Version -This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. +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/StorageInsights/owlbot.py b/StorageInsights/owlbot.py index 6804fc2c6396..d96588783ab2 100644 --- a/StorageInsights/owlbot.py +++ b/StorageInsights/owlbot.py @@ -30,14 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php", - src / "**/*GrpcClient.php" - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -56,8 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) + '--print-width=120']) diff --git a/StorageInsights/src/V1/Client/StorageInsightsClient.php b/StorageInsights/src/V1/Client/StorageInsightsClient.php index 6e7b89150114..3150e1978763 100644 --- a/StorageInsights/src/V1/Client/StorageInsightsClient.php +++ b/StorageInsights/src/V1/Client/StorageInsightsClient.php @@ -1,6 +1,6 @@ render([ 'project' => $project, 'location' => $location, diff --git a/StorageInsights/src/V1/Gapic/StorageInsightsGapicClient.php b/StorageInsights/src/V1/Gapic/StorageInsightsGapicClient.php deleted file mode 100644 index 5bf14777a7d5..000000000000 --- a/StorageInsights/src/V1/Gapic/StorageInsightsGapicClient.php +++ /dev/null @@ -1,986 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $reportConfig = new ReportConfig(); - * $response = $storageInsightsClient->createReportConfig($formattedParent, $reportConfig); - * } finally { - * $storageInsightsClient->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\StorageInsights\V1\Client\StorageInsightsClient}. - */ -class StorageInsightsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.storageinsights.v1.StorageInsights'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'storageinsights.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'storageinsights.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 $reportConfigNameTemplate; - - private static $reportDetailNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/storage_insights_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/storage_insights_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/storage_insights_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/storage_insights_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 getReportConfigNameTemplate() - { - if (self::$reportConfigNameTemplate == null) { - self::$reportConfigNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/reportConfigs/{report_config}' - ); - } - - return self::$reportConfigNameTemplate; - } - - private static function getReportDetailNameTemplate() - { - if (self::$reportDetailNameTemplate == null) { - self::$reportDetailNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/reportConfigs/{report_config}/reportDetails/{report_detail}' - ); - } - - return self::$reportDetailNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'location' => self::getLocationNameTemplate(), - 'reportConfig' => self::getReportConfigNameTemplate(), - 'reportDetail' => self::getReportDetailNameTemplate(), - ]; - } - - 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 - * report_config resource. - * - * @param string $project - * @param string $location - * @param string $reportConfig - * - * @return string The formatted report_config resource. - */ - public static function reportConfigName($project, $location, $reportConfig) - { - return self::getReportConfigNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'report_config' => $reportConfig, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * report_detail resource. - * - * @param string $project - * @param string $location - * @param string $reportConfig - * @param string $reportDetail - * - * @return string The formatted report_detail resource. - */ - public static function reportDetailName( - $project, - $location, - $reportConfig, - $reportDetail - ) { - return self::getReportDetailNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'report_config' => $reportConfig, - 'report_detail' => $reportDetail, - ]); - } - - /** - * 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} - * - reportConfig: projects/{project}/locations/{location}/reportConfigs/{report_config} - * - reportDetail: projects/{project}/locations/{location}/reportConfigs/{report_config}/reportDetails/{report_detail} - * - * 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 'storageinsights.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); - } - - /** - * Creates a new ReportConfig in a given project and location. - * - * Sample code: - * ``` - * $storageInsightsClient = new StorageInsightsClient(); - * try { - * $formattedParent = $storageInsightsClient->locationName('[PROJECT]', '[LOCATION]'); - * $reportConfig = new ReportConfig(); - * $response = $storageInsightsClient->createReportConfig($formattedParent, $reportConfig); - * } finally { - * $storageInsightsClient->close(); - * } - * ``` - * - * @param string $parent Required. Value for parent. - * @param ReportConfig $reportConfig Required. The resource being created - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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\StorageInsights\V1\ReportConfig - * - * @throws ApiException if the remote call fails - */ - public function createReportConfig( - $parent, - $reportConfig, - array $optionalArgs = [] - ) { - $request = new CreateReportConfigRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setReportConfig($reportConfig); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateReportConfig', - ReportConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes a single ReportConfig. - * - * Sample code: - * ``` - * $storageInsightsClient = new StorageInsightsClient(); - * try { - * $formattedName = $storageInsightsClient->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - * $storageInsightsClient->deleteReportConfig($formattedName); - * } finally { - * $storageInsightsClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the resource - * @param array $optionalArgs { - * Optional. - * - * @type bool $force - * Optional. If set, all ReportDetails for this ReportConfig will be deleted. - * @type string $requestId - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this 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 deleteReportConfig($name, array $optionalArgs = []) - { - $request = new DeleteReportConfigRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'DeleteReportConfig', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single ReportConfig. - * - * Sample code: - * ``` - * $storageInsightsClient = new StorageInsightsClient(); - * try { - * $formattedName = $storageInsightsClient->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - * $response = $storageInsightsClient->getReportConfig($formattedName); - * } finally { - * $storageInsightsClient->close(); - * } - * ``` - * - * @param string $name Required. Name of 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\Cloud\StorageInsights\V1\ReportConfig - * - * @throws ApiException if the remote call fails - */ - public function getReportConfig($name, array $optionalArgs = []) - { - $request = new GetReportConfigRequest(); - $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( - 'GetReportConfig', - ReportConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single ReportDetail. - * - * Sample code: - * ``` - * $storageInsightsClient = new StorageInsightsClient(); - * try { - * $formattedName = $storageInsightsClient->reportDetailName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]', '[REPORT_DETAIL]'); - * $response = $storageInsightsClient->getReportDetail($formattedName); - * } finally { - * $storageInsightsClient->close(); - * } - * ``` - * - * @param string $name Required. Name of 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\Cloud\StorageInsights\V1\ReportDetail - * - * @throws ApiException if the remote call fails - */ - public function getReportDetail($name, array $optionalArgs = []) - { - $request = new GetReportDetailRequest(); - $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( - 'GetReportDetail', - ReportDetail::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists ReportConfigs in a given project and location. - * - * Sample code: - * ``` - * $storageInsightsClient = new StorageInsightsClient(); - * try { - * $formattedParent = $storageInsightsClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $storageInsightsClient->listReportConfigs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $storageInsightsClient->listReportConfigs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $storageInsightsClient->close(); - * } - * ``` - * - * @param string $parent Required. Parent value for ListReportConfigsRequest - * @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 - * Filtering results - * @type string $orderBy - * Hint for how to order the 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 listReportConfigs($parent, array $optionalArgs = []) - { - $request = new ListReportConfigsRequest(); - $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( - 'ListReportConfigs', - $optionalArgs, - ListReportConfigsResponse::class, - $request - ); - } - - /** - * Lists ReportDetails in a given project and location. - * - * Sample code: - * ``` - * $storageInsightsClient = new StorageInsightsClient(); - * try { - * $formattedParent = $storageInsightsClient->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - * // Iterate over pages of elements - * $pagedResponse = $storageInsightsClient->listReportDetails($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $storageInsightsClient->listReportDetails($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $storageInsightsClient->close(); - * } - * ``` - * - * @param string $parent Required. Parent value for ListReportDetailsRequest - * @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 - * Filtering results - * @type string $orderBy - * Hint for how to order the 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 listReportDetails($parent, array $optionalArgs = []) - { - $request = new ListReportDetailsRequest(); - $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( - 'ListReportDetails', - $optionalArgs, - ListReportDetailsResponse::class, - $request - ); - } - - /** - * Updates the parameters of a single ReportConfig. - * - * Sample code: - * ``` - * $storageInsightsClient = new StorageInsightsClient(); - * try { - * $updateMask = new FieldMask(); - * $reportConfig = new ReportConfig(); - * $response = $storageInsightsClient->updateReportConfig($updateMask, $reportConfig); - * } finally { - * $storageInsightsClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * ReportConfig 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 all fields will be overwritten. - * @param ReportConfig $reportConfig Required. The resource being updated - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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\StorageInsights\V1\ReportConfig - * - * @throws ApiException if the remote call fails - */ - public function updateReportConfig( - $updateMask, - $reportConfig, - array $optionalArgs = [] - ) { - $request = new UpdateReportConfigRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setReportConfig($reportConfig); - $requestParamHeaders['report_config.name'] = $reportConfig->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateReportConfig', - ReportConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $storageInsightsClient = new StorageInsightsClient(); - * try { - * $response = $storageInsightsClient->getLocation(); - * } finally { - * $storageInsightsClient->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: - * ``` - * $storageInsightsClient = new StorageInsightsClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $storageInsightsClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $storageInsightsClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $storageInsightsClient->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' - ); - } -} diff --git a/StorageInsights/src/V1/StorageInsightsClient.php b/StorageInsights/src/V1/StorageInsightsClient.php deleted file mode 100644 index 33e0c0f20f45..000000000000 --- a/StorageInsights/src/V1/StorageInsightsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return StorageInsightsClient */ @@ -93,9 +95,7 @@ public function createReportConfigTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $reportConfig = new ReportConfig(); - $request = (new CreateReportConfigRequest()) - ->setParent($formattedParent) - ->setReportConfig($reportConfig); + $request = (new CreateReportConfigRequest())->setParent($formattedParent)->setReportConfig($reportConfig); $response = $gapicClient->createReportConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -121,19 +121,20 @@ public function createReportConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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]'); $reportConfig = new ReportConfig(); - $request = (new CreateReportConfigRequest()) - ->setParent($formattedParent) - ->setReportConfig($reportConfig); + $request = (new CreateReportConfigRequest())->setParent($formattedParent)->setReportConfig($reportConfig); try { $gapicClient->createReportConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -160,8 +161,7 @@ public function deleteReportConfigTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - $request = (new DeleteReportConfigRequest()) - ->setName($formattedName); + $request = (new DeleteReportConfigRequest())->setName($formattedName); $gapicClient->deleteReportConfig($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -184,17 +184,19 @@ public function deleteReportConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - $request = (new DeleteReportConfigRequest()) - ->setName($formattedName); + $request = (new DeleteReportConfigRequest())->setName($formattedName); try { $gapicClient->deleteReportConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -225,8 +227,7 @@ public function getReportConfigTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - $request = (new GetReportConfigRequest()) - ->setName($formattedName); + $request = (new GetReportConfigRequest())->setName($formattedName); $response = $gapicClient->getReportConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -250,17 +251,19 @@ public function getReportConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - $request = (new GetReportConfigRequest()) - ->setName($formattedName); + $request = (new GetReportConfigRequest())->setName($formattedName); try { $gapicClient->getReportConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -292,9 +295,13 @@ public function getReportDetailTest() $expectedResponse->setShardsCount($shardsCount); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->reportDetailName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]', '[REPORT_DETAIL]'); - $request = (new GetReportDetailRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->reportDetailName( + '[PROJECT]', + '[LOCATION]', + '[REPORT_CONFIG]', + '[REPORT_DETAIL]' + ); + $request = (new GetReportDetailRequest())->setName($formattedName); $response = $gapicClient->getReportDetail($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -318,17 +325,24 @@ public function getReportDetailExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->reportDetailName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]', '[REPORT_DETAIL]'); - $request = (new GetReportDetailRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->reportDetailName( + '[PROJECT]', + '[LOCATION]', + '[REPORT_CONFIG]', + '[REPORT_DETAIL]' + ); + $request = (new GetReportDetailRequest())->setName($formattedName); try { $gapicClient->getReportDetail($request); // If the $gapicClient method call did not throw, fail the test @@ -353,17 +367,14 @@ public function listReportConfigsTest() // Mock response $nextPageToken = ''; $reportConfigsElement = new ReportConfig(); - $reportConfigs = [ - $reportConfigsElement, - ]; + $reportConfigs = [$reportConfigsElement]; $expectedResponse = new ListReportConfigsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setReportConfigs($reportConfigs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListReportConfigsRequest()) - ->setParent($formattedParent); + $request = (new ListReportConfigsRequest())->setParent($formattedParent); $response = $gapicClient->listReportConfigs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -390,17 +401,19 @@ public function listReportConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListReportConfigsRequest()) - ->setParent($formattedParent); + $request = (new ListReportConfigsRequest())->setParent($formattedParent); try { $gapicClient->listReportConfigs($request); // If the $gapicClient method call did not throw, fail the test @@ -425,17 +438,14 @@ public function listReportDetailsTest() // Mock response $nextPageToken = ''; $reportDetailsElement = new ReportDetail(); - $reportDetails = [ - $reportDetailsElement, - ]; + $reportDetails = [$reportDetailsElement]; $expectedResponse = new ListReportDetailsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setReportDetails($reportDetails); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - $request = (new ListReportDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListReportDetailsRequest())->setParent($formattedParent); $response = $gapicClient->listReportDetails($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -462,17 +472,19 @@ public function listReportDetailsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - $request = (new ListReportDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListReportDetailsRequest())->setParent($formattedParent); try { $gapicClient->listReportDetails($request); // If the $gapicClient method call did not throw, fail the test @@ -504,9 +516,7 @@ public function updateReportConfigTest() // Mock request $updateMask = new FieldMask(); $reportConfig = new ReportConfig(); - $request = (new UpdateReportConfigRequest()) - ->setUpdateMask($updateMask) - ->setReportConfig($reportConfig); + $request = (new UpdateReportConfigRequest())->setUpdateMask($updateMask)->setReportConfig($reportConfig); $response = $gapicClient->updateReportConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -532,19 +542,20 @@ public function updateReportConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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(); $reportConfig = new ReportConfig(); - $request = (new UpdateReportConfigRequest()) - ->setUpdateMask($updateMask) - ->setReportConfig($reportConfig); + $request = (new UpdateReportConfigRequest())->setUpdateMask($updateMask)->setReportConfig($reportConfig); try { $gapicClient->updateReportConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -597,12 +608,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 { @@ -629,9 +643,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -661,12 +673,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 { @@ -700,9 +715,7 @@ public function createReportConfigAsyncTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $reportConfig = new ReportConfig(); - $request = (new CreateReportConfigRequest()) - ->setParent($formattedParent) - ->setReportConfig($reportConfig); + $request = (new CreateReportConfigRequest())->setParent($formattedParent)->setReportConfig($reportConfig); $response = $gapicClient->createReportConfigAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/StorageInsights/tests/Unit/V1/StorageInsightsClientTest.php b/StorageInsights/tests/Unit/V1/StorageInsightsClientTest.php deleted file mode 100644 index 2c6bb19c15be..000000000000 --- a/StorageInsights/tests/Unit/V1/StorageInsightsClientTest.php +++ /dev/null @@ -1,639 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return StorageInsightsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new StorageInsightsClient($options); - } - - /** @test */ - public function createReportConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $expectedResponse = new ReportConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $reportConfig = new ReportConfig(); - $response = $gapicClient->createReportConfig($formattedParent, $reportConfig); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.storageinsights.v1.StorageInsights/CreateReportConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getReportConfig(); - $this->assertProtobufEquals($reportConfig, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createReportConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $reportConfig = new ReportConfig(); - try { - $gapicClient->createReportConfig($formattedParent, $reportConfig); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteReportConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - $gapicClient->deleteReportConfig($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.storageinsights.v1.StorageInsights/DeleteReportConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteReportConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - try { - $gapicClient->deleteReportConfig($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 getReportConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $expectedResponse = new ReportConfig(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - $response = $gapicClient->getReportConfig($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.storageinsights.v1.StorageInsights/GetReportConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getReportConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - try { - $gapicClient->getReportConfig($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 getReportDetailTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $reportPathPrefix = 'reportPathPrefix39964001'; - $shardsCount = 2027352923; - $expectedResponse = new ReportDetail(); - $expectedResponse->setName($name2); - $expectedResponse->setReportPathPrefix($reportPathPrefix); - $expectedResponse->setShardsCount($shardsCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->reportDetailName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]', '[REPORT_DETAIL]'); - $response = $gapicClient->getReportDetail($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.storageinsights.v1.StorageInsights/GetReportDetail', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getReportDetailExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->reportDetailName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]', '[REPORT_DETAIL]'); - try { - $gapicClient->getReportDetail($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 listReportConfigsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $reportConfigsElement = new ReportConfig(); - $reportConfigs = [ - $reportConfigsElement, - ]; - $expectedResponse = new ListReportConfigsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setReportConfigs($reportConfigs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listReportConfigs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getReportConfigs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.storageinsights.v1.StorageInsights/ListReportConfigs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listReportConfigsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listReportConfigs($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 listReportDetailsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $reportDetailsElement = new ReportDetail(); - $reportDetails = [ - $reportDetailsElement, - ]; - $expectedResponse = new ListReportDetailsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setReportDetails($reportDetails); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - $response = $gapicClient->listReportDetails($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getReportDetails()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.storageinsights.v1.StorageInsights/ListReportDetails', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listReportDetailsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->reportConfigName('[PROJECT]', '[LOCATION]', '[REPORT_CONFIG]'); - try { - $gapicClient->listReportDetails($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 updateReportConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $expectedResponse = new ReportConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - // Mock request - $updateMask = new FieldMask(); - $reportConfig = new ReportConfig(); - $response = $gapicClient->updateReportConfig($updateMask, $reportConfig); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.storageinsights.v1.StorageInsights/UpdateReportConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualRequestObject->getReportConfig(); - $this->assertProtobufEquals($reportConfig, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateReportConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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(); - $reportConfig = new ReportConfig(); - try { - $gapicClient->updateReportConfig($updateMask, $reportConfig); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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()); - } -} diff --git a/VideoLiveStream/.OwlBot.yaml b/VideoLiveStream/.OwlBot.yaml index 3cba99d2ff2f..b9bf78effd90 100644 --- a/VideoLiveStream/.OwlBot.yaml +++ b/VideoLiveStream/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/video/livestream/v1/.*-php/(.*) - dest: /owl-bot-staging/VideoLiveStream/v1/$1 + - source: /google/cloud/video/livestream/(v1)/.*-php/(.*) + dest: /owl-bot-staging/VideoLiveStream/$1/$2 api-name: VideoLiveStream diff --git a/VideoLiveStream/README.md b/VideoLiveStream/README.md index f78bc4954a55..621ec25d4bd8 100644 --- a/VideoLiveStream/README.md +++ b/VideoLiveStream/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/VideoLiveStream/owlbot.py b/VideoLiveStream/owlbot.py index ef07c22ec3e9..30e4036819f2 100644 --- a/VideoLiveStream/owlbot.py +++ b/VideoLiveStream/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. @@ -30,13 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php" - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -47,32 +41,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 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) + '--print-width=120']) diff --git a/VideoLiveStream/src/V1/Asset.php b/VideoLiveStream/src/V1/Asset.php index aee0edc6fe06..ab700b859ec0 100644 --- a/VideoLiveStream/src/V1/Asset.php +++ b/VideoLiveStream/src/V1/Asset.php @@ -21,19 +21,19 @@ class Asset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. The creation time. * * 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. The update time. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * User-defined key/value metadata. * @@ -53,20 +53,20 @@ class Asset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string crc32c = 7; */ - private $crc32c = ''; + protected $crc32c = ''; /** * Output only. The state of the asset resource. * * Generated from protobuf field .google.cloud.video.livestream.v1.Asset.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Only present when `state` is `ERROR`. The reason for the error * state of the asset. * * Generated from protobuf field .google.rpc.Status error = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; protected $resource; /** diff --git a/VideoLiveStream/src/V1/Asset/ImageAsset.php b/VideoLiveStream/src/V1/Asset/ImageAsset.php index 22e927bd9dea..6cda85f070fb 100644 --- a/VideoLiveStream/src/V1/Asset/ImageAsset.php +++ b/VideoLiveStream/src/V1/Asset/ImageAsset.php @@ -20,7 +20,7 @@ class ImageAsset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 1; */ - private $uri = ''; + protected $uri = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Asset/VideoAsset.php b/VideoLiveStream/src/V1/Asset/VideoAsset.php index 9d554020bf34..620c15006bab 100644 --- a/VideoLiveStream/src/V1/Asset/VideoAsset.php +++ b/VideoLiveStream/src/V1/Asset/VideoAsset.php @@ -22,7 +22,7 @@ class VideoAsset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 1; */ - private $uri = ''; + protected $uri = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/AudioFormat.php b/VideoLiveStream/src/V1/AudioFormat.php index 7a11bf99368c..183a21001565 100644 --- a/VideoLiveStream/src/V1/AudioFormat.php +++ b/VideoLiveStream/src/V1/AudioFormat.php @@ -20,13 +20,13 @@ class AudioFormat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string codec = 1; */ - private $codec = ''; + protected $codec = ''; /** * The number of audio channels. * * Generated from protobuf field int32 channel_count = 2; */ - private $channel_count = 0; + protected $channel_count = 0; /** * A list of channel names specifying the layout of the audio channels. * diff --git a/VideoLiveStream/src/V1/AudioStream.php b/VideoLiveStream/src/V1/AudioStream.php index 0fd16fd92569..004559384953 100644 --- a/VideoLiveStream/src/V1/AudioStream.php +++ b/VideoLiveStream/src/V1/AudioStream.php @@ -22,7 +22,7 @@ class AudioStream extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool transmux = 8; */ - private $transmux = false; + protected $transmux = false; /** * The codec for this audio stream. The default is `aac`. * Supported audio codecs: @@ -30,20 +30,20 @@ class AudioStream extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string codec = 1; */ - private $codec = ''; + protected $codec = ''; /** * Required. Audio bitrate in bits per second. Must be between 1 and * 10,000,000. * * Generated from protobuf field int32 bitrate_bps = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $bitrate_bps = 0; + protected $bitrate_bps = 0; /** * Number of audio channels. Must be between 1 and 6. The default is 2. * * Generated from protobuf field int32 channel_count = 3; */ - private $channel_count = 0; + protected $channel_count = 0; /** * A list of channel names specifying layout of the audio channels. * This only affects the metadata embedded in the container headers, if @@ -70,7 +70,7 @@ class AudioStream extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 sample_rate_hertz = 6; */ - private $sample_rate_hertz = 0; + protected $sample_rate_hertz = 0; /** * Constructor. diff --git a/VideoLiveStream/src/V1/AudioStream/AudioMapping.php b/VideoLiveStream/src/V1/AudioStream/AudioMapping.php index 971b78229870..3e5cdb24ffd1 100644 --- a/VideoLiveStream/src/V1/AudioStream/AudioMapping.php +++ b/VideoLiveStream/src/V1/AudioStream/AudioMapping.php @@ -24,7 +24,7 @@ class AudioMapping extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string input_key = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $input_key = ''; + protected $input_key = ''; /** * Required. The zero-based index of the track in the input stream. * All [mapping][google.cloud.video.livestream.v1.AudioStream.mapping]s in @@ -33,13 +33,13 @@ class AudioMapping extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 input_track = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $input_track = 0; + protected $input_track = 0; /** * Required. The zero-based index of the channel in the input stream. * * Generated from protobuf field int32 input_channel = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $input_channel = 0; + protected $input_channel = 0; /** * Required. The zero-based index of the channel in the output audio stream. * Must be consistent with the @@ -47,14 +47,14 @@ class AudioMapping extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 output_channel = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $output_channel = 0; + protected $output_channel = 0; /** * Audio volume control in dB. Negative values decrease volume, * positive values increase. The default is 0. * * Generated from protobuf field double gain_db = 5; */ - private $gain_db = 0.0; + protected $gain_db = 0.0; /** * Constructor. diff --git a/VideoLiveStream/src/V1/AudioStreamProperty.php b/VideoLiveStream/src/V1/AudioStreamProperty.php index 317569c5367b..320aecc20086 100644 --- a/VideoLiveStream/src/V1/AudioStreamProperty.php +++ b/VideoLiveStream/src/V1/AudioStreamProperty.php @@ -20,13 +20,13 @@ class AudioStreamProperty extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 index = 1; */ - private $index = 0; + protected $index = 0; /** * Properties of the audio format. * * Generated from protobuf field .google.cloud.video.livestream.v1.AudioFormat audio_format = 2; */ - private $audio_format = null; + protected $audio_format = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Channel.php b/VideoLiveStream/src/V1/Channel.php index 96679a910c97..e776a7a3ec77 100644 --- a/VideoLiveStream/src/V1/Channel.php +++ b/VideoLiveStream/src/V1/Channel.php @@ -25,19 +25,19 @@ class Channel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. The creation time. * * 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. The update time. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * User-defined key/value metadata. * @@ -61,14 +61,14 @@ class Channel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string active_input = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $active_input = ''; + protected $active_input = ''; /** * Required. Information about the output (that is, the Cloud Storage bucket * to store the generated live stream). * * Generated from protobuf field .google.cloud.video.livestream.v1.Channel.Output output = 9 [(.google.api.field_behavior) = REQUIRED]; */ - private $output = null; + protected $output = null; /** * List of elementary streams. * @@ -98,7 +98,7 @@ class Channel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.Channel.StreamingState streaming_state = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $streaming_state = 0; + protected $streaming_state = 0; /** * Output only. A description of the reason for the streaming error. This * property is always present when @@ -108,19 +108,19 @@ class Channel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.rpc.Status streaming_error = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $streaming_error = null; + protected $streaming_error = null; /** * Configuration of platform logs for this channel. * * Generated from protobuf field .google.cloud.video.livestream.v1.LogConfig log_config = 19; */ - private $log_config = null; + protected $log_config = null; /** * Configuration of timecode for this channel. * * Generated from protobuf field .google.cloud.video.livestream.v1.TimecodeConfig timecode_config = 21; */ - private $timecode_config = null; + protected $timecode_config = null; /** * Encryption configurations for this channel. Each configuration has an ID * which is referred to by each MuxStream to indicate which configuration is @@ -135,7 +135,7 @@ class Channel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.InputConfig input_config = 25; */ - private $input_config = null; + protected $input_config = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Channel/Output.php b/VideoLiveStream/src/V1/Channel/Output.php index ef341a81d238..c360a7e30ef6 100644 --- a/VideoLiveStream/src/V1/Channel/Output.php +++ b/VideoLiveStream/src/V1/Channel/Output.php @@ -20,7 +20,7 @@ class Output extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 1; */ - private $uri = ''; + protected $uri = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Client/LivestreamServiceClient.php b/VideoLiveStream/src/V1/Client/LivestreamServiceClient.php index 129d0184b8b8..da49fe7db0a6 100644 --- a/VideoLiveStream/src/V1/Client/LivestreamServiceClient.php +++ b/VideoLiveStream/src/V1/Client/LivestreamServiceClient.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 asset * resource. diff --git a/VideoLiveStream/src/V1/CreateAssetRequest.php b/VideoLiveStream/src/V1/CreateAssetRequest.php index ee8f1724ca8b..101635a63526 100644 --- a/VideoLiveStream/src/V1/CreateAssetRequest.php +++ b/VideoLiveStream/src/V1/CreateAssetRequest.php @@ -21,13 +21,13 @@ class CreateAssetRequest 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 asset resource to be created. * * Generated from protobuf field .google.cloud.video.livestream.v1.Asset asset = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $asset = null; + protected $asset = null; /** * Required. The ID of the asset resource to be created. * This value must be 1-63 characters, begin and end with `[a-z0-9]`, @@ -35,7 +35,7 @@ class CreateAssetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string asset_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $asset_id = ''; + protected $asset_id = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -51,7 +51,7 @@ class CreateAssetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The parent location for the resource, in the form of: diff --git a/VideoLiveStream/src/V1/CreateChannelRequest.php b/VideoLiveStream/src/V1/CreateChannelRequest.php index 12913ada3a2f..6945278c5aa1 100644 --- a/VideoLiveStream/src/V1/CreateChannelRequest.php +++ b/VideoLiveStream/src/V1/CreateChannelRequest.php @@ -21,13 +21,13 @@ class CreateChannelRequest 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 channel resource to be created. * * Generated from protobuf field .google.cloud.video.livestream.v1.Channel channel = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $channel = null; + protected $channel = null; /** * Required. The ID of the channel resource to be created. * This value must be 1-63 characters, begin and end with `[a-z0-9]`, @@ -35,7 +35,7 @@ class CreateChannelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string channel_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $channel_id = ''; + protected $channel_id = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -51,7 +51,7 @@ class CreateChannelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The parent location for the resource, in the form of: diff --git a/VideoLiveStream/src/V1/CreateEventRequest.php b/VideoLiveStream/src/V1/CreateEventRequest.php index 6a4fda27569c..821c7f956b9e 100644 --- a/VideoLiveStream/src/V1/CreateEventRequest.php +++ b/VideoLiveStream/src/V1/CreateEventRequest.php @@ -21,13 +21,13 @@ class CreateEventRequest 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 event resource to be created. * * Generated from protobuf field .google.cloud.video.livestream.v1.Event event = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $event = null; + protected $event = null; /** * Required. The ID of the event resource to be created. * This value must be 1-63 characters, begin and end with `[a-z0-9]`, @@ -35,7 +35,7 @@ class CreateEventRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string event_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $event_id = ''; + protected $event_id = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -51,7 +51,7 @@ class CreateEventRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The parent channel for the resource, in the form of: diff --git a/VideoLiveStream/src/V1/CreateInputRequest.php b/VideoLiveStream/src/V1/CreateInputRequest.php index ea1cbbd40e29..839b2d4d046e 100644 --- a/VideoLiveStream/src/V1/CreateInputRequest.php +++ b/VideoLiveStream/src/V1/CreateInputRequest.php @@ -21,13 +21,13 @@ class CreateInputRequest 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 input resource to be created. * * Generated from protobuf field .google.cloud.video.livestream.v1.Input input = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $input = null; + protected $input = null; /** * Required. The ID of the input resource to be created. * This value must be 1-63 characters, begin and end with `[a-z0-9]`, @@ -35,7 +35,7 @@ class CreateInputRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string input_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $input_id = ''; + protected $input_id = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -51,7 +51,7 @@ class CreateInputRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The parent location for the resource, in the form of: diff --git a/VideoLiveStream/src/V1/DeleteAssetRequest.php b/VideoLiveStream/src/V1/DeleteAssetRequest.php index 4e14c69d978e..6265ac92c35e 100644 --- a/VideoLiveStream/src/V1/DeleteAssetRequest.php +++ b/VideoLiveStream/src/V1/DeleteAssetRequest.php @@ -21,7 +21,7 @@ class DeleteAssetRequest 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 = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -37,7 +37,7 @@ class DeleteAssetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The name of the asset resource, in the form of: diff --git a/VideoLiveStream/src/V1/DeleteChannelRequest.php b/VideoLiveStream/src/V1/DeleteChannelRequest.php index c58e5e68da80..e5ad476fe21d 100644 --- a/VideoLiveStream/src/V1/DeleteChannelRequest.php +++ b/VideoLiveStream/src/V1/DeleteChannelRequest.php @@ -21,7 +21,7 @@ class DeleteChannelRequest 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 = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -37,7 +37,7 @@ class DeleteChannelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2; */ - private $request_id = ''; + protected $request_id = ''; /** * If the `force` field is set to the default value of `false`, you must * delete all of a channel's events before you can delete the channel itself. @@ -46,7 +46,7 @@ class DeleteChannelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool force = 3; */ - private $force = false; + protected $force = false; /** * @param string $name Required. The name of the channel resource, in the form of: diff --git a/VideoLiveStream/src/V1/DeleteEventRequest.php b/VideoLiveStream/src/V1/DeleteEventRequest.php index c075bfda6f69..870470706fe4 100644 --- a/VideoLiveStream/src/V1/DeleteEventRequest.php +++ b/VideoLiveStream/src/V1/DeleteEventRequest.php @@ -21,7 +21,7 @@ class DeleteEventRequest 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 = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -37,7 +37,7 @@ class DeleteEventRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The name of the event resource, in the form of: diff --git a/VideoLiveStream/src/V1/DeleteInputRequest.php b/VideoLiveStream/src/V1/DeleteInputRequest.php index 5b867332d62d..457d3d144f65 100644 --- a/VideoLiveStream/src/V1/DeleteInputRequest.php +++ b/VideoLiveStream/src/V1/DeleteInputRequest.php @@ -21,7 +21,7 @@ class DeleteInputRequest 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 = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -37,7 +37,7 @@ class DeleteInputRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The name of the input resource, in the form of: diff --git a/VideoLiveStream/src/V1/ElementaryStream.php b/VideoLiveStream/src/V1/ElementaryStream.php index 41c7cfc0ece0..029528a39f4a 100644 --- a/VideoLiveStream/src/V1/ElementaryStream.php +++ b/VideoLiveStream/src/V1/ElementaryStream.php @@ -22,7 +22,7 @@ class ElementaryStream extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key = 4; */ - private $key = ''; + protected $key = ''; protected $elementary_stream; /** diff --git a/VideoLiveStream/src/V1/Encryption.php b/VideoLiveStream/src/V1/Encryption.php index 6f607eafdc8d..a0e5fa6b0c1a 100644 --- a/VideoLiveStream/src/V1/Encryption.php +++ b/VideoLiveStream/src/V1/Encryption.php @@ -20,13 +20,13 @@ class Encryption extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $id = ''; + protected $id = ''; /** * Required. Configuration for DRM systems. * * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.DrmSystems drm_systems = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $drm_systems = null; + protected $drm_systems = null; protected $secret_source; protected $encryption_mode; diff --git a/VideoLiveStream/src/V1/Encryption/DrmSystems.php b/VideoLiveStream/src/V1/Encryption/DrmSystems.php index 9b999c2305a6..31bc04f6e4f3 100644 --- a/VideoLiveStream/src/V1/Encryption/DrmSystems.php +++ b/VideoLiveStream/src/V1/Encryption/DrmSystems.php @@ -21,25 +21,25 @@ class DrmSystems extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Widevine widevine = 1; */ - private $widevine = null; + protected $widevine = null; /** * Fairplay configuration. * * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Fairplay fairplay = 2; */ - private $fairplay = null; + protected $fairplay = null; /** * Playready configuration. * * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Playready playready = 3; */ - private $playready = null; + protected $playready = null; /** * Clearkey configuration. * * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Clearkey clearkey = 4; */ - private $clearkey = null; + protected $clearkey = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Encryption/MpegCommonEncryption.php b/VideoLiveStream/src/V1/Encryption/MpegCommonEncryption.php index d807c9259186..3f861b1221d5 100644 --- a/VideoLiveStream/src/V1/Encryption/MpegCommonEncryption.php +++ b/VideoLiveStream/src/V1/Encryption/MpegCommonEncryption.php @@ -22,7 +22,7 @@ class MpegCommonEncryption extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string scheme = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $scheme = ''; + protected $scheme = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Encryption/SecretManagerSource.php b/VideoLiveStream/src/V1/Encryption/SecretManagerSource.php index 760dad086611..ee9917952d9f 100644 --- a/VideoLiveStream/src/V1/Encryption/SecretManagerSource.php +++ b/VideoLiveStream/src/V1/Encryption/SecretManagerSource.php @@ -21,7 +21,7 @@ class SecretManagerSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $secret_version = ''; + protected $secret_version = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Event.php b/VideoLiveStream/src/V1/Event.php index 06d792854bdd..bfd03c15ae6e 100644 --- a/VideoLiveStream/src/V1/Event.php +++ b/VideoLiveStream/src/V1/Event.php @@ -22,19 +22,19 @@ class Event extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. The creation time. * * 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. The update time. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * User-defined key/value metadata. * @@ -50,7 +50,7 @@ class Event extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool execute_now = 9; */ - private $execute_now = false; + protected $execute_now = false; /** * The time to execute the event. If you set * [execute_now][google.cloud.video.livestream.v1.Event.execute_now] to @@ -62,20 +62,20 @@ class Event extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp execution_time = 10; */ - private $execution_time = null; + protected $execution_time = null; /** * Output only. The state of the event. * * Generated from protobuf field .google.cloud.video.livestream.v1.Event.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. An error object that describes the reason for the failure. * This property is always present when `state` is `FAILED`. * * Generated from protobuf field .google.rpc.Status error = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; protected $task; /** diff --git a/VideoLiveStream/src/V1/Event/AdBreakTask.php b/VideoLiveStream/src/V1/Event/AdBreakTask.php index 2afc22b630ff..808347bd07d9 100644 --- a/VideoLiveStream/src/V1/Event/AdBreakTask.php +++ b/VideoLiveStream/src/V1/Event/AdBreakTask.php @@ -20,7 +20,7 @@ class AdBreakTask extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration duration = 1; */ - private $duration = null; + protected $duration = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Event/InputSwitchTask.php b/VideoLiveStream/src/V1/Event/InputSwitchTask.php index 435b19de6feb..525b9bfb43e6 100644 --- a/VideoLiveStream/src/V1/Event/InputSwitchTask.php +++ b/VideoLiveStream/src/V1/Event/InputSwitchTask.php @@ -22,7 +22,7 @@ class InputSwitchTask extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string input_key = 1; */ - private $input_key = ''; + protected $input_key = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Event/MuteTask.php b/VideoLiveStream/src/V1/Event/MuteTask.php index ad0b55f4ca3a..06fa22cc79fc 100644 --- a/VideoLiveStream/src/V1/Event/MuteTask.php +++ b/VideoLiveStream/src/V1/Event/MuteTask.php @@ -21,7 +21,7 @@ class MuteTask extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration duration = 1; */ - private $duration = null; + protected $duration = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Event/SlateTask.php b/VideoLiveStream/src/V1/Event/SlateTask.php index bd4094776906..53a861840a5a 100644 --- a/VideoLiveStream/src/V1/Event/SlateTask.php +++ b/VideoLiveStream/src/V1/Event/SlateTask.php @@ -21,7 +21,7 @@ class SlateTask extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration duration = 1; */ - private $duration = null; + protected $duration = null; /** * Slate asset to use for the duration. If its duration is less than the * duration of the SlateTask, then it will be looped. The slate must be @@ -30,7 +30,7 @@ class SlateTask extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string asset = 2 [(.google.api.resource_reference) = { */ - private $asset = ''; + protected $asset = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Gapic/LivestreamServiceGapicClient.php b/VideoLiveStream/src/V1/Gapic/LivestreamServiceGapicClient.php deleted file mode 100644 index 061a94bbbe5d..000000000000 --- a/VideoLiveStream/src/V1/Gapic/LivestreamServiceGapicClient.php +++ /dev/null @@ -1,2607 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $asset = new Asset(); - * $assetId = 'asset_id'; - * $operationResponse = $livestreamServiceClient->createAsset($formattedParent, $asset, $assetId); - * $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 = $livestreamServiceClient->createAsset($formattedParent, $asset, $assetId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'createAsset'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->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\Video\LiveStream\V1\Client\LivestreamServiceClient}. - */ -class LivestreamServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.video.livestream.v1.LivestreamService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'livestream.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'livestream.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 $assetNameTemplate; - - private static $channelNameTemplate; - - private static $eventNameTemplate; - - private static $inputNameTemplate; - - private static $locationNameTemplate; - - private static $networkNameTemplate; - - private static $poolNameTemplate; - - private static $secretVersionNameTemplate; - - 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/livestream_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/livestream_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/livestream_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/livestream_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getAssetNameTemplate() - { - if (self::$assetNameTemplate == null) { - self::$assetNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/assets/{asset}' - ); - } - - return self::$assetNameTemplate; - } - - private static function getChannelNameTemplate() - { - if (self::$channelNameTemplate == null) { - self::$channelNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/channels/{channel}' - ); - } - - return self::$channelNameTemplate; - } - - private static function getEventNameTemplate() - { - if (self::$eventNameTemplate == null) { - self::$eventNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/channels/{channel}/events/{event}' - ); - } - - return self::$eventNameTemplate; - } - - private static function getInputNameTemplate() - { - if (self::$inputNameTemplate == null) { - self::$inputNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/inputs/{input}' - ); - } - - return self::$inputNameTemplate; - } - - 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 getPoolNameTemplate() - { - if (self::$poolNameTemplate == null) { - self::$poolNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/pools/{pool}' - ); - } - - return self::$poolNameTemplate; - } - - private static function getSecretVersionNameTemplate() - { - if (self::$secretVersionNameTemplate == null) { - self::$secretVersionNameTemplate = new PathTemplate( - 'projects/{project}/secrets/{secret}/versions/{version}' - ); - } - - return self::$secretVersionNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'asset' => self::getAssetNameTemplate(), - 'channel' => self::getChannelNameTemplate(), - 'event' => self::getEventNameTemplate(), - 'input' => self::getInputNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'network' => self::getNetworkNameTemplate(), - 'pool' => self::getPoolNameTemplate(), - 'secretVersion' => self::getSecretVersionNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a asset - * resource. - * - * @param string $project - * @param string $location - * @param string $asset - * - * @return string The formatted asset resource. - */ - public static function assetName($project, $location, $asset) - { - return self::getAssetNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'asset' => $asset, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a channel - * resource. - * - * @param string $project - * @param string $location - * @param string $channel - * - * @return string The formatted channel resource. - */ - public static function channelName($project, $location, $channel) - { - return self::getChannelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'channel' => $channel, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a event - * resource. - * - * @param string $project - * @param string $location - * @param string $channel - * @param string $event - * - * @return string The formatted event resource. - */ - public static function eventName($project, $location, $channel, $event) - { - return self::getEventNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'channel' => $channel, - 'event' => $event, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a input - * resource. - * - * @param string $project - * @param string $location - * @param string $input - * - * @return string The formatted input resource. - */ - public static function inputName($project, $location, $input) - { - return self::getInputNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'input' => $input, - ]); - } - - /** - * 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 pool - * resource. - * - * @param string $project - * @param string $location - * @param string $pool - * - * @return string The formatted pool resource. - */ - public static function poolName($project, $location, $pool) - { - return self::getPoolNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'pool' => $pool, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * secret_version resource. - * - * @param string $project - * @param string $secret - * @param string $version - * - * @return string The formatted secret_version resource. - */ - public static function secretVersionName($project, $secret, $version) - { - return self::getSecretVersionNameTemplate()->render([ - 'project' => $project, - 'secret' => $secret, - '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 - * - asset: projects/{project}/locations/{location}/assets/{asset} - * - channel: projects/{project}/locations/{location}/channels/{channel} - * - event: projects/{project}/locations/{location}/channels/{channel}/events/{event} - * - input: projects/{project}/locations/{location}/inputs/{input} - * - location: projects/{project}/locations/{location} - * - network: projects/{project}/global/networks/{network} - * - pool: projects/{project}/locations/{location}/pools/{pool} - * - secretVersion: projects/{project}/secrets/{secret}/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 'livestream.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 Asset with the provided unique ID in the specified - * region. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $asset = new Asset(); - * $assetId = 'asset_id'; - * $operationResponse = $livestreamServiceClient->createAsset($formattedParent, $asset, $assetId); - * $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 = $livestreamServiceClient->createAsset($formattedParent, $asset, $assetId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'createAsset'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location for the resource, in the form of: - * `projects/{project}/locations/{location}`. - * @param Asset $asset Required. The asset resource to be created. - * @param string $assetId Required. The ID of the asset resource to be created. - * This value must be 1-63 characters, begin and end with `[a-z0-9]`, - * could contain dashes (-) in between. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createAsset( - $parent, - $asset, - $assetId, - array $optionalArgs = [] - ) { - $request = new CreateAssetRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setAsset($asset); - $request->setAssetId($assetId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateAsset', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a channel with the provided unique ID in the specified - * region. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $channel = new Channel(); - * $channelId = 'channel_id'; - * $operationResponse = $livestreamServiceClient->createChannel($formattedParent, $channel, $channelId); - * $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 = $livestreamServiceClient->createChannel($formattedParent, $channel, $channelId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'createChannel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location for the resource, in the form of: - * `projects/{project}/locations/{location}`. - * @param Channel $channel Required. The channel resource to be created. - * @param string $channelId Required. The ID of the channel resource to be created. - * This value must be 1-63 characters, begin and end with `[a-z0-9]`, - * could contain dashes (-) in between. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createChannel( - $parent, - $channel, - $channelId, - array $optionalArgs = [] - ) { - $request = new CreateChannelRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setChannel($channel); - $request->setChannelId($channelId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateChannel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates an event with the provided unique ID in the specified channel. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedParent = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - * $event = new Event(); - * $eventId = 'event_id'; - * $response = $livestreamServiceClient->createEvent($formattedParent, $event, $eventId); - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent channel for the resource, in the form of: - * `projects/{project}/locations/{location}/channels/{channelId}`. - * @param Event $event Required. The event resource to be created. - * @param string $eventId Required. The ID of the event resource to be created. - * This value must be 1-63 characters, begin and end with `[a-z0-9]`, - * could contain dashes (-) in between. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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\Video\LiveStream\V1\Event - * - * @throws ApiException if the remote call fails - */ - public function createEvent( - $parent, - $event, - $eventId, - array $optionalArgs = [] - ) { - $request = new CreateEventRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setEvent($event); - $request->setEventId($eventId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateEvent', - Event::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates an input with the provided unique ID in the specified region. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $input = new Input(); - * $inputId = 'input_id'; - * $operationResponse = $livestreamServiceClient->createInput($formattedParent, $input, $inputId); - * $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 = $livestreamServiceClient->createInput($formattedParent, $input, $inputId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'createInput'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location for the resource, in the form of: - * `projects/{project}/locations/{location}`. - * @param Input $input Required. The input resource to be created. - * @param string $inputId Required. The ID of the input resource to be created. - * This value must be 1-63 characters, begin and end with `[a-z0-9]`, - * could contain dashes (-) in between. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createInput( - $parent, - $input, - $inputId, - array $optionalArgs = [] - ) { - $request = new CreateInputRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInput($input); - $request->setInputId($inputId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateInput', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes the specified asset if it is not used. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - * $operationResponse = $livestreamServiceClient->deleteAsset($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 = $livestreamServiceClient->deleteAsset($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'deleteAsset'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the asset resource, in the form of: - * `projects/{project}/locations/{location}/assets/{assetId}`. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteAsset($name, array $optionalArgs = []) - { - $request = new DeleteAssetRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteAsset', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes the specified channel. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - * $operationResponse = $livestreamServiceClient->deleteChannel($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 = $livestreamServiceClient->deleteChannel($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'deleteChannel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the channel resource, in the form of: - * `projects/{project}/locations/{location}/channels/{channelId}`. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type bool $force - * If the `force` field is set to the default value of `false`, you must - * delete all of a channel's events before you can delete the channel itself. - * If the field is set to `true`, requests to delete a channel also delete - * associated channel events. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteChannel($name, array $optionalArgs = []) - { - $request = new DeleteChannelRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - 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( - 'DeleteChannel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes the specified event. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - * $livestreamServiceClient->deleteEvent($formattedName); - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the event resource, in the form of: - * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this 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 deleteEvent($name, array $optionalArgs = []) - { - $request = new DeleteEventRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'DeleteEvent', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes the specified input. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - * $operationResponse = $livestreamServiceClient->deleteInput($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 = $livestreamServiceClient->deleteInput($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'deleteInput'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the input resource, in the form of: - * `projects/{project}/locations/{location}/inputs/{inputId}`. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteInput($name, array $optionalArgs = []) - { - $request = new DeleteInputRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteInput', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Returns the specified asset. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - * $response = $livestreamServiceClient->getAsset($formattedName); - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the resource, in the following form: - * `projects/{project}/locations/{location}/assets/{asset}`. - * @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\Video\LiveStream\V1\Asset - * - * @throws ApiException if the remote call fails - */ - public function getAsset($name, array $optionalArgs = []) - { - $request = new GetAssetRequest(); - $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( - 'GetAsset', - Asset::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified channel. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - * $response = $livestreamServiceClient->getChannel($formattedName); - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the channel resource, in the form of: - * `projects/{project}/locations/{location}/channels/{channelId}`. - * @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\Video\LiveStream\V1\Channel - * - * @throws ApiException if the remote call fails - */ - public function getChannel($name, array $optionalArgs = []) - { - $request = new GetChannelRequest(); - $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( - 'GetChannel', - Channel::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified event. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - * $response = $livestreamServiceClient->getEvent($formattedName); - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the event resource, in the form of: - * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. - * @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\Video\LiveStream\V1\Event - * - * @throws ApiException if the remote call fails - */ - public function getEvent($name, array $optionalArgs = []) - { - $request = new GetEventRequest(); - $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( - 'GetEvent', - Event::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified input. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - * $response = $livestreamServiceClient->getInput($formattedName); - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the input resource, in the form of: - * `projects/{project}/locations/{location}/inputs/{inputId}`. - * @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\Video\LiveStream\V1\Input - * - * @throws ApiException if the remote call fails - */ - public function getInput($name, array $optionalArgs = []) - { - $request = new GetInputRequest(); - $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( - 'GetInput', - Input::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified pool. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); - * $response = $livestreamServiceClient->getPool($formattedName); - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the pool resource, in the form of: - * `projects/{project}/locations/{location}/pools/{poolId}`. - * @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\Video\LiveStream\V1\Pool - * - * @throws ApiException if the remote call fails - */ - public function getPool($name, array $optionalArgs = []) - { - $request = new GetPoolRequest(); - $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( - 'GetPool', - Pool::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns a list of all assets in the specified region. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $livestreamServiceClient->listAssets($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $livestreamServiceClient->listAssets($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location for the resource, in the form of: - * `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 - * Filtering results - * @type string $orderBy - * Hint for how to order the 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 listAssets($parent, array $optionalArgs = []) - { - $request = new ListAssetsRequest(); - $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( - 'ListAssets', - $optionalArgs, - ListAssetsResponse::class, - $request - ); - } - - /** - * Returns a list of all channels in the specified region. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $livestreamServiceClient->listChannels($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $livestreamServiceClient->listChannels($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location for the resource, in the form of: - * `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 - * The filter to apply to list results. - * @type string $orderBy - * Specifies the ordering of results following syntax at - * https://cloud.google.com/apis/design/design_patterns#sorting_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 listChannels($parent, array $optionalArgs = []) - { - $request = new ListChannelsRequest(); - $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( - 'ListChannels', - $optionalArgs, - ListChannelsResponse::class, - $request - ); - } - - /** - * Returns a list of all events in the specified channel. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedParent = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - * // Iterate over pages of elements - * $pagedResponse = $livestreamServiceClient->listEvents($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $livestreamServiceClient->listEvents($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent channel for the resource, in the form of: - * `projects/{project}/locations/{location}/channels/{channelId}`. - * @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 - * The filter to apply to list results. - * @type string $orderBy - * Specifies the ordering of results following syntax at - * https://cloud.google.com/apis/design/design_patterns#sorting_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 listEvents($parent, array $optionalArgs = []) - { - $request = new ListEventsRequest(); - $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( - 'ListEvents', - $optionalArgs, - ListEventsResponse::class, - $request - ); - } - - /** - * Returns a list of all inputs in the specified region. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $livestreamServiceClient->listInputs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $livestreamServiceClient->listInputs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent location for the resource, in the form of: - * `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 - * The filter to apply to list results. - * @type string $orderBy - * Specifies the ordering of results following syntax at [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_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 listInputs($parent, array $optionalArgs = []) - { - $request = new ListInputsRequest(); - $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( - 'ListInputs', - $optionalArgs, - ListInputsResponse::class, - $request - ); - } - - /** - * Starts the specified channel. Part of the video pipeline will be created - * only when the StartChannel request is received by the server. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - * $operationResponse = $livestreamServiceClient->startChannel($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 = $livestreamServiceClient->startChannel($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'startChannel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the channel resource, in the form of: - * `projects/{project}/locations/{location}/channels/{channelId}`. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 startChannel($name, array $optionalArgs = []) - { - $request = new StartChannelRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'StartChannel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Stops the specified channel. Part of the video pipeline will be released - * when the StopChannel request is received by the server. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $formattedName = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - * $operationResponse = $livestreamServiceClient->stopChannel($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 = $livestreamServiceClient->stopChannel($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'stopChannel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the channel resource, in the form of: - * `projects/{project}/locations/{location}/channels/{channelId}`. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 stopChannel($name, array $optionalArgs = []) - { - $request = new StopChannelRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'StopChannel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the specified channel. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $channel = new Channel(); - * $operationResponse = $livestreamServiceClient->updateChannel($channel); - * $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 = $livestreamServiceClient->updateChannel($channel); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'updateChannel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param Channel $channel Required. The channel resource to be updated. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the Channel - * resource by the update. You can only update the following fields: - * - * * [`inputAttachments`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputattachment) - * * [`inputConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputconfig) - * * [`output`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#output) - * * [`elementaryStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#elementarystream) - * * [`muxStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#muxstream) - * * [`manifests`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#manifest) - * * [`spriteSheets`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#spritesheet) - * * [`logConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#logconfig) - * * [`timecodeConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#timecodeconfig) - * * [`encryptions`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#encryption) - * - * 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 mask is not present, then each field from the list above is updated - * if the field appears in the request payload. To unset a field, add the - * field to the update mask and remove it from the request payload. - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateChannel($channel, array $optionalArgs = []) - { - $request = new UpdateChannelRequest(); - $requestParamHeaders = []; - $request->setChannel($channel); - $requestParamHeaders['channel.name'] = $channel->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateChannel', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the specified input. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $input = new Input(); - * $operationResponse = $livestreamServiceClient->updateInput($input); - * $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 = $livestreamServiceClient->updateInput($input); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'updateInput'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param Input $input Required. The input resource to be updated. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the Input - * resource by the update. You can only update the following fields: - * - * * [`preprocessingConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#PreprocessingConfig) - * * [`securityRules`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#SecurityRule) - * - * 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 mask is not present, then each field from the list above is updated - * if the field appears in the request payload. To unset a field, add the - * field to the update mask and remove it from the request payload. - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateInput($input, array $optionalArgs = []) - { - $request = new UpdateInputRequest(); - $requestParamHeaders = []; - $request->setInput($input); - $requestParamHeaders['input.name'] = $input->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateInput', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the specified pool. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $pool = new Pool(); - * $operationResponse = $livestreamServiceClient->updatePool($pool); - * $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 = $livestreamServiceClient->updatePool($pool); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'updatePool'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $livestreamServiceClient->close(); - * } - * ``` - * - * @param Pool $pool Required. The pool resource to be updated. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the Pool - * resource by the update. You can only update the following fields: - * - * * `networkConfig` - * - * 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. - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updatePool($pool, array $optionalArgs = []) - { - $request = new UpdatePoolRequest(); - $requestParamHeaders = []; - $request->setPool($pool); - $requestParamHeaders['pool.name'] = $pool->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdatePool', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * $response = $livestreamServiceClient->getLocation(); - * } finally { - * $livestreamServiceClient->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: - * ``` - * $livestreamServiceClient = new LivestreamServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $livestreamServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $livestreamServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $livestreamServiceClient->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' - ); - } -} diff --git a/VideoLiveStream/src/V1/GetAssetRequest.php b/VideoLiveStream/src/V1/GetAssetRequest.php index 7865f8cedf37..9077122dea4c 100644 --- a/VideoLiveStream/src/V1/GetAssetRequest.php +++ b/VideoLiveStream/src/V1/GetAssetRequest.php @@ -21,7 +21,7 @@ class GetAssetRequest 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. Name of the resource, in the following form: diff --git a/VideoLiveStream/src/V1/GetChannelRequest.php b/VideoLiveStream/src/V1/GetChannelRequest.php index 7eddcf3775e3..2050793dd1f3 100644 --- a/VideoLiveStream/src/V1/GetChannelRequest.php +++ b/VideoLiveStream/src/V1/GetChannelRequest.php @@ -21,7 +21,7 @@ class GetChannelRequest 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 channel resource, in the form of: diff --git a/VideoLiveStream/src/V1/GetEventRequest.php b/VideoLiveStream/src/V1/GetEventRequest.php index 3944a24ea858..cc2a65775439 100644 --- a/VideoLiveStream/src/V1/GetEventRequest.php +++ b/VideoLiveStream/src/V1/GetEventRequest.php @@ -21,7 +21,7 @@ class GetEventRequest 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 event resource, in the form of: diff --git a/VideoLiveStream/src/V1/GetInputRequest.php b/VideoLiveStream/src/V1/GetInputRequest.php index bfb040293676..da3712d40ecf 100644 --- a/VideoLiveStream/src/V1/GetInputRequest.php +++ b/VideoLiveStream/src/V1/GetInputRequest.php @@ -21,7 +21,7 @@ class GetInputRequest 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 input resource, in the form of: diff --git a/VideoLiveStream/src/V1/GetPoolRequest.php b/VideoLiveStream/src/V1/GetPoolRequest.php index a7f29ba29bf6..413d850b4b53 100644 --- a/VideoLiveStream/src/V1/GetPoolRequest.php +++ b/VideoLiveStream/src/V1/GetPoolRequest.php @@ -21,7 +21,7 @@ class GetPoolRequest 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 pool resource, in the form of: diff --git a/VideoLiveStream/src/V1/Input.php b/VideoLiveStream/src/V1/Input.php index 4c0b5b504251..804f7b0d808c 100644 --- a/VideoLiveStream/src/V1/Input.php +++ b/VideoLiveStream/src/V1/Input.php @@ -22,19 +22,19 @@ class Input extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. The creation time. * * 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. The update time. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * User-defined key/value metadata. * @@ -46,7 +46,7 @@ class Input extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.Input.Type type = 5; */ - private $type = 0; + protected $type = 0; /** * Tier defines the maximum input specification that is accepted by the * video pipeline. The billing is charged based on the tier specified here. @@ -55,7 +55,7 @@ class Input extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.Input.Tier tier = 14; */ - private $tier = 0; + protected $tier = 0; /** * Output only. URI to push the input stream to. * Its format depends on the input @@ -65,26 +65,26 @@ class Input extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uri = ''; + protected $uri = ''; /** * Preprocessing configurations. * * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig preprocessing_config = 9; */ - private $preprocessing_config = null; + protected $preprocessing_config = null; /** * Security rule for access control. * * Generated from protobuf field .google.cloud.video.livestream.v1.Input.SecurityRule security_rules = 12; */ - private $security_rules = null; + protected $security_rules = null; /** * Output only. The information for the input stream. This field will be * present only when this input receives the input stream. * * Generated from protobuf field .google.cloud.video.livestream.v1.InputStreamProperty input_stream_property = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $input_stream_property = null; + protected $input_stream_property = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/InputAttachment.php b/VideoLiveStream/src/V1/InputAttachment.php index 61334e70ca50..86ffab06266a 100644 --- a/VideoLiveStream/src/V1/InputAttachment.php +++ b/VideoLiveStream/src/V1/InputAttachment.php @@ -20,20 +20,20 @@ class InputAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key = 1; */ - private $key = ''; + protected $key = ''; /** * The resource name of an existing input, in the form of: * `projects/{project}/locations/{location}/inputs/{inputId}`. * * Generated from protobuf field string input = 2 [(.google.api.resource_reference) = { */ - private $input = ''; + protected $input = ''; /** * Automatic failover configurations. * * Generated from protobuf field .google.cloud.video.livestream.v1.InputAttachment.AutomaticFailover automatic_failover = 3; */ - private $automatic_failover = null; + protected $automatic_failover = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/InputConfig.php b/VideoLiveStream/src/V1/InputConfig.php index 195bf13537ca..fc6b529049d0 100644 --- a/VideoLiveStream/src/V1/InputConfig.php +++ b/VideoLiveStream/src/V1/InputConfig.php @@ -20,7 +20,7 @@ class InputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.InputConfig.InputSwitchMode input_switch_mode = 1; */ - private $input_switch_mode = 0; + protected $input_switch_mode = 0; /** * Constructor. diff --git a/VideoLiveStream/src/V1/InputStreamProperty.php b/VideoLiveStream/src/V1/InputStreamProperty.php index 8e51ecdcbf72..42b27a630665 100644 --- a/VideoLiveStream/src/V1/InputStreamProperty.php +++ b/VideoLiveStream/src/V1/InputStreamProperty.php @@ -21,7 +21,7 @@ class InputStreamProperty extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp last_establish_time = 1; */ - private $last_establish_time = null; + protected $last_establish_time = null; /** * Properties of the video streams. * diff --git a/VideoLiveStream/src/V1/ListAssetsRequest.php b/VideoLiveStream/src/V1/ListAssetsRequest.php index 9b4ede76f08f..ed3d44e9986b 100644 --- a/VideoLiveStream/src/V1/ListAssetsRequest.php +++ b/VideoLiveStream/src/V1/ListAssetsRequest.php @@ -21,32 +21,32 @@ class ListAssetsRequest 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 = ''; /** * Requested page size. Server may return fewer items than requested. * If unspecified, server will pick an appropriate default. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A token identifying a page of results the server should return. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * Filtering results * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Hint for how to order the results * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent location for the resource, in the form of: diff --git a/VideoLiveStream/src/V1/ListAssetsResponse.php b/VideoLiveStream/src/V1/ListAssetsResponse.php index 84fb18a1ae37..ec154d7bbafc 100644 --- a/VideoLiveStream/src/V1/ListAssetsResponse.php +++ b/VideoLiveStream/src/V1/ListAssetsResponse.php @@ -26,7 +26,7 @@ class ListAssetsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/VideoLiveStream/src/V1/ListChannelsRequest.php b/VideoLiveStream/src/V1/ListChannelsRequest.php index 19397ddf8eff..2dbfdfd1b10c 100644 --- a/VideoLiveStream/src/V1/ListChannelsRequest.php +++ b/VideoLiveStream/src/V1/ListChannelsRequest.php @@ -21,7 +21,7 @@ class ListChannelsRequest 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 items to return. If unspecified, server * will pick an appropriate default. Server may return fewer items than @@ -31,26 +31,26 @@ class ListChannelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The next_page_token value returned from a previous List request, if any. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * The filter to apply to list results. * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Specifies the ordering of results following syntax at * https://cloud.google.com/apis/design/design_patterns#sorting_order. * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent location for the resource, in the form of: diff --git a/VideoLiveStream/src/V1/ListChannelsResponse.php b/VideoLiveStream/src/V1/ListChannelsResponse.php index 19b7de937cfe..c535a18d3457 100644 --- a/VideoLiveStream/src/V1/ListChannelsResponse.php +++ b/VideoLiveStream/src/V1/ListChannelsResponse.php @@ -27,7 +27,7 @@ class ListChannelsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/VideoLiveStream/src/V1/ListEventsRequest.php b/VideoLiveStream/src/V1/ListEventsRequest.php index 91c18ba52b96..2e459d167a5c 100644 --- a/VideoLiveStream/src/V1/ListEventsRequest.php +++ b/VideoLiveStream/src/V1/ListEventsRequest.php @@ -21,7 +21,7 @@ class ListEventsRequest 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 items to return. If unspecified, server * will pick an appropriate default. Server may return fewer items than @@ -31,26 +31,26 @@ class ListEventsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The next_page_token value returned from a previous List request, if any. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * The filter to apply to list results. * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Specifies the ordering of results following syntax at * https://cloud.google.com/apis/design/design_patterns#sorting_order. * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent channel for the resource, in the form of: diff --git a/VideoLiveStream/src/V1/ListEventsResponse.php b/VideoLiveStream/src/V1/ListEventsResponse.php index e171e7f0e94b..9c30220fcb35 100644 --- a/VideoLiveStream/src/V1/ListEventsResponse.php +++ b/VideoLiveStream/src/V1/ListEventsResponse.php @@ -27,7 +27,7 @@ class ListEventsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/VideoLiveStream/src/V1/ListInputsRequest.php b/VideoLiveStream/src/V1/ListInputsRequest.php index d1afb5171aea..95a3d958d8f5 100644 --- a/VideoLiveStream/src/V1/ListInputsRequest.php +++ b/VideoLiveStream/src/V1/ListInputsRequest.php @@ -21,7 +21,7 @@ class ListInputsRequest 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 items to return. If unspecified, server * will pick an appropriate default. Server may return fewer items than @@ -31,26 +31,26 @@ class ListInputsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The next_page_token value returned from a previous List request, if any. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * The filter to apply to list results. * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Specifies the ordering of results following syntax at [Sorting * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent location for the resource, in the form of: diff --git a/VideoLiveStream/src/V1/ListInputsResponse.php b/VideoLiveStream/src/V1/ListInputsResponse.php index 77811f93ff24..a996747b4e20 100644 --- a/VideoLiveStream/src/V1/ListInputsResponse.php +++ b/VideoLiveStream/src/V1/ListInputsResponse.php @@ -27,7 +27,7 @@ class ListInputsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/VideoLiveStream/src/V1/LivestreamServiceClient.php b/VideoLiveStream/src/V1/LivestreamServiceClient.php deleted file mode 100644 index 4c2f27b34b1a..000000000000 --- a/VideoLiveStream/src/V1/LivestreamServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/CreateChannel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Returns a list of all channels in the specified region. - * @param \Google\Cloud\Video\LiveStream\V1\ListChannelsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListChannels(\Google\Cloud\Video\LiveStream\V1\ListChannelsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/ListChannels', - $argument, - ['\Google\Cloud\Video\LiveStream\V1\ListChannelsResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns the specified channel. - * @param \Google\Cloud\Video\LiveStream\V1\GetChannelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetChannel(\Google\Cloud\Video\LiveStream\V1\GetChannelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/GetChannel', - $argument, - ['\Google\Cloud\Video\LiveStream\V1\Channel', 'decode'], - $metadata, $options); - } - - /** - * Deletes the specified channel. - * @param \Google\Cloud\Video\LiveStream\V1\DeleteChannelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteChannel(\Google\Cloud\Video\LiveStream\V1\DeleteChannelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/DeleteChannel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates the specified channel. - * @param \Google\Cloud\Video\LiveStream\V1\UpdateChannelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateChannel(\Google\Cloud\Video\LiveStream\V1\UpdateChannelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/UpdateChannel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Starts the specified channel. Part of the video pipeline will be created - * only when the StartChannel request is received by the server. - * @param \Google\Cloud\Video\LiveStream\V1\StartChannelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function StartChannel(\Google\Cloud\Video\LiveStream\V1\StartChannelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/StartChannel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Stops the specified channel. Part of the video pipeline will be released - * when the StopChannel request is received by the server. - * @param \Google\Cloud\Video\LiveStream\V1\StopChannelRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function StopChannel(\Google\Cloud\Video\LiveStream\V1\StopChannelRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/StopChannel', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates an input with the provided unique ID in the specified region. - * @param \Google\Cloud\Video\LiveStream\V1\CreateInputRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateInput(\Google\Cloud\Video\LiveStream\V1\CreateInputRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/CreateInput', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Returns a list of all inputs in the specified region. - * @param \Google\Cloud\Video\LiveStream\V1\ListInputsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListInputs(\Google\Cloud\Video\LiveStream\V1\ListInputsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/ListInputs', - $argument, - ['\Google\Cloud\Video\LiveStream\V1\ListInputsResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns the specified input. - * @param \Google\Cloud\Video\LiveStream\V1\GetInputRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetInput(\Google\Cloud\Video\LiveStream\V1\GetInputRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/GetInput', - $argument, - ['\Google\Cloud\Video\LiveStream\V1\Input', 'decode'], - $metadata, $options); - } - - /** - * Deletes the specified input. - * @param \Google\Cloud\Video\LiveStream\V1\DeleteInputRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteInput(\Google\Cloud\Video\LiveStream\V1\DeleteInputRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/DeleteInput', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates the specified input. - * @param \Google\Cloud\Video\LiveStream\V1\UpdateInputRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateInput(\Google\Cloud\Video\LiveStream\V1\UpdateInputRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/UpdateInput', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates an event with the provided unique ID in the specified channel. - * @param \Google\Cloud\Video\LiveStream\V1\CreateEventRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateEvent(\Google\Cloud\Video\LiveStream\V1\CreateEventRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/CreateEvent', - $argument, - ['\Google\Cloud\Video\LiveStream\V1\Event', 'decode'], - $metadata, $options); - } - - /** - * Returns a list of all events in the specified channel. - * @param \Google\Cloud\Video\LiveStream\V1\ListEventsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListEvents(\Google\Cloud\Video\LiveStream\V1\ListEventsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/ListEvents', - $argument, - ['\Google\Cloud\Video\LiveStream\V1\ListEventsResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns the specified event. - * @param \Google\Cloud\Video\LiveStream\V1\GetEventRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetEvent(\Google\Cloud\Video\LiveStream\V1\GetEventRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/GetEvent', - $argument, - ['\Google\Cloud\Video\LiveStream\V1\Event', 'decode'], - $metadata, $options); - } - - /** - * Deletes the specified event. - * @param \Google\Cloud\Video\LiveStream\V1\DeleteEventRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteEvent(\Google\Cloud\Video\LiveStream\V1\DeleteEventRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.livestream.v1.LivestreamService/DeleteEvent', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - -} diff --git a/VideoLiveStream/src/V1/LogConfig.php b/VideoLiveStream/src/V1/LogConfig.php index 2abed2e9492e..24c7138b5826 100644 --- a/VideoLiveStream/src/V1/LogConfig.php +++ b/VideoLiveStream/src/V1/LogConfig.php @@ -23,7 +23,7 @@ class LogConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.LogConfig.LogSeverity log_severity = 1; */ - private $log_severity = 0; + protected $log_severity = 0; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Manifest.php b/VideoLiveStream/src/V1/Manifest.php index d6ac8069e498..23356416c1f0 100644 --- a/VideoLiveStream/src/V1/Manifest.php +++ b/VideoLiveStream/src/V1/Manifest.php @@ -23,13 +23,13 @@ class Manifest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string file_name = 1; */ - private $file_name = ''; + protected $file_name = ''; /** * Required. Type of the manifest, can be `HLS` or `DASH`. * * Generated from protobuf field .google.cloud.video.livestream.v1.Manifest.ManifestType type = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $type = 0; + protected $type = 0; /** * Required. List of `MuxStream` * [key][google.cloud.video.livestream.v1.MuxStream.key]s that should appear @@ -49,7 +49,7 @@ class Manifest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 max_segment_count = 4; */ - private $max_segment_count = 0; + protected $max_segment_count = 0; /** * How long to keep a segment on the output Google Cloud Storage bucket after * it is removed from the manifest. This field should be large enough to cover @@ -60,7 +60,7 @@ class Manifest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration segment_keep_duration = 5; */ - private $segment_keep_duration = null; + protected $segment_keep_duration = null; /** * Whether to use the timecode, as specified in timecode config, when setting: * - `availabilityStartTime` attribute in DASH manifests. @@ -70,7 +70,7 @@ class Manifest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool use_timecode_as_timeline = 6; */ - private $use_timecode_as_timeline = false; + protected $use_timecode_as_timeline = false; /** * Constructor. diff --git a/VideoLiveStream/src/V1/MuxStream.php b/VideoLiveStream/src/V1/MuxStream.php index 521b7a702592..b5198e42c2f0 100644 --- a/VideoLiveStream/src/V1/MuxStream.php +++ b/VideoLiveStream/src/V1/MuxStream.php @@ -20,7 +20,7 @@ class MuxStream extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key = 1; */ - private $key = ''; + protected $key = ''; /** * The container format. The default is `fmp4`. * Supported container formats: @@ -29,7 +29,7 @@ class MuxStream extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string container = 3; */ - private $container = ''; + protected $container = ''; /** * List of `ElementaryStream` * [key][google.cloud.video.livestream.v1.ElementaryStream.key]s multiplexed @@ -46,14 +46,14 @@ class MuxStream extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.SegmentSettings segment_settings = 5; */ - private $segment_settings = null; + protected $segment_settings = null; /** * Identifier of the encryption configuration to use. If omitted, output * will be unencrypted. * * Generated from protobuf field string encryption_id = 6; */ - private $encryption_id = ''; + protected $encryption_id = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/OperationMetadata.php b/VideoLiveStream/src/V1/OperationMetadata.php index 616f309d3783..ccb892bc11cf 100644 --- a/VideoLiveStream/src/V1/OperationMetadata.php +++ b/VideoLiveStream/src/V1/OperationMetadata.php @@ -20,25 +20,25 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The time the operation finished running. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Server-defined resource path for the target of the operation. * * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $target = ''; + protected $target = ''; /** * Output only. Name of the verb executed by the operation. * * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $verb = ''; + protected $verb = ''; /** * Output only. Identifies whether the user has requested cancellation * of the operation. Operations that have successfully been cancelled @@ -48,13 +48,13 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool requested_cancellation = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $requested_cancellation = false; + protected $requested_cancellation = false; /** * Output only. API version used to start the operation. * * Generated from protobuf field string api_version = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $api_version = ''; + protected $api_version = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Pool.php b/VideoLiveStream/src/V1/Pool.php index a8822de52985..83f7a3a308a7 100644 --- a/VideoLiveStream/src/V1/Pool.php +++ b/VideoLiveStream/src/V1/Pool.php @@ -24,19 +24,19 @@ class Pool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. The creation time. * * 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. The update time. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * User-defined key/value metadata. * @@ -48,7 +48,7 @@ class Pool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.Pool.NetworkConfig network_config = 5; */ - private $network_config = null; + protected $network_config = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/Pool/NetworkConfig.php b/VideoLiveStream/src/V1/Pool/NetworkConfig.php index d897737d2207..336ee5af145c 100644 --- a/VideoLiveStream/src/V1/Pool/NetworkConfig.php +++ b/VideoLiveStream/src/V1/Pool/NetworkConfig.php @@ -26,7 +26,7 @@ class NetworkConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string peered_network = 1 [(.google.api.resource_reference) = { */ - private $peered_network = ''; + protected $peered_network = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/PreprocessingConfig.php b/VideoLiveStream/src/V1/PreprocessingConfig.php index e9855b5b02e2..3f4966135443 100644 --- a/VideoLiveStream/src/V1/PreprocessingConfig.php +++ b/VideoLiveStream/src/V1/PreprocessingConfig.php @@ -20,19 +20,19 @@ class PreprocessingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Audio audio = 1; */ - private $audio = null; + protected $audio = null; /** * Specify the video cropping configuration. * * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Crop crop = 2; */ - private $crop = null; + protected $crop = null; /** * Specify the video pad filter configuration. * * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Pad pad = 3; */ - private $pad = null; + protected $pad = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/PreprocessingConfig/Audio.php b/VideoLiveStream/src/V1/PreprocessingConfig/Audio.php index 16553fb75b1b..683f8478dbfb 100644 --- a/VideoLiveStream/src/V1/PreprocessingConfig/Audio.php +++ b/VideoLiveStream/src/V1/PreprocessingConfig/Audio.php @@ -29,7 +29,7 @@ class Audio extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double lufs = 1; */ - private $lufs = 0.0; + protected $lufs = 0.0; /** * Constructor. diff --git a/VideoLiveStream/src/V1/PreprocessingConfig/Crop.php b/VideoLiveStream/src/V1/PreprocessingConfig/Crop.php index f53d73935803..07549c2b99dc 100644 --- a/VideoLiveStream/src/V1/PreprocessingConfig/Crop.php +++ b/VideoLiveStream/src/V1/PreprocessingConfig/Crop.php @@ -21,25 +21,25 @@ class Crop extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 top_pixels = 1; */ - private $top_pixels = 0; + protected $top_pixels = 0; /** * The number of pixels to crop from the bottom. The default is 0. * * Generated from protobuf field int32 bottom_pixels = 2; */ - private $bottom_pixels = 0; + protected $bottom_pixels = 0; /** * The number of pixels to crop from the left. The default is 0. * * Generated from protobuf field int32 left_pixels = 3; */ - private $left_pixels = 0; + protected $left_pixels = 0; /** * The number of pixels to crop from the right. The default is 0. * * Generated from protobuf field int32 right_pixels = 4; */ - private $right_pixels = 0; + protected $right_pixels = 0; /** * Constructor. diff --git a/VideoLiveStream/src/V1/PreprocessingConfig/Pad.php b/VideoLiveStream/src/V1/PreprocessingConfig/Pad.php index 164f1b93eb17..30246a6d72b6 100644 --- a/VideoLiveStream/src/V1/PreprocessingConfig/Pad.php +++ b/VideoLiveStream/src/V1/PreprocessingConfig/Pad.php @@ -21,25 +21,25 @@ class Pad extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 top_pixels = 1; */ - private $top_pixels = 0; + protected $top_pixels = 0; /** * The number of pixels to add to the bottom. The default is 0. * * Generated from protobuf field int32 bottom_pixels = 2; */ - private $bottom_pixels = 0; + protected $bottom_pixels = 0; /** * The number of pixels to add to the left. The default is 0. * * Generated from protobuf field int32 left_pixels = 3; */ - private $left_pixels = 0; + protected $left_pixels = 0; /** * The number of pixels to add to the right. The default is 0. * * Generated from protobuf field int32 right_pixels = 4; */ - private $right_pixels = 0; + protected $right_pixels = 0; /** * Constructor. diff --git a/VideoLiveStream/src/V1/SegmentSettings.php b/VideoLiveStream/src/V1/SegmentSettings.php index 591f3ed6ce5f..6778ece42f49 100644 --- a/VideoLiveStream/src/V1/SegmentSettings.php +++ b/VideoLiveStream/src/V1/SegmentSettings.php @@ -27,7 +27,7 @@ class SegmentSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration segment_duration = 1; */ - private $segment_duration = null; + protected $segment_duration = null; /** * Constructor. diff --git a/VideoLiveStream/src/V1/SpriteSheet.php b/VideoLiveStream/src/V1/SpriteSheet.php index b3ea401f1e7f..719cf70bff52 100644 --- a/VideoLiveStream/src/V1/SpriteSheet.php +++ b/VideoLiveStream/src/V1/SpriteSheet.php @@ -22,7 +22,7 @@ class SpriteSheet extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string format = 1; */ - private $format = ''; + protected $format = ''; /** * Required. File name prefix for the generated sprite sheets. If multiple * sprite sheets are added to the channel, each must have a unique file @@ -32,26 +32,26 @@ class SpriteSheet extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string file_prefix = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $file_prefix = ''; + protected $file_prefix = ''; /** * Required. The width of the sprite in pixels. Must be an even integer. * * Generated from protobuf field int32 sprite_width_pixels = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $sprite_width_pixels = 0; + protected $sprite_width_pixels = 0; /** * Required. The height of the sprite in pixels. Must be an even integer. * * Generated from protobuf field int32 sprite_height_pixels = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $sprite_height_pixels = 0; + protected $sprite_height_pixels = 0; /** * The maximum number of sprites per row in a sprite sheet. Valid range is * [1, 10] and the default value is 1. * * Generated from protobuf field int32 column_count = 5; */ - private $column_count = 0; + protected $column_count = 0; /** * The maximum number of rows per sprite sheet. When the sprite sheet is full, * a new sprite sheet is created. Valid range is [1, 10] and the default value @@ -59,14 +59,14 @@ class SpriteSheet extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 row_count = 6; */ - private $row_count = 0; + protected $row_count = 0; /** * Create sprites at regular intervals. Valid range is [1 second, 1 hour] and * the default value is `10s`. * * Generated from protobuf field .google.protobuf.Duration interval = 7; */ - private $interval = null; + protected $interval = null; /** * The quality of the generated sprite sheet. Enter a value between 1 * and 100, where 1 is the lowest quality and 100 is the highest quality. @@ -75,7 +75,7 @@ class SpriteSheet extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 quality = 8; */ - private $quality = 0; + protected $quality = 0; /** * Constructor. diff --git a/VideoLiveStream/src/V1/StartChannelRequest.php b/VideoLiveStream/src/V1/StartChannelRequest.php index f58d66497b36..d70e8707a2a4 100644 --- a/VideoLiveStream/src/V1/StartChannelRequest.php +++ b/VideoLiveStream/src/V1/StartChannelRequest.php @@ -21,7 +21,7 @@ class StartChannelRequest 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 = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -37,7 +37,7 @@ class StartChannelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The name of the channel resource, in the form of: diff --git a/VideoLiveStream/src/V1/StopChannelRequest.php b/VideoLiveStream/src/V1/StopChannelRequest.php index deb3da56c69f..59ed1b5512cf 100644 --- a/VideoLiveStream/src/V1/StopChannelRequest.php +++ b/VideoLiveStream/src/V1/StopChannelRequest.php @@ -21,7 +21,7 @@ class StopChannelRequest 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 = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -37,7 +37,7 @@ class StopChannelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The name of the channel resource, in the form of: diff --git a/VideoLiveStream/src/V1/TextStream.php b/VideoLiveStream/src/V1/TextStream.php index d4dd895b03e4..65259f395c0a 100644 --- a/VideoLiveStream/src/V1/TextStream.php +++ b/VideoLiveStream/src/V1/TextStream.php @@ -23,7 +23,7 @@ class TextStream extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string codec = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $codec = ''; + protected $codec = ''; /** * Constructor. diff --git a/VideoLiveStream/src/V1/TimecodeConfig.php b/VideoLiveStream/src/V1/TimecodeConfig.php index 9f278315c03a..0bfb38e5aa03 100644 --- a/VideoLiveStream/src/V1/TimecodeConfig.php +++ b/VideoLiveStream/src/V1/TimecodeConfig.php @@ -22,7 +22,7 @@ class TimecodeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.livestream.v1.TimecodeConfig.TimecodeSource source = 1; */ - private $source = 0; + protected $source = 0; protected $time_offset; /** diff --git a/VideoLiveStream/src/V1/UpdateChannelRequest.php b/VideoLiveStream/src/V1/UpdateChannelRequest.php index 717d755f7ab9..0d41cb29e8b9 100644 --- a/VideoLiveStream/src/V1/UpdateChannelRequest.php +++ b/VideoLiveStream/src/V1/UpdateChannelRequest.php @@ -36,13 +36,13 @@ class UpdateChannelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The channel resource to be updated. * * Generated from protobuf field .google.cloud.video.livestream.v1.Channel channel = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $channel = null; + protected $channel = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -58,7 +58,7 @@ class UpdateChannelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\Video\LiveStream\V1\Channel $channel Required. The channel resource to be updated. diff --git a/VideoLiveStream/src/V1/UpdateInputRequest.php b/VideoLiveStream/src/V1/UpdateInputRequest.php index 581399e3f3e6..c68b33c975ce 100644 --- a/VideoLiveStream/src/V1/UpdateInputRequest.php +++ b/VideoLiveStream/src/V1/UpdateInputRequest.php @@ -28,13 +28,13 @@ class UpdateInputRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The input resource to be updated. * * Generated from protobuf field .google.cloud.video.livestream.v1.Input input = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $input = null; + protected $input = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -50,7 +50,7 @@ class UpdateInputRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\Video\LiveStream\V1\Input $input Required. The input resource to be updated. diff --git a/VideoLiveStream/src/V1/UpdatePoolRequest.php b/VideoLiveStream/src/V1/UpdatePoolRequest.php index fc75a15e3207..55b139eecc28 100644 --- a/VideoLiveStream/src/V1/UpdatePoolRequest.php +++ b/VideoLiveStream/src/V1/UpdatePoolRequest.php @@ -24,13 +24,13 @@ class UpdatePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The pool resource to be updated. * * Generated from protobuf field .google.cloud.video.livestream.v1.Pool pool = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $pool = null; + protected $pool = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -46,7 +46,7 @@ class UpdatePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\Video\LiveStream\V1\Pool $pool Required. The pool resource to be updated. diff --git a/VideoLiveStream/src/V1/VideoFormat.php b/VideoLiveStream/src/V1/VideoFormat.php index eb5ffbd5f3f2..605d4d41bf8e 100644 --- a/VideoLiveStream/src/V1/VideoFormat.php +++ b/VideoLiveStream/src/V1/VideoFormat.php @@ -20,25 +20,25 @@ class VideoFormat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string codec = 1; */ - private $codec = ''; + protected $codec = ''; /** * The width of the video stream in pixels. * * Generated from protobuf field int32 width_pixels = 2; */ - private $width_pixels = 0; + protected $width_pixels = 0; /** * The height of the video stream in pixels. * * Generated from protobuf field int32 height_pixels = 3; */ - private $height_pixels = 0; + protected $height_pixels = 0; /** * The frame rate of the input video stream. * * Generated from protobuf field double frame_rate = 4; */ - private $frame_rate = 0.0; + protected $frame_rate = 0.0; /** * Constructor. diff --git a/VideoLiveStream/src/V1/VideoStream/H264CodecSettings.php b/VideoLiveStream/src/V1/VideoStream/H264CodecSettings.php index f64e936007fb..2685fe84d750 100644 --- a/VideoLiveStream/src/V1/VideoStream/H264CodecSettings.php +++ b/VideoLiveStream/src/V1/VideoStream/H264CodecSettings.php @@ -21,14 +21,14 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 width_pixels = 1; */ - private $width_pixels = 0; + protected $width_pixels = 0; /** * Required. The height of the video in pixels. Must be an even integer. * Valid range is [180, 1080]. * * Generated from protobuf field int32 height_pixels = 2; */ - private $height_pixels = 0; + protected $height_pixels = 0; /** * Required. The target video frame rate in frames per second (FPS). Must be * less than or equal to 60. Will default to the input frame rate if larger @@ -40,7 +40,7 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $frame_rate = 0.0; + protected $frame_rate = 0.0; /** * Required. The video bitrate in bits per second. Minimum value is 10,000. * - For SD resolution (< 720p), must be <= 3,000,000 (3 Mbps). @@ -48,14 +48,14 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $bitrate_bps = 0; + protected $bitrate_bps = 0; /** * Specifies whether an open Group of Pictures (GOP) structure should be * allowed or not. The default is `false`. * * Generated from protobuf field bool allow_open_gop = 6; */ - private $allow_open_gop = false; + protected $allow_open_gop = false; /** * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be * greater than zero. The default is equal to @@ -63,7 +63,7 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 vbv_size_bits = 9; */ - private $vbv_size_bits = 0; + protected $vbv_size_bits = 0; /** * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. * Must be greater than zero. The default is equal to 90% of @@ -71,7 +71,7 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 vbv_fullness_bits = 10; */ - private $vbv_fullness_bits = 0; + protected $vbv_fullness_bits = 0; /** * The entropy coder to use. The default is `cabac`. * Supported entropy coders: @@ -80,14 +80,14 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string entropy_coder = 11; */ - private $entropy_coder = ''; + protected $entropy_coder = ''; /** * Allow B-pyramid for reference frame selection. This may not be supported * on all decoders. The default is `false`. * * Generated from protobuf field bool b_pyramid = 12; */ - private $b_pyramid = false; + protected $b_pyramid = false; /** * The number of consecutive B-frames. Must be greater than or equal to * zero. Must be less than @@ -96,7 +96,7 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 b_frame_count = 13; */ - private $b_frame_count = 0; + protected $b_frame_count = 0; /** * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A @@ -104,7 +104,7 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double aq_strength = 14; */ - private $aq_strength = 0.0; + protected $aq_strength = 0.0; /** * Enforces the specified codec profile. The following profiles are * supported: @@ -120,7 +120,7 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string profile = 15; */ - private $profile = ''; + protected $profile = ''; /** * Enforces the specified codec tune. The available options are * [FFmpeg-compatible Encode @@ -132,7 +132,7 @@ class H264CodecSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string tune = 16; */ - private $tune = ''; + protected $tune = ''; protected $gop_mode; /** diff --git a/VideoLiveStream/src/V1/VideoStreamProperty.php b/VideoLiveStream/src/V1/VideoStreamProperty.php index f9d5ae7ec47c..ffda21dceb46 100644 --- a/VideoLiveStream/src/V1/VideoStreamProperty.php +++ b/VideoLiveStream/src/V1/VideoStreamProperty.php @@ -20,13 +20,13 @@ class VideoStreamProperty extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 index = 1; */ - private $index = 0; + protected $index = 0; /** * Properties of the video format. * * Generated from protobuf field .google.cloud.video.livestream.v1.VideoFormat video_format = 2; */ - private $video_format = null; + protected $video_format = null; /** * Constructor. diff --git a/VideoLiveStream/tests/Unit/V1/Client/LivestreamServiceClientTest.php b/VideoLiveStream/tests/Unit/V1/Client/LivestreamServiceClientTest.php index 37461d61f7e8..d563bc47c759 100644 --- a/VideoLiveStream/tests/Unit/V1/Client/LivestreamServiceClientTest.php +++ b/VideoLiveStream/tests/Unit/V1/Client/LivestreamServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return LivestreamServiceClient */ @@ -200,12 +202,15 @@ public function createAssetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -339,12 +344,15 @@ public function createChannelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -428,12 +436,15 @@ public function createEventExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); @@ -556,12 +567,15 @@ public function createInputExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -624,8 +638,7 @@ public function deleteAssetTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - $request = (new DeleteAssetRequest()) - ->setName($formattedName); + $request = (new DeleteAssetRequest())->setName($formattedName); $response = $gapicClient->deleteAsset($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -681,17 +694,19 @@ public function deleteAssetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - $request = (new DeleteAssetRequest()) - ->setName($formattedName); + $request = (new DeleteAssetRequest())->setName($formattedName); $response = $gapicClient->deleteAsset($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -745,8 +760,7 @@ public function deleteChannelTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new DeleteChannelRequest()) - ->setName($formattedName); + $request = (new DeleteChannelRequest())->setName($formattedName); $response = $gapicClient->deleteChannel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -802,17 +816,19 @@ public function deleteChannelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new DeleteChannelRequest()) - ->setName($formattedName); + $request = (new DeleteChannelRequest())->setName($formattedName); $response = $gapicClient->deleteChannel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -848,8 +864,7 @@ public function deleteEventTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - $request = (new DeleteEventRequest()) - ->setName($formattedName); + $request = (new DeleteEventRequest())->setName($formattedName); $gapicClient->deleteEvent($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -872,17 +887,19 @@ public function deleteEventExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - $request = (new DeleteEventRequest()) - ->setName($formattedName); + $request = (new DeleteEventRequest())->setName($formattedName); try { $gapicClient->deleteEvent($request); // If the $gapicClient method call did not throw, fail the test @@ -927,8 +944,7 @@ public function deleteInputTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - $request = (new DeleteInputRequest()) - ->setName($formattedName); + $request = (new DeleteInputRequest())->setName($formattedName); $response = $gapicClient->deleteInput($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -984,17 +1000,19 @@ public function deleteInputExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - $request = (new DeleteInputRequest()) - ->setName($formattedName); + $request = (new DeleteInputRequest())->setName($formattedName); $response = $gapicClient->deleteInput($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1034,8 +1052,7 @@ public function getAssetTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - $request = (new GetAssetRequest()) - ->setName($formattedName); + $request = (new GetAssetRequest())->setName($formattedName); $response = $gapicClient->getAsset($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1059,17 +1076,19 @@ public function getAssetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - $request = (new GetAssetRequest()) - ->setName($formattedName); + $request = (new GetAssetRequest())->setName($formattedName); try { $gapicClient->getAsset($request); // If the $gapicClient method call did not throw, fail the test @@ -1100,8 +1119,7 @@ public function getChannelTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new GetChannelRequest()) - ->setName($formattedName); + $request = (new GetChannelRequest())->setName($formattedName); $response = $gapicClient->getChannel($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1125,17 +1143,19 @@ public function getChannelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new GetChannelRequest()) - ->setName($formattedName); + $request = (new GetChannelRequest())->setName($formattedName); try { $gapicClient->getChannel($request); // If the $gapicClient method call did not throw, fail the test @@ -1166,8 +1186,7 @@ public function getEventTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - $request = (new GetEventRequest()) - ->setName($formattedName); + $request = (new GetEventRequest())->setName($formattedName); $response = $gapicClient->getEvent($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1191,17 +1210,19 @@ public function getEventExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - $request = (new GetEventRequest()) - ->setName($formattedName); + $request = (new GetEventRequest())->setName($formattedName); try { $gapicClient->getEvent($request); // If the $gapicClient method call did not throw, fail the test @@ -1232,8 +1253,7 @@ public function getInputTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - $request = (new GetInputRequest()) - ->setName($formattedName); + $request = (new GetInputRequest())->setName($formattedName); $response = $gapicClient->getInput($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1257,17 +1277,19 @@ public function getInputExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - $request = (new GetInputRequest()) - ->setName($formattedName); + $request = (new GetInputRequest())->setName($formattedName); try { $gapicClient->getInput($request); // If the $gapicClient method call did not throw, fail the test @@ -1296,8 +1318,7 @@ public function getPoolTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); - $request = (new GetPoolRequest()) - ->setName($formattedName); + $request = (new GetPoolRequest())->setName($formattedName); $response = $gapicClient->getPool($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1321,17 +1342,19 @@ public function getPoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); - $request = (new GetPoolRequest()) - ->setName($formattedName); + $request = (new GetPoolRequest())->setName($formattedName); try { $gapicClient->getPool($request); // If the $gapicClient method call did not throw, fail the test @@ -1356,17 +1379,14 @@ public function listAssetsTest() // Mock response $nextPageToken = ''; $assetsElement = new Asset(); - $assets = [ - $assetsElement, - ]; + $assets = [$assetsElement]; $expectedResponse = new ListAssetsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAssets($assets); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListAssetsRequest()) - ->setParent($formattedParent); + $request = (new ListAssetsRequest())->setParent($formattedParent); $response = $gapicClient->listAssets($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1393,17 +1413,19 @@ public function listAssetsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListAssetsRequest()) - ->setParent($formattedParent); + $request = (new ListAssetsRequest())->setParent($formattedParent); try { $gapicClient->listAssets($request); // If the $gapicClient method call did not throw, fail the test @@ -1428,17 +1450,14 @@ public function listChannelsTest() // Mock response $nextPageToken = ''; $channelsElement = new Channel(); - $channels = [ - $channelsElement, - ]; + $channels = [$channelsElement]; $expectedResponse = new ListChannelsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setChannels($channels); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListChannelsRequest()) - ->setParent($formattedParent); + $request = (new ListChannelsRequest())->setParent($formattedParent); $response = $gapicClient->listChannels($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1465,17 +1484,19 @@ public function listChannelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListChannelsRequest()) - ->setParent($formattedParent); + $request = (new ListChannelsRequest())->setParent($formattedParent); try { $gapicClient->listChannels($request); // If the $gapicClient method call did not throw, fail the test @@ -1500,17 +1521,14 @@ public function listEventsTest() // Mock response $nextPageToken = ''; $eventsElement = new Event(); - $events = [ - $eventsElement, - ]; + $events = [$eventsElement]; $expectedResponse = new ListEventsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setEvents($events); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new ListEventsRequest()) - ->setParent($formattedParent); + $request = (new ListEventsRequest())->setParent($formattedParent); $response = $gapicClient->listEvents($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1537,17 +1555,19 @@ public function listEventsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new ListEventsRequest()) - ->setParent($formattedParent); + $request = (new ListEventsRequest())->setParent($formattedParent); try { $gapicClient->listEvents($request); // If the $gapicClient method call did not throw, fail the test @@ -1572,17 +1592,14 @@ public function listInputsTest() // Mock response $nextPageToken = ''; $inputsElement = new Input(); - $inputs = [ - $inputsElement, - ]; + $inputs = [$inputsElement]; $expectedResponse = new ListInputsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setInputs($inputs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListInputsRequest()) - ->setParent($formattedParent); + $request = (new ListInputsRequest())->setParent($formattedParent); $response = $gapicClient->listInputs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1609,17 +1626,19 @@ public function listInputsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListInputsRequest()) - ->setParent($formattedParent); + $request = (new ListInputsRequest())->setParent($formattedParent); try { $gapicClient->listInputs($request); // If the $gapicClient method call did not throw, fail the test @@ -1664,8 +1683,7 @@ public function startChannelTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new StartChannelRequest()) - ->setName($formattedName); + $request = (new StartChannelRequest())->setName($formattedName); $response = $gapicClient->startChannel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1721,17 +1739,19 @@ public function startChannelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new StartChannelRequest()) - ->setName($formattedName); + $request = (new StartChannelRequest())->setName($formattedName); $response = $gapicClient->startChannel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1785,8 +1805,7 @@ public function stopChannelTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new StopChannelRequest()) - ->setName($formattedName); + $request = (new StopChannelRequest())->setName($formattedName); $response = $gapicClient->stopChannel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1842,17 +1861,19 @@ public function stopChannelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $request = (new StopChannelRequest()) - ->setName($formattedName); + $request = (new StopChannelRequest())->setName($formattedName); $response = $gapicClient->stopChannel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1912,8 +1933,7 @@ public function updateChannelTest() $channel = new Channel(); $channelOutput = new Output(); $channel->setOutput($channelOutput); - $request = (new UpdateChannelRequest()) - ->setChannel($channel); + $request = (new UpdateChannelRequest())->setChannel($channel); $response = $gapicClient->updateChannel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1969,19 +1989,21 @@ public function updateChannelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $channel = new Channel(); $channelOutput = new Output(); $channel->setOutput($channelOutput); - $request = (new UpdateChannelRequest()) - ->setChannel($channel); + $request = (new UpdateChannelRequest())->setChannel($channel); $response = $gapicClient->updateChannel($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2039,8 +2061,7 @@ public function updateInputTest() $operationsTransport->addResponse($completeOperation); // Mock request $input = new Input(); - $request = (new UpdateInputRequest()) - ->setInput($input); + $request = (new UpdateInputRequest())->setInput($input); $response = $gapicClient->updateInput($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2096,17 +2117,19 @@ public function updateInputExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $input = new Input(); - $request = (new UpdateInputRequest()) - ->setInput($input); + $request = (new UpdateInputRequest())->setInput($input); $response = $gapicClient->updateInput($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2162,8 +2185,7 @@ public function updatePoolTest() $operationsTransport->addResponse($completeOperation); // Mock request $pool = new Pool(); - $request = (new UpdatePoolRequest()) - ->setPool($pool); + $request = (new UpdatePoolRequest())->setPool($pool); $response = $gapicClient->updatePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2219,17 +2241,19 @@ public function updatePoolExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $pool = new Pool(); - $request = (new UpdatePoolRequest()) - ->setPool($pool); + $request = (new UpdatePoolRequest())->setPool($pool); $response = $gapicClient->updatePool($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2291,12 +2315,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 { @@ -2323,9 +2350,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -2355,12 +2380,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 { diff --git a/VideoLiveStream/tests/Unit/V1/LivestreamServiceClientTest.php b/VideoLiveStream/tests/Unit/V1/LivestreamServiceClientTest.php deleted file mode 100644 index 2a931601598f..000000000000 --- a/VideoLiveStream/tests/Unit/V1/LivestreamServiceClientTest.php +++ /dev/null @@ -1,2246 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return LivestreamServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new LivestreamServiceClient($options); - } - - /** @test */ - public function createAssetTest() - { - $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/createAssetTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $crc32c = 'crc32c-1352399984'; - $expectedResponse = new Asset(); - $expectedResponse->setName($name); - $expectedResponse->setCrc32c($crc32c); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createAssetTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $asset = new Asset(); - $assetId = 'assetId-373202742'; - $response = $gapicClient->createAsset($formattedParent, $asset, $assetId); - $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.video.livestream.v1.LivestreamService/CreateAsset', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getAsset(); - $this->assertProtobufEquals($asset, $actualValue); - $actualValue = $actualApiRequestObject->getAssetId(); - $this->assertProtobufEquals($assetId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAssetTest'); - $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 createAssetExceptionTest() - { - $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/createAssetTest'); - $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]'); - $asset = new Asset(); - $assetId = 'assetId-373202742'; - $response = $gapicClient->createAsset($formattedParent, $asset, $assetId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createAssetTest'); - 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 createChannelTest() - { - $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/createChannelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $activeInput = 'activeInput1758551377'; - $expectedResponse = new Channel(); - $expectedResponse->setName($name); - $expectedResponse->setActiveInput($activeInput); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createChannelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $channel = new Channel(); - $channelOutput = new Output(); - $channel->setOutput($channelOutput); - $channelId = 'channelId-1930808873'; - $response = $gapicClient->createChannel($formattedParent, $channel, $channelId); - $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.video.livestream.v1.LivestreamService/CreateChannel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getChannel(); - $this->assertProtobufEquals($channel, $actualValue); - $actualValue = $actualApiRequestObject->getChannelId(); - $this->assertProtobufEquals($channelId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createChannelTest'); - $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 createChannelExceptionTest() - { - $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/createChannelTest'); - $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]'); - $channel = new Channel(); - $channelOutput = new Output(); - $channel->setOutput($channelOutput); - $channelId = 'channelId-1930808873'; - $response = $gapicClient->createChannel($formattedParent, $channel, $channelId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createChannelTest'); - 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 createEventTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $executeNow = true; - $expectedResponse = new Event(); - $expectedResponse->setName($name); - $expectedResponse->setExecuteNow($executeNow); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $event = new Event(); - $eventId = 'eventId278118624'; - $response = $gapicClient->createEvent($formattedParent, $event, $eventId); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/CreateEvent', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getEvent(); - $this->assertProtobufEquals($event, $actualValue); - $actualValue = $actualRequestObject->getEventId(); - $this->assertProtobufEquals($eventId, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createEventExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $event = new Event(); - $eventId = 'eventId278118624'; - try { - $gapicClient->createEvent($formattedParent, $event, $eventId); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createInputTest() - { - $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/createInputTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $uri = 'uri116076'; - $expectedResponse = new Input(); - $expectedResponse->setName($name); - $expectedResponse->setUri($uri); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInputTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $input = new Input(); - $inputId = 'inputId470715824'; - $response = $gapicClient->createInput($formattedParent, $input, $inputId); - $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.video.livestream.v1.LivestreamService/CreateInput', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getInput(); - $this->assertProtobufEquals($input, $actualValue); - $actualValue = $actualApiRequestObject->getInputId(); - $this->assertProtobufEquals($inputId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInputTest'); - $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 createInputExceptionTest() - { - $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/createInputTest'); - $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]'); - $input = new Input(); - $inputId = 'inputId470715824'; - $response = $gapicClient->createInput($formattedParent, $input, $inputId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInputTest'); - 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 deleteAssetTest() - { - $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/deleteAssetTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteAssetTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - $response = $gapicClient->deleteAsset($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.video.livestream.v1.LivestreamService/DeleteAsset', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAssetTest'); - $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 deleteAssetExceptionTest() - { - $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/deleteAssetTest'); - $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->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - $response = $gapicClient->deleteAsset($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteAssetTest'); - 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 deleteChannelTest() - { - $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/deleteChannelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteChannelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $response = $gapicClient->deleteChannel($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.video.livestream.v1.LivestreamService/DeleteChannel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteChannelTest'); - $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 deleteChannelExceptionTest() - { - $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/deleteChannelTest'); - $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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $response = $gapicClient->deleteChannel($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteChannelTest'); - 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 deleteEventTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - $gapicClient->deleteEvent($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/DeleteEvent', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteEventExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - try { - $gapicClient->deleteEvent($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 deleteInputTest() - { - $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/deleteInputTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteInputTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - $response = $gapicClient->deleteInput($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.video.livestream.v1.LivestreamService/DeleteInput', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteInputTest'); - $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 deleteInputExceptionTest() - { - $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/deleteInputTest'); - $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->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - $response = $gapicClient->deleteInput($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteInputTest'); - 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 getAssetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $crc32c = 'crc32c-1352399984'; - $expectedResponse = new Asset(); - $expectedResponse->setName($name2); - $expectedResponse->setCrc32c($crc32c); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - $response = $gapicClient->getAsset($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.video.livestream.v1.LivestreamService/GetAsset', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAssetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); - try { - $gapicClient->getAsset($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 getChannelTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $activeInput = 'activeInput1758551377'; - $expectedResponse = new Channel(); - $expectedResponse->setName($name2); - $expectedResponse->setActiveInput($activeInput); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $response = $gapicClient->getChannel($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.video.livestream.v1.LivestreamService/GetChannel', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getChannelExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - try { - $gapicClient->getChannel($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 getEventTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $executeNow = true; - $expectedResponse = new Event(); - $expectedResponse->setName($name2); - $expectedResponse->setExecuteNow($executeNow); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - $response = $gapicClient->getEvent($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.video.livestream.v1.LivestreamService/GetEvent', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEventExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); - try { - $gapicClient->getEvent($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 getInputTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $uri = 'uri116076'; - $expectedResponse = new Input(); - $expectedResponse->setName($name2); - $expectedResponse->setUri($uri); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - $response = $gapicClient->getInput($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.video.livestream.v1.LivestreamService/GetInput', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInputExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); - try { - $gapicClient->getInput($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 getPoolTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new Pool(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); - $response = $gapicClient->getPool($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.video.livestream.v1.LivestreamService/GetPool', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getPoolExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); - try { - $gapicClient->getPool($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 listAssetsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $assetsElement = new Asset(); - $assets = [ - $assetsElement, - ]; - $expectedResponse = new ListAssetsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAssets($assets); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listAssets($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAssets()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListAssets', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAssetsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listAssets($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 listChannelsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $channelsElement = new Channel(); - $channels = [ - $channelsElement, - ]; - $expectedResponse = new ListChannelsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setChannels($channels); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listChannels($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getChannels()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListChannels', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listChannelsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listChannels($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 listEventsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $eventsElement = new Event(); - $events = [ - $eventsElement, - ]; - $expectedResponse = new ListEventsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setEvents($events); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $response = $gapicClient->listEvents($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getEvents()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListEvents', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listEventsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - try { - $gapicClient->listEvents($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 listInputsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $inputsElement = new Input(); - $inputs = [ - $inputsElement, - ]; - $expectedResponse = new ListInputsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setInputs($inputs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listInputs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getInputs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListInputs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInputsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listInputs($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 startChannelTest() - { - $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/startChannelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new ChannelOperationResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/startChannelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $response = $gapicClient->startChannel($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.video.livestream.v1.LivestreamService/StartChannel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startChannelTest'); - $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 startChannelExceptionTest() - { - $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/startChannelTest'); - $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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $response = $gapicClient->startChannel($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startChannelTest'); - 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 stopChannelTest() - { - $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/stopChannelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new ChannelOperationResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/stopChannelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $response = $gapicClient->stopChannel($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.video.livestream.v1.LivestreamService/StopChannel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/stopChannelTest'); - $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 stopChannelExceptionTest() - { - $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/stopChannelTest'); - $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->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); - $response = $gapicClient->stopChannel($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/stopChannelTest'); - 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 updateChannelTest() - { - $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/updateChannelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $activeInput = 'activeInput1758551377'; - $expectedResponse = new Channel(); - $expectedResponse->setName($name); - $expectedResponse->setActiveInput($activeInput); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateChannelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $channel = new Channel(); - $channelOutput = new Output(); - $channel->setOutput($channelOutput); - $response = $gapicClient->updateChannel($channel); - $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.video.livestream.v1.LivestreamService/UpdateChannel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getChannel(); - $this->assertProtobufEquals($channel, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateChannelTest'); - $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 updateChannelExceptionTest() - { - $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/updateChannelTest'); - $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 - $channel = new Channel(); - $channelOutput = new Output(); - $channel->setOutput($channelOutput); - $response = $gapicClient->updateChannel($channel); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateChannelTest'); - 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 updateInputTest() - { - $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/updateInputTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $uri = 'uri116076'; - $expectedResponse = new Input(); - $expectedResponse->setName($name); - $expectedResponse->setUri($uri); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateInputTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $input = new Input(); - $response = $gapicClient->updateInput($input); - $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.video.livestream.v1.LivestreamService/UpdateInput', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInput(); - $this->assertProtobufEquals($input, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInputTest'); - $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 updateInputExceptionTest() - { - $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/updateInputTest'); - $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 - $input = new Input(); - $response = $gapicClient->updateInput($input); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInputTest'); - 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 updatePoolTest() - { - $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/updatePoolTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $expectedResponse = new Pool(); - $expectedResponse->setName($name); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updatePoolTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $pool = new Pool(); - $response = $gapicClient->updatePool($pool); - $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.video.livestream.v1.LivestreamService/UpdatePool', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getPool(); - $this->assertProtobufEquals($pool, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updatePoolTest'); - $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 updatePoolExceptionTest() - { - $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/updatePoolTest'); - $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 - $pool = new Pool(); - $response = $gapicClient->updatePool($pool); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updatePoolTest'); - 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()); - } -} diff --git a/VideoStitcher/.OwlBot.yaml b/VideoStitcher/.OwlBot.yaml index e6a4b9a7a763..539fbbd58075 100644 --- a/VideoStitcher/.OwlBot.yaml +++ b/VideoStitcher/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/video/stitcher/v1/.*-php/(.*) - dest: /owl-bot-staging/VideoStitcher/v1/$1 + - source: /google/cloud/video/stitcher/(v1)/.*-php/(.*) + dest: /owl-bot-staging/VideoStitcher/$1/$2 api-name: VideoStitcher diff --git a/VideoStitcher/README.md b/VideoStitcher/README.md index f4187254008c..ab08dae7670a 100644 --- a/VideoStitcher/README.md +++ b/VideoStitcher/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/VideoStitcher/owlbot.py b/VideoStitcher/owlbot.py index dd650436677c..c50e6843804c 100644 --- a/VideoStitcher/owlbot.py +++ b/VideoStitcher/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. @@ -30,13 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php" - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -47,32 +41,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 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) + '--print-width=120']) diff --git a/VideoStitcher/src/V1/AdRequest.php b/VideoStitcher/src/V1/AdRequest.php index 847fe5395ed0..37e899db9a19 100644 --- a/VideoStitcher/src/V1/AdRequest.php +++ b/VideoStitcher/src/V1/AdRequest.php @@ -20,19 +20,19 @@ class AdRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 1; */ - private $uri = ''; + protected $uri = ''; /** * The request metadata used to make the ad request. * * Generated from protobuf field .google.cloud.video.stitcher.v1.RequestMetadata request_metadata = 2; */ - private $request_metadata = null; + protected $request_metadata = null; /** * The response metadata received from the ad request. * * Generated from protobuf field .google.cloud.video.stitcher.v1.ResponseMetadata response_metadata = 3; */ - private $response_metadata = null; + protected $response_metadata = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/AdStitchDetail.php b/VideoStitcher/src/V1/AdStitchDetail.php index 9761089cea68..33dc179495cb 100644 --- a/VideoStitcher/src/V1/AdStitchDetail.php +++ b/VideoStitcher/src/V1/AdStitchDetail.php @@ -20,25 +20,25 @@ class AdStitchDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string ad_break_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $ad_break_id = ''; + protected $ad_break_id = ''; /** * Required. The ad ID of the processed ad. * * Generated from protobuf field string ad_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $ad_id = ''; + protected $ad_id = ''; /** * Required. The time offset of the processed ad. * * Generated from protobuf field .google.protobuf.Duration ad_time_offset = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $ad_time_offset = null; + protected $ad_time_offset = null; /** * Optional. Indicates the reason why the ad has been skipped. * * Generated from protobuf field string skip_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $skip_reason = ''; + protected $skip_reason = ''; /** * Optional. The metadata of the chosen media file for the ad. * diff --git a/VideoStitcher/src/V1/AdTag.php b/VideoStitcher/src/V1/AdTag.php deleted file mode 100644 index 413ee1ce3e73..000000000000 --- a/VideoStitcher/src/V1/AdTag.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.video.stitcher.v1.AdTag - */ -class AdTag extends \Google\Protobuf\Internal\Message -{ - /** - * Ad tag URI template. - * - * Generated from protobuf field string uri = 1; - */ - private $uri = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $uri - * Ad tag URI template. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); - parent::__construct($data); - } - - /** - * Ad tag URI template. - * - * Generated from protobuf field string uri = 1; - * @return string - */ - public function getUri() - { - return $this->uri; - } - - /** - * Ad tag URI template. - * - * Generated from protobuf field string uri = 1; - * @param string $var - * @return $this - */ - public function setUri($var) - { - GPBUtil::checkString($var, True); - $this->uri = $var; - - return $this; - } - -} - diff --git a/VideoStitcher/src/V1/AkamaiCdnKey.php b/VideoStitcher/src/V1/AkamaiCdnKey.php index b115199aeaf1..910d74fe0864 100644 --- a/VideoStitcher/src/V1/AkamaiCdnKey.php +++ b/VideoStitcher/src/V1/AkamaiCdnKey.php @@ -20,7 +20,7 @@ class AkamaiCdnKey extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes token_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; */ - private $token_key = ''; + protected $token_key = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/CdnKey.php b/VideoStitcher/src/V1/CdnKey.php index 5814f45c4fcb..c5c9fc8a7033 100644 --- a/VideoStitcher/src/V1/CdnKey.php +++ b/VideoStitcher/src/V1/CdnKey.php @@ -24,13 +24,13 @@ class CdnKey extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * The hostname this key applies to. * * Generated from protobuf field string hostname = 4; */ - private $hostname = ''; + protected $hostname = ''; protected $cdn_key_config; /** diff --git a/VideoStitcher/src/V1/Client/VideoStitcherServiceClient.php b/VideoStitcher/src/V1/Client/VideoStitcherServiceClient.php index ef152a06a60c..6deadb0b97f5 100644 --- a/VideoStitcher/src/V1/Client/VideoStitcherServiceClient.php +++ b/VideoStitcher/src/V1/Client/VideoStitcherServiceClient.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 cdn_key * resource. @@ -232,8 +251,12 @@ public static function cdnKeyName(string $project, string $location, string $cdn * * @return string The formatted live_ad_tag_detail resource. */ - public static function liveAdTagDetailName(string $project, string $location, string $liveSession, string $liveAdTagDetail): string - { + public static function liveAdTagDetailName( + string $project, + string $location, + string $liveSession, + string $liveAdTagDetail + ): string { return self::getPathTemplate('liveAdTagDetail')->render([ 'project' => $project, 'location' => $location, @@ -327,8 +350,12 @@ public static function slateName(string $project, string $location, string $slat * * @return string The formatted vod_ad_tag_detail resource. */ - public static function vodAdTagDetailName(string $project, string $location, string $vodSession, string $vodAdTagDetail): string - { + public static function vodAdTagDetailName( + string $project, + string $location, + string $vodSession, + string $vodAdTagDetail + ): string { return self::getPathTemplate('vodAdTagDetail')->render([ 'project' => $project, 'location' => $location, @@ -386,8 +413,12 @@ public static function vodSessionName(string $project, string $location, string * * @return string The formatted vod_stitch_detail resource. */ - public static function vodStitchDetailName(string $project, string $location, string $vodSession, string $vodStitchDetail): string - { + public static function vodStitchDetailName( + string $project, + string $location, + string $vodSession, + string $vodStitchDetail + ): string { return self::getPathTemplate('vodStitchDetail')->render([ 'project' => $project, 'location' => $location, @@ -1056,8 +1087,10 @@ public function listCdnKeys(ListCdnKeysRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function listLiveAdTagDetails(ListLiveAdTagDetailsRequest $request, array $callOptions = []): PagedListResponse - { + public function listLiveAdTagDetails( + ListLiveAdTagDetailsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListLiveAdTagDetails', $request, $callOptions); } @@ -1191,8 +1224,10 @@ public function listVodConfigs(ListVodConfigsRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function listVodStitchDetails(ListVodStitchDetailsRequest $request, array $callOptions = []): PagedListResponse - { + public function listVodStitchDetails( + ListVodStitchDetailsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListVodStitchDetails', $request, $callOptions); } diff --git a/VideoStitcher/src/V1/Companion.php b/VideoStitcher/src/V1/Companion.php index e49a90b6b0d2..6acf2dce062b 100644 --- a/VideoStitcher/src/V1/Companion.php +++ b/VideoStitcher/src/V1/Companion.php @@ -20,43 +20,43 @@ class Companion extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string api_framework = 1; */ - private $api_framework = ''; + protected $api_framework = ''; /** * The pixel height of the placement slot for the intended creative. * * Generated from protobuf field int32 height_px = 2; */ - private $height_px = 0; + protected $height_px = 0; /** * The pixel width of the placement slot for the intended creative. * * Generated from protobuf field int32 width_px = 3; */ - private $width_px = 0; + protected $width_px = 0; /** * The pixel height of the creative. * * Generated from protobuf field int32 asset_height_px = 4; */ - private $asset_height_px = 0; + protected $asset_height_px = 0; /** * The maximum pixel height of the creative in its expanded state. * * Generated from protobuf field int32 expanded_height_px = 5; */ - private $expanded_height_px = 0; + protected $expanded_height_px = 0; /** * The pixel width of the creative. * * Generated from protobuf field int32 asset_width_px = 6; */ - private $asset_width_px = 0; + protected $asset_width_px = 0; /** * The maximum pixel width of the creative in its expanded state. * * Generated from protobuf field int32 expanded_width_px = 7; */ - private $expanded_width_px = 0; + protected $expanded_width_px = 0; /** * The ID used to identify the desired placement on a publisher's page. * Values to be used should be discussed between publishers and @@ -64,7 +64,7 @@ class Companion extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string ad_slot_id = 8; */ - private $ad_slot_id = ''; + protected $ad_slot_id = ''; /** * The list of tracking events for the companion. * diff --git a/VideoStitcher/src/V1/CompanionAds.php b/VideoStitcher/src/V1/CompanionAds.php index 4c4e38de3704..19875411f716 100644 --- a/VideoStitcher/src/V1/CompanionAds.php +++ b/VideoStitcher/src/V1/CompanionAds.php @@ -20,7 +20,7 @@ class CompanionAds extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.CompanionAds.DisplayRequirement display_requirement = 1; */ - private $display_requirement = 0; + protected $display_requirement = 0; /** * List of companion ads. * diff --git a/VideoStitcher/src/V1/CreateCdnKeyRequest.php b/VideoStitcher/src/V1/CreateCdnKeyRequest.php index 0df6b5e2a987..86b5b6d68253 100644 --- a/VideoStitcher/src/V1/CreateCdnKeyRequest.php +++ b/VideoStitcher/src/V1/CreateCdnKeyRequest.php @@ -21,13 +21,13 @@ class CreateCdnKeyRequest 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 CDN key resource to create. * * Generated from protobuf field .google.cloud.video.stitcher.v1.CdnKey cdn_key = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $cdn_key = null; + protected $cdn_key = null; /** * Required. The ID to use for the CDN key, which will become the final * component of the CDN key's resource name. @@ -37,7 +37,7 @@ class CreateCdnKeyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string cdn_key_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $cdn_key_id = ''; + protected $cdn_key_id = ''; /** * @param string $parent Required. The project in which the CDN key should be created, in the form diff --git a/VideoStitcher/src/V1/CreateLiveConfigRequest.php b/VideoStitcher/src/V1/CreateLiveConfigRequest.php index e671a7c3b2b8..2e55e807afd3 100644 --- a/VideoStitcher/src/V1/CreateLiveConfigRequest.php +++ b/VideoStitcher/src/V1/CreateLiveConfigRequest.php @@ -21,19 +21,19 @@ class CreateLiveConfigRequest 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 unique identifier ID to use for the live config. * * Generated from protobuf field string live_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $live_config_id = ''; + protected $live_config_id = ''; /** * Required. The live config resource to create. * * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig live_config = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $live_config = null; + protected $live_config = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -49,7 +49,7 @@ class CreateLiveConfigRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The project in which the live config should be created, in diff --git a/VideoStitcher/src/V1/CreateLiveSessionRequest.php b/VideoStitcher/src/V1/CreateLiveSessionRequest.php index 1b36ad02a5e2..76a9ea13ef7d 100644 --- a/VideoStitcher/src/V1/CreateLiveSessionRequest.php +++ b/VideoStitcher/src/V1/CreateLiveSessionRequest.php @@ -21,13 +21,13 @@ class CreateLiveSessionRequest 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. Parameters for creating a live session. * * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession live_session = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $live_session = null; + protected $live_session = null; /** * @param string $parent Required. The project and location in which the live session should be diff --git a/VideoStitcher/src/V1/CreateSlateRequest.php b/VideoStitcher/src/V1/CreateSlateRequest.php index 845a3b79ddb2..f1cd04f9e2da 100644 --- a/VideoStitcher/src/V1/CreateSlateRequest.php +++ b/VideoStitcher/src/V1/CreateSlateRequest.php @@ -21,7 +21,7 @@ class CreateSlateRequest 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 unique identifier for the slate. * This value should conform to RFC-1034, which restricts to @@ -30,13 +30,13 @@ class CreateSlateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string slate_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $slate_id = ''; + protected $slate_id = ''; /** * Required. The slate to create. * * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate slate = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $slate = null; + protected $slate = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -52,7 +52,7 @@ class CreateSlateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The project in which the slate should be created, in the form of diff --git a/VideoStitcher/src/V1/CreateVodConfigRequest.php b/VideoStitcher/src/V1/CreateVodConfigRequest.php index bd0424e4c8f6..208af090748b 100644 --- a/VideoStitcher/src/V1/CreateVodConfigRequest.php +++ b/VideoStitcher/src/V1/CreateVodConfigRequest.php @@ -21,19 +21,19 @@ class CreateVodConfigRequest 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 unique identifier ID to use for the VOD config. * * Generated from protobuf field string vod_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $vod_config_id = ''; + protected $vod_config_id = ''; /** * Required. The VOD config resource to create. * * Generated from protobuf field .google.cloud.video.stitcher.v1.VodConfig vod_config = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $vod_config = null; + protected $vod_config = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -49,7 +49,7 @@ class CreateVodConfigRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The project in which the VOD config should be created, in diff --git a/VideoStitcher/src/V1/CreateVodSessionRequest.php b/VideoStitcher/src/V1/CreateVodSessionRequest.php index 58359f704c24..14e94a02e824 100644 --- a/VideoStitcher/src/V1/CreateVodSessionRequest.php +++ b/VideoStitcher/src/V1/CreateVodSessionRequest.php @@ -21,13 +21,13 @@ class CreateVodSessionRequest 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. Parameters for creating a session. * * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSession vod_session = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $vod_session = null; + protected $vod_session = null; /** * @param string $parent Required. The project and location in which the VOD session should be diff --git a/VideoStitcher/src/V1/DeleteCdnKeyRequest.php b/VideoStitcher/src/V1/DeleteCdnKeyRequest.php index 04ac205dd751..7e1f8d4d0f91 100644 --- a/VideoStitcher/src/V1/DeleteCdnKeyRequest.php +++ b/VideoStitcher/src/V1/DeleteCdnKeyRequest.php @@ -21,7 +21,7 @@ class DeleteCdnKeyRequest 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 CDN key to be deleted, in the form of diff --git a/VideoStitcher/src/V1/DeleteLiveConfigRequest.php b/VideoStitcher/src/V1/DeleteLiveConfigRequest.php index 0f7bdbb7cb85..c0b9429e5375 100644 --- a/VideoStitcher/src/V1/DeleteLiveConfigRequest.php +++ b/VideoStitcher/src/V1/DeleteLiveConfigRequest.php @@ -21,7 +21,7 @@ class DeleteLiveConfigRequest 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 live config to be deleted, in the form of diff --git a/VideoStitcher/src/V1/DeleteSlateRequest.php b/VideoStitcher/src/V1/DeleteSlateRequest.php index 437df519ed4f..6cdc43bb27e4 100644 --- a/VideoStitcher/src/V1/DeleteSlateRequest.php +++ b/VideoStitcher/src/V1/DeleteSlateRequest.php @@ -21,7 +21,7 @@ class DeleteSlateRequest 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 slate to be deleted, in the form of diff --git a/VideoStitcher/src/V1/DeleteVodConfigRequest.php b/VideoStitcher/src/V1/DeleteVodConfigRequest.php index 5e1a43c87621..a2432e058c66 100644 --- a/VideoStitcher/src/V1/DeleteVodConfigRequest.php +++ b/VideoStitcher/src/V1/DeleteVodConfigRequest.php @@ -21,7 +21,7 @@ class DeleteVodConfigRequest 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 VOD config to be deleted, in the form of diff --git a/VideoStitcher/src/V1/Event.php b/VideoStitcher/src/V1/Event.php index ce46fe5bae52..c9ea208c2db7 100644 --- a/VideoStitcher/src/V1/Event.php +++ b/VideoStitcher/src/V1/Event.php @@ -20,25 +20,25 @@ class Event extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.Event.EventType type = 1; */ - private $type = 0; + protected $type = 0; /** * The URI to trigger for this event. * * Generated from protobuf field string uri = 2; */ - private $uri = ''; + protected $uri = ''; /** * The ID of the event. * * Generated from protobuf field string id = 3; */ - private $id = ''; + protected $id = ''; /** * The offset in seconds if the event type is `PROGRESS`. * * Generated from protobuf field .google.protobuf.Duration offset = 4; */ - private $offset = null; + protected $offset = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/GamLiveConfig.php b/VideoStitcher/src/V1/GamLiveConfig.php index 12471c8f5d52..74a1dd80906a 100644 --- a/VideoStitcher/src/V1/GamLiveConfig.php +++ b/VideoStitcher/src/V1/GamLiveConfig.php @@ -20,19 +20,19 @@ class GamLiveConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_code = ''; + protected $network_code = ''; /** * Output only. The asset key identifier generated for the live config. * * Generated from protobuf field string asset_key = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $asset_key = ''; + protected $asset_key = ''; /** * Output only. The custom asset key identifier generated for the live config. * * Generated from protobuf field string custom_asset_key = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $custom_asset_key = ''; + protected $custom_asset_key = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/GamVodConfig.php b/VideoStitcher/src/V1/GamVodConfig.php index f8eda8cdd397..9b252aab9008 100644 --- a/VideoStitcher/src/V1/GamVodConfig.php +++ b/VideoStitcher/src/V1/GamVodConfig.php @@ -20,7 +20,7 @@ class GamVodConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_code = ''; + protected $network_code = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/Gapic/VideoStitcherServiceGapicClient.php b/VideoStitcher/src/V1/Gapic/VideoStitcherServiceGapicClient.php deleted file mode 100644 index 2a3f1efb28e5..000000000000 --- a/VideoStitcher/src/V1/Gapic/VideoStitcherServiceGapicClient.php +++ /dev/null @@ -1,2876 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $cdnKey = new CdnKey(); - * $cdnKeyId = 'cdn_key_id'; - * $operationResponse = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); - * $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 = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createCdnKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->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\Video\Stitcher\V1\Client\VideoStitcherServiceClient}. - */ -class VideoStitcherServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.video.stitcher.v1.VideoStitcherService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'videostitcher.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'videostitcher.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 $cdnKeyNameTemplate; - - private static $liveAdTagDetailNameTemplate; - - private static $liveConfigNameTemplate; - - private static $liveSessionNameTemplate; - - private static $locationNameTemplate; - - private static $slateNameTemplate; - - private static $vodAdTagDetailNameTemplate; - - private static $vodConfigNameTemplate; - - private static $vodSessionNameTemplate; - - private static $vodStitchDetailNameTemplate; - - 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/video_stitcher_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/video_stitcher_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/video_stitcher_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/video_stitcher_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getCdnKeyNameTemplate() - { - if (self::$cdnKeyNameTemplate == null) { - self::$cdnKeyNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/cdnKeys/{cdn_key}' - ); - } - - return self::$cdnKeyNameTemplate; - } - - private static function getLiveAdTagDetailNameTemplate() - { - if (self::$liveAdTagDetailNameTemplate == null) { - self::$liveAdTagDetailNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}' - ); - } - - return self::$liveAdTagDetailNameTemplate; - } - - private static function getLiveConfigNameTemplate() - { - if (self::$liveConfigNameTemplate == null) { - self::$liveConfigNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/liveConfigs/{live_config}' - ); - } - - return self::$liveConfigNameTemplate; - } - - private static function getLiveSessionNameTemplate() - { - if (self::$liveSessionNameTemplate == null) { - self::$liveSessionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/liveSessions/{live_session}' - ); - } - - return self::$liveSessionNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getSlateNameTemplate() - { - if (self::$slateNameTemplate == null) { - self::$slateNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/slates/{slate}' - ); - } - - return self::$slateNameTemplate; - } - - private static function getVodAdTagDetailNameTemplate() - { - if (self::$vodAdTagDetailNameTemplate == null) { - self::$vodAdTagDetailNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/vodSessions/{vod_session}/vodAdTagDetails/{vod_ad_tag_detail}' - ); - } - - return self::$vodAdTagDetailNameTemplate; - } - - private static function getVodConfigNameTemplate() - { - if (self::$vodConfigNameTemplate == null) { - self::$vodConfigNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/vodConfigs/{vod_config}' - ); - } - - return self::$vodConfigNameTemplate; - } - - private static function getVodSessionNameTemplate() - { - if (self::$vodSessionNameTemplate == null) { - self::$vodSessionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/vodSessions/{vod_session}' - ); - } - - return self::$vodSessionNameTemplate; - } - - private static function getVodStitchDetailNameTemplate() - { - if (self::$vodStitchDetailNameTemplate == null) { - self::$vodStitchDetailNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/vodSessions/{vod_session}/vodStitchDetails/{vod_stitch_detail}' - ); - } - - return self::$vodStitchDetailNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'cdnKey' => self::getCdnKeyNameTemplate(), - 'liveAdTagDetail' => self::getLiveAdTagDetailNameTemplate(), - 'liveConfig' => self::getLiveConfigNameTemplate(), - 'liveSession' => self::getLiveSessionNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'slate' => self::getSlateNameTemplate(), - 'vodAdTagDetail' => self::getVodAdTagDetailNameTemplate(), - 'vodConfig' => self::getVodConfigNameTemplate(), - 'vodSession' => self::getVodSessionNameTemplate(), - 'vodStitchDetail' => self::getVodStitchDetailNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a cdn_key - * resource. - * - * @param string $project - * @param string $location - * @param string $cdnKey - * - * @return string The formatted cdn_key resource. - */ - public static function cdnKeyName($project, $location, $cdnKey) - { - return self::getCdnKeyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'cdn_key' => $cdnKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * live_ad_tag_detail resource. - * - * @param string $project - * @param string $location - * @param string $liveSession - * @param string $liveAdTagDetail - * - * @return string The formatted live_ad_tag_detail resource. - */ - public static function liveAdTagDetailName( - $project, - $location, - $liveSession, - $liveAdTagDetail - ) { - return self::getLiveAdTagDetailNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'live_session' => $liveSession, - 'live_ad_tag_detail' => $liveAdTagDetail, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a live_config - * resource. - * - * @param string $project - * @param string $location - * @param string $liveConfig - * - * @return string The formatted live_config resource. - */ - public static function liveConfigName($project, $location, $liveConfig) - { - return self::getLiveConfigNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'live_config' => $liveConfig, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a live_session - * resource. - * - * @param string $project - * @param string $location - * @param string $liveSession - * - * @return string The formatted live_session resource. - */ - public static function liveSessionName($project, $location, $liveSession) - { - return self::getLiveSessionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'live_session' => $liveSession, - ]); - } - - /** - * 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 slate - * resource. - * - * @param string $project - * @param string $location - * @param string $slate - * - * @return string The formatted slate resource. - */ - public static function slateName($project, $location, $slate) - { - return self::getSlateNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'slate' => $slate, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * vod_ad_tag_detail resource. - * - * @param string $project - * @param string $location - * @param string $vodSession - * @param string $vodAdTagDetail - * - * @return string The formatted vod_ad_tag_detail resource. - */ - public static function vodAdTagDetailName( - $project, - $location, - $vodSession, - $vodAdTagDetail - ) { - return self::getVodAdTagDetailNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'vod_session' => $vodSession, - 'vod_ad_tag_detail' => $vodAdTagDetail, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a vod_config - * resource. - * - * @param string $project - * @param string $location - * @param string $vodConfig - * - * @return string The formatted vod_config resource. - */ - public static function vodConfigName($project, $location, $vodConfig) - { - return self::getVodConfigNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'vod_config' => $vodConfig, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a vod_session - * resource. - * - * @param string $project - * @param string $location - * @param string $vodSession - * - * @return string The formatted vod_session resource. - */ - public static function vodSessionName($project, $location, $vodSession) - { - return self::getVodSessionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'vod_session' => $vodSession, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * vod_stitch_detail resource. - * - * @param string $project - * @param string $location - * @param string $vodSession - * @param string $vodStitchDetail - * - * @return string The formatted vod_stitch_detail resource. - */ - public static function vodStitchDetailName( - $project, - $location, - $vodSession, - $vodStitchDetail - ) { - return self::getVodStitchDetailNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'vod_session' => $vodSession, - 'vod_stitch_detail' => $vodStitchDetail, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - cdnKey: projects/{project}/locations/{location}/cdnKeys/{cdn_key} - * - liveAdTagDetail: projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail} - * - liveConfig: projects/{project}/locations/{location}/liveConfigs/{live_config} - * - liveSession: projects/{project}/locations/{location}/liveSessions/{live_session} - * - location: projects/{project}/locations/{location} - * - slate: projects/{project}/locations/{location}/slates/{slate} - * - vodAdTagDetail: projects/{project}/locations/{location}/vodSessions/{vod_session}/vodAdTagDetails/{vod_ad_tag_detail} - * - vodConfig: projects/{project}/locations/{location}/vodConfigs/{vod_config} - * - vodSession: projects/{project}/locations/{location}/vodSessions/{vod_session} - * - vodStitchDetail: projects/{project}/locations/{location}/vodSessions/{vod_session}/vodStitchDetails/{vod_stitch_detail} - * - * 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 'videostitcher.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 CDN key. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $cdnKey = new CdnKey(); - * $cdnKeyId = 'cdn_key_id'; - * $operationResponse = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); - * $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 = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createCdnKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project in which the CDN key should be created, in the form - * of `projects/{project_number}/locations/{location}`. - * @param CdnKey $cdnKey Required. The CDN key resource to create. - * @param string $cdnKeyId Required. The ID to use for the CDN key, which will become the final - * component of the CDN key's resource name. - * - * This value should conform to RFC-1034, which restricts to - * lower-case letters, numbers, and hyphen, with the first character a - * letter, the last a letter or a number, and a 63 character maximum. - * @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 createCdnKey( - $parent, - $cdnKey, - $cdnKeyId, - array $optionalArgs = [] - ) { - $request = new CreateCdnKeyRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setCdnKey($cdnKey); - $request->setCdnKeyId($cdnKeyId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateCdnKey', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Registers the live config with the provided unique ID in - * the specified region. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $liveConfigId = 'live_config_id'; - * $liveConfig = new LiveConfig(); - * $operationResponse = $videoStitcherServiceClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); - * $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 = $videoStitcherServiceClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createLiveConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project in which the live config should be created, in - * the form of `projects/{project_number}/locations/{location}`. - * @param string $liveConfigId Required. The unique identifier ID to use for the live config. - * @param LiveConfig $liveConfig Required. The live config resource to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createLiveConfig( - $parent, - $liveConfigId, - $liveConfig, - array $optionalArgs = [] - ) { - $request = new CreateLiveConfigRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setLiveConfigId($liveConfigId); - $request->setLiveConfig($liveConfig); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateLiveConfig', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new live session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $liveSession = new LiveSession(); - * $response = $videoStitcherServiceClient->createLiveSession($formattedParent, $liveSession); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location in which the live session should be - * created, in the form of `projects/{project_number}/locations/{location}`. - * @param LiveSession $liveSession Required. Parameters for creating a live session. - * @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\Video\Stitcher\V1\LiveSession - * - * @throws ApiException if the remote call fails - */ - public function createLiveSession( - $parent, - $liveSession, - array $optionalArgs = [] - ) { - $request = new CreateLiveSessionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setLiveSession($liveSession); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateLiveSession', - LiveSession::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a slate. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $slateId = 'slate_id'; - * $slate = new Slate(); - * $operationResponse = $videoStitcherServiceClient->createSlate($formattedParent, $slateId, $slate); - * $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 = $videoStitcherServiceClient->createSlate($formattedParent, $slateId, $slate); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createSlate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project in which the slate should be created, in the form of - * `projects/{project_number}/locations/{location}`. - * @param string $slateId Required. The unique identifier for the slate. - * This value should conform to RFC-1034, which restricts to - * lower-case letters, numbers, and hyphen, with the first character a - * letter, the last a letter or a number, and a 63 character maximum. - * @param Slate $slate Required. The slate to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createSlate( - $parent, - $slateId, - $slate, - array $optionalArgs = [] - ) { - $request = new CreateSlateRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSlateId($slateId); - $request->setSlate($slate); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateSlate', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Registers the VOD config with the provided unique ID in - * the specified region. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $vodConfigId = 'vod_config_id'; - * $vodConfig = new VodConfig(); - * $operationResponse = $videoStitcherServiceClient->createVodConfig($formattedParent, $vodConfigId, $vodConfig); - * $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 = $videoStitcherServiceClient->createVodConfig($formattedParent, $vodConfigId, $vodConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createVodConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project in which the VOD config should be created, in - * the form of `projects/{project_number}/locations/{location}`. - * @param string $vodConfigId Required. The unique identifier ID to use for the VOD config. - * @param VodConfig $vodConfig Required. The VOD config resource to create. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported `(00000000-0000-0000-0000-000000000000)`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createVodConfig( - $parent, - $vodConfigId, - $vodConfig, - array $optionalArgs = [] - ) { - $request = new CreateVodConfigRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setVodConfigId($vodConfigId); - $request->setVodConfig($vodConfig); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateVodConfig', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a client side playback VOD session and returns the full - * tracking and playback metadata of the session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $vodSession = new VodSession(); - * $response = $videoStitcherServiceClient->createVodSession($formattedParent, $vodSession); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project and location in which the VOD session should be - * created, in the form of `projects/{project_number}/locations/{location}`. - * @param VodSession $vodSession Required. Parameters for creating a session. - * @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\Video\Stitcher\V1\VodSession - * - * @throws ApiException if the remote call fails - */ - public function createVodSession( - $parent, - $vodSession, - array $optionalArgs = [] - ) { - $request = new CreateVodSessionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setVodSession($vodSession); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateVodSession', - VodSession::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes the specified CDN key. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - * $operationResponse = $videoStitcherServiceClient->deleteCdnKey($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 = $videoStitcherServiceClient->deleteCdnKey($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteCdnKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the CDN key to be deleted, in the form of - * `projects/{project_number}/locations/{location}/cdnKeys/{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 deleteCdnKey($name, array $optionalArgs = []) - { - $request = new DeleteCdnKeyRequest(); - $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( - 'DeleteCdnKey', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes the specified live config. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - * $operationResponse = $videoStitcherServiceClient->deleteLiveConfig($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 = $videoStitcherServiceClient->deleteLiveConfig($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteLiveConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the live config to be deleted, in the form of - * `projects/{project_number}/locations/{location}/liveConfigs/{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 deleteLiveConfig($name, array $optionalArgs = []) - { - $request = new DeleteLiveConfigRequest(); - $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( - 'DeleteLiveConfig', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes the specified slate. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - * $operationResponse = $videoStitcherServiceClient->deleteSlate($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 = $videoStitcherServiceClient->deleteSlate($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteSlate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the slate to be deleted, in the form of - * `projects/{project_number}/locations/{location}/slates/{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 deleteSlate($name, array $optionalArgs = []) - { - $request = new DeleteSlateRequest(); - $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( - 'DeleteSlate', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes the specified VOD config. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - * $operationResponse = $videoStitcherServiceClient->deleteVodConfig($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 = $videoStitcherServiceClient->deleteVodConfig($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteVodConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the VOD config to be deleted, in the form of - * `projects/{project_number}/locations/{location}/vodConfigs/{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 deleteVodConfig($name, array $optionalArgs = []) - { - $request = new DeleteVodConfigRequest(); - $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( - 'DeleteVodConfig', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Returns the specified CDN key. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - * $response = $videoStitcherServiceClient->getCdnKey($formattedName); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the CDN key to be retrieved, in the form of - * `projects/{project}/locations/{location}/cdnKeys/{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\Video\Stitcher\V1\CdnKey - * - * @throws ApiException if the remote call fails - */ - public function getCdnKey($name, array $optionalArgs = []) - { - $request = new GetCdnKeyRequest(); - $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( - 'GetCdnKey', - CdnKey::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified ad tag detail for the specified live session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); - * $response = $videoStitcherServiceClient->getLiveAdTagDetail($formattedName); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name in the form of - * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_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\Video\Stitcher\V1\LiveAdTagDetail - * - * @throws ApiException if the remote call fails - */ - public function getLiveAdTagDetail($name, array $optionalArgs = []) - { - $request = new GetLiveAdTagDetailRequest(); - $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( - 'GetLiveAdTagDetail', - LiveAdTagDetail::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified live config managed by the Video - * Stitcher service. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - * $response = $videoStitcherServiceClient->getLiveConfig($formattedName); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the live config to be retrieved, in the form - * of - * `projects/{project_number}/locations/{location}/liveConfigs/{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\Video\Stitcher\V1\LiveConfig - * - * @throws ApiException if the remote call fails - */ - public function getLiveConfig($name, array $optionalArgs = []) - { - $request = new GetLiveConfigRequest(); - $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( - 'GetLiveConfig', - LiveConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the details for the specified live session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - * $response = $videoStitcherServiceClient->getLiveSession($formattedName); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the live session, in the form of - * `projects/{project_number}/locations/{location}/liveSessions/{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\Video\Stitcher\V1\LiveSession - * - * @throws ApiException if the remote call fails - */ - public function getLiveSession($name, array $optionalArgs = []) - { - $request = new GetLiveSessionRequest(); - $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( - 'GetLiveSession', - LiveSession::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified slate. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - * $response = $videoStitcherServiceClient->getSlate($formattedName); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the slate to be retrieved, of the slate, in the form - * of `projects/{project_number}/locations/{location}/slates/{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\Video\Stitcher\V1\Slate - * - * @throws ApiException if the remote call fails - */ - public function getSlate($name, array $optionalArgs = []) - { - $request = new GetSlateRequest(); - $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( - 'GetSlate', - Slate::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified ad tag detail for the specified VOD session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); - * $response = $videoStitcherServiceClient->getVodAdTagDetail($formattedName); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the ad tag detail for the specified VOD session, in - * the form of - * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_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\Video\Stitcher\V1\VodAdTagDetail - * - * @throws ApiException if the remote call fails - */ - public function getVodAdTagDetail($name, array $optionalArgs = []) - { - $request = new GetVodAdTagDetailRequest(); - $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( - 'GetVodAdTagDetail', - VodAdTagDetail::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified VOD config managed by the Video - * Stitcher API service. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - * $response = $videoStitcherServiceClient->getVodConfig($formattedName); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the VOD config to be retrieved, in the form - * of `projects/{project_number}/locations/{location}/vodConfigs/{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\Video\Stitcher\V1\VodConfig - * - * @throws ApiException if the remote call fails - */ - public function getVodConfig($name, array $optionalArgs = []) - { - $request = new GetVodConfigRequest(); - $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( - 'GetVodConfig', - VodConfig::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the full tracking, playback metadata, and relevant ad-ops - * logs for the specified VOD session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - * $response = $videoStitcherServiceClient->getVodSession($formattedName); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the VOD session to be retrieved, in the form of - * `projects/{project_number}/locations/{location}/vodSessions/{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\Video\Stitcher\V1\VodSession - * - * @throws ApiException if the remote call fails - */ - public function getVodSession($name, array $optionalArgs = []) - { - $request = new GetVodSessionRequest(); - $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( - 'GetVodSession', - VodSession::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the specified stitching information for the specified VOD session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedName = $videoStitcherServiceClient->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); - * $response = $videoStitcherServiceClient->getVodStitchDetail($formattedName); - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the stitch detail in the specified VOD session, in - * the form of - * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{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\Video\Stitcher\V1\VodStitchDetail - * - * @throws ApiException if the remote call fails - */ - public function getVodStitchDetail($name, array $optionalArgs = []) - { - $request = new GetVodStitchDetailRequest(); - $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( - 'GetVodStitchDetail', - VodStitchDetail::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists all CDN keys in the specified project and location. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $videoStitcherServiceClient->listCdnKeys($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $videoStitcherServiceClient->listCdnKeys($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project that contains the list of CDN keys, in the form of - * `projects/{project_number}/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 - * Filtering results - * @type string $orderBy - * Hint for how to order the 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 listCdnKeys($parent, array $optionalArgs = []) - { - $request = new ListCdnKeysRequest(); - $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( - 'ListCdnKeys', - $optionalArgs, - ListCdnKeysResponse::class, - $request - ); - } - - /** - * Return the list of ad tag details for the specified live session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - * // Iterate over pages of elements - * $pagedResponse = $videoStitcherServiceClient->listLiveAdTagDetails($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $videoStitcherServiceClient->listLiveAdTagDetails($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource parent in the form of - * `projects/{project}/locations/{location}/liveSessions/{live_session}`. - * @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 listLiveAdTagDetails($parent, array $optionalArgs = []) - { - $request = new ListLiveAdTagDetailsRequest(); - $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( - 'ListLiveAdTagDetails', - $optionalArgs, - ListLiveAdTagDetailsResponse::class, - $request - ); - } - - /** - * Lists all live configs managed by the Video Stitcher that - * belong to the specified project and region. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $videoStitcherServiceClient->listLiveConfigs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $videoStitcherServiceClient->listLiveConfigs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project that contains the list of live configs, in the - * form of `projects/{project_number}/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 - * Optional. The filter to apply to list results (see - * [Filtering](https://google.aip.dev/160)). - * @type string $orderBy - * Optional. Specifies the ordering of results following - * [Cloud API - * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_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 listLiveConfigs($parent, array $optionalArgs = []) - { - $request = new ListLiveConfigsRequest(); - $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( - 'ListLiveConfigs', - $optionalArgs, - ListLiveConfigsResponse::class, - $request - ); - } - - /** - * Lists all slates in the specified project and location. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $videoStitcherServiceClient->listSlates($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $videoStitcherServiceClient->listSlates($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project to list slates, in the form of - * `projects/{project_number}/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 - * Filtering results - * @type string $orderBy - * Hint for how to order the 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 listSlates($parent, array $optionalArgs = []) - { - $request = new ListSlatesRequest(); - $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( - 'ListSlates', - $optionalArgs, - ListSlatesResponse::class, - $request - ); - } - - /** - * Return the list of ad tag details for the specified VOD session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - * // Iterate over pages of elements - * $pagedResponse = $videoStitcherServiceClient->listVodAdTagDetails($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $videoStitcherServiceClient->listVodAdTagDetails($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The VOD session which the ad tag details belong to, in the form - * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. - * @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 listVodAdTagDetails($parent, array $optionalArgs = []) - { - $request = new ListVodAdTagDetailsRequest(); - $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( - 'ListVodAdTagDetails', - $optionalArgs, - ListVodAdTagDetailsResponse::class, - $request - ); - } - - /** - * Lists all VOD configs managed by the Video Stitcher API that - * belong to the specified project and region. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $videoStitcherServiceClient->listVodConfigs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $videoStitcherServiceClient->listVodConfigs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project that contains the list of VOD configs, in the - * form of `projects/{project_number}/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 - * Optional. The filter to apply to list results (see - * [Filtering](https://google.aip.dev/160)). - * @type string $orderBy - * Optional. Specifies the ordering of results following - * [Cloud API - * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_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 listVodConfigs($parent, array $optionalArgs = []) - { - $request = new ListVodConfigsRequest(); - $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( - 'ListVodConfigs', - $optionalArgs, - ListVodConfigsResponse::class, - $request - ); - } - - /** - * Returns a list of detailed stitching information of the specified VOD - * session. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $formattedParent = $videoStitcherServiceClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - * // Iterate over pages of elements - * $pagedResponse = $videoStitcherServiceClient->listVodStitchDetails($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $videoStitcherServiceClient->listVodStitchDetails($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The VOD session where the stitch details belong to, in the form - * of `projects/{project}/locations/{location}/vodSessions/{id}`. - * @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 listVodStitchDetails($parent, array $optionalArgs = []) - { - $request = new ListVodStitchDetailsRequest(); - $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( - 'ListVodStitchDetails', - $optionalArgs, - ListVodStitchDetailsResponse::class, - $request - ); - } - - /** - * Updates the specified CDN key. Only update fields specified - * in the call method body. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $cdnKey = new CdnKey(); - * $updateMask = new FieldMask(); - * $operationResponse = $videoStitcherServiceClient->updateCdnKey($cdnKey, $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 = $videoStitcherServiceClient->updateCdnKey($cdnKey, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'updateCdnKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param CdnKey $cdnKey Required. The CDN key resource which replaces the resource on the server. - * @param FieldMask $updateMask Required. The update mask applies to the resource. - * For the `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/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 updateCdnKey($cdnKey, $updateMask, array $optionalArgs = []) - { - $request = new UpdateCdnKeyRequest(); - $requestParamHeaders = []; - $request->setCdnKey($cdnKey); - $request->setUpdateMask($updateMask); - $requestParamHeaders['cdn_key.name'] = $cdnKey->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateCdnKey', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the specified LiveConfig. Only update fields specified - * in the call method body. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $liveConfig = new LiveConfig(); - * $updateMask = new FieldMask(); - * $operationResponse = $videoStitcherServiceClient->updateLiveConfig($liveConfig, $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 = $videoStitcherServiceClient->updateLiveConfig($liveConfig, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'updateLiveConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param LiveConfig $liveConfig Required. The LiveConfig resource which replaces the resource on the - * server. - * @param FieldMask $updateMask Required. The update mask applies to the resource. - * For the `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/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 updateLiveConfig( - $liveConfig, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateLiveConfigRequest(); - $requestParamHeaders = []; - $request->setLiveConfig($liveConfig); - $request->setUpdateMask($updateMask); - $requestParamHeaders['live_config.name'] = $liveConfig->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateLiveConfig', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the specified slate. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $slate = new Slate(); - * $updateMask = new FieldMask(); - * $operationResponse = $videoStitcherServiceClient->updateSlate($slate, $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 = $videoStitcherServiceClient->updateSlate($slate, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'updateSlate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param Slate $slate Required. The resource with updated fields. - * @param FieldMask $updateMask Required. The update mask which specifies fields which should be updated. - * @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 updateSlate($slate, $updateMask, array $optionalArgs = []) - { - $request = new UpdateSlateRequest(); - $requestParamHeaders = []; - $request->setSlate($slate); - $request->setUpdateMask($updateMask); - $requestParamHeaders['slate.name'] = $slate->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateSlate', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the specified VOD config. Only update fields specified - * in the call method body. - * - * Sample code: - * ``` - * $videoStitcherServiceClient = new VideoStitcherServiceClient(); - * try { - * $vodConfig = new VodConfig(); - * $updateMask = new FieldMask(); - * $operationResponse = $videoStitcherServiceClient->updateVodConfig($vodConfig, $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 = $videoStitcherServiceClient->updateVodConfig($vodConfig, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'updateVodConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $videoStitcherServiceClient->close(); - * } - * ``` - * - * @param VodConfig $vodConfig Required. The VOD config resource which replaces the resource on the - * server. - * @param FieldMask $updateMask Required. The update mask applies to the resource. - * For the `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/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 updateVodConfig( - $vodConfig, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateVodConfigRequest(); - $requestParamHeaders = []; - $request->setVodConfig($vodConfig); - $request->setUpdateMask($updateMask); - $requestParamHeaders['vod_config.name'] = $vodConfig->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateVodConfig', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } -} diff --git a/VideoStitcher/src/V1/GetCdnKeyRequest.php b/VideoStitcher/src/V1/GetCdnKeyRequest.php index f78de1642919..60883c4c2bcb 100644 --- a/VideoStitcher/src/V1/GetCdnKeyRequest.php +++ b/VideoStitcher/src/V1/GetCdnKeyRequest.php @@ -21,7 +21,7 @@ class GetCdnKeyRequest 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 CDN key to be retrieved, in the form of diff --git a/VideoStitcher/src/V1/GetLiveAdTagDetailRequest.php b/VideoStitcher/src/V1/GetLiveAdTagDetailRequest.php index 5bd3a1300331..0bb9510c90d2 100644 --- a/VideoStitcher/src/V1/GetLiveAdTagDetailRequest.php +++ b/VideoStitcher/src/V1/GetLiveAdTagDetailRequest.php @@ -21,7 +21,7 @@ class GetLiveAdTagDetailRequest 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 in the form of diff --git a/VideoStitcher/src/V1/GetLiveConfigRequest.php b/VideoStitcher/src/V1/GetLiveConfigRequest.php index 7dbf9566b48e..903077856948 100644 --- a/VideoStitcher/src/V1/GetLiveConfigRequest.php +++ b/VideoStitcher/src/V1/GetLiveConfigRequest.php @@ -22,7 +22,7 @@ class GetLiveConfigRequest 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 live config to be retrieved, in the form diff --git a/VideoStitcher/src/V1/GetLiveSessionRequest.php b/VideoStitcher/src/V1/GetLiveSessionRequest.php index d88b2d2e390e..a3ba9f66b9a9 100644 --- a/VideoStitcher/src/V1/GetLiveSessionRequest.php +++ b/VideoStitcher/src/V1/GetLiveSessionRequest.php @@ -21,7 +21,7 @@ class GetLiveSessionRequest 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 live session, in the form of diff --git a/VideoStitcher/src/V1/GetSlateRequest.php b/VideoStitcher/src/V1/GetSlateRequest.php index d5957f235281..220a34dfa77c 100644 --- a/VideoStitcher/src/V1/GetSlateRequest.php +++ b/VideoStitcher/src/V1/GetSlateRequest.php @@ -21,7 +21,7 @@ class GetSlateRequest 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 slate to be retrieved, of the slate, in the form diff --git a/VideoStitcher/src/V1/GetVodAdTagDetailRequest.php b/VideoStitcher/src/V1/GetVodAdTagDetailRequest.php index 3aa557f76085..b3f841410af0 100644 --- a/VideoStitcher/src/V1/GetVodAdTagDetailRequest.php +++ b/VideoStitcher/src/V1/GetVodAdTagDetailRequest.php @@ -22,7 +22,7 @@ class GetVodAdTagDetailRequest 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 ad tag detail for the specified VOD session, in diff --git a/VideoStitcher/src/V1/GetVodConfigRequest.php b/VideoStitcher/src/V1/GetVodConfigRequest.php index e3bed866ffd4..961a43a3606e 100644 --- a/VideoStitcher/src/V1/GetVodConfigRequest.php +++ b/VideoStitcher/src/V1/GetVodConfigRequest.php @@ -21,7 +21,7 @@ class GetVodConfigRequest 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 VOD config to be retrieved, in the form diff --git a/VideoStitcher/src/V1/GetVodSessionRequest.php b/VideoStitcher/src/V1/GetVodSessionRequest.php index 16f44a83b203..523db81a33c9 100644 --- a/VideoStitcher/src/V1/GetVodSessionRequest.php +++ b/VideoStitcher/src/V1/GetVodSessionRequest.php @@ -21,7 +21,7 @@ class GetVodSessionRequest 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 VOD session to be retrieved, in the form of diff --git a/VideoStitcher/src/V1/GetVodStitchDetailRequest.php b/VideoStitcher/src/V1/GetVodStitchDetailRequest.php index 0c9eeaf552e0..019ccfb7cd94 100644 --- a/VideoStitcher/src/V1/GetVodStitchDetailRequest.php +++ b/VideoStitcher/src/V1/GetVodStitchDetailRequest.php @@ -22,7 +22,7 @@ class GetVodStitchDetailRequest 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 stitch detail in the specified VOD session, in diff --git a/VideoStitcher/src/V1/GoogleCdnKey.php b/VideoStitcher/src/V1/GoogleCdnKey.php index ec977f7b5e9d..afa7b822bf12 100644 --- a/VideoStitcher/src/V1/GoogleCdnKey.php +++ b/VideoStitcher/src/V1/GoogleCdnKey.php @@ -20,13 +20,13 @@ class GoogleCdnKey extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes private_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; */ - private $private_key = ''; + protected $private_key = ''; /** * The public name of the Google Cloud CDN key. * * Generated from protobuf field string key_name = 2; */ - private $key_name = ''; + protected $key_name = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/HtmlAdResource.php b/VideoStitcher/src/V1/HtmlAdResource.php index 747e9d788884..3e45e33af960 100644 --- a/VideoStitcher/src/V1/HtmlAdResource.php +++ b/VideoStitcher/src/V1/HtmlAdResource.php @@ -20,7 +20,7 @@ class HtmlAdResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string html_source = 1; */ - private $html_source = ''; + protected $html_source = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/IframeAdResource.php b/VideoStitcher/src/V1/IframeAdResource.php index a9c1819811d7..3251ce7c39b3 100644 --- a/VideoStitcher/src/V1/IframeAdResource.php +++ b/VideoStitcher/src/V1/IframeAdResource.php @@ -20,7 +20,7 @@ class IframeAdResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 1; */ - private $uri = ''; + protected $uri = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/Interstitials.php b/VideoStitcher/src/V1/Interstitials.php index f6b8093605ac..11acfce74a28 100644 --- a/VideoStitcher/src/V1/Interstitials.php +++ b/VideoStitcher/src/V1/Interstitials.php @@ -26,7 +26,7 @@ class Interstitials extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSessionContent session_content = 2; */ - private $session_content = null; + protected $session_content = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/ListCdnKeysRequest.php b/VideoStitcher/src/V1/ListCdnKeysRequest.php index 4c7932ca3de9..18c76416ec3f 100644 --- a/VideoStitcher/src/V1/ListCdnKeysRequest.php +++ b/VideoStitcher/src/V1/ListCdnKeysRequest.php @@ -21,32 +21,32 @@ class ListCdnKeysRequest 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 = ''; /** * Requested page size. Server may return fewer items than requested. * If unspecified, server will pick an appropriate default. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A token identifying a page of results the server should return. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * Filtering results * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Hint for how to order the results * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The project that contains the list of CDN keys, in the form of diff --git a/VideoStitcher/src/V1/ListCdnKeysResponse.php b/VideoStitcher/src/V1/ListCdnKeysResponse.php index 1a07cb54a6ce..fdb7d35e26a0 100644 --- a/VideoStitcher/src/V1/ListCdnKeysResponse.php +++ b/VideoStitcher/src/V1/ListCdnKeysResponse.php @@ -26,7 +26,7 @@ class ListCdnKeysResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/VideoStitcher/src/V1/ListLiveAdTagDetailsRequest.php b/VideoStitcher/src/V1/ListLiveAdTagDetailsRequest.php index f96388f33907..d14bea8f5f75 100644 --- a/VideoStitcher/src/V1/ListLiveAdTagDetailsRequest.php +++ b/VideoStitcher/src/V1/ListLiveAdTagDetailsRequest.php @@ -21,19 +21,19 @@ class ListLiveAdTagDetailsRequest 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 items to return. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The pagination token returned from a previous List request. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The resource parent in the form of diff --git a/VideoStitcher/src/V1/ListLiveAdTagDetailsResponse.php b/VideoStitcher/src/V1/ListLiveAdTagDetailsResponse.php index 505d5de93344..934491dee650 100644 --- a/VideoStitcher/src/V1/ListLiveAdTagDetailsResponse.php +++ b/VideoStitcher/src/V1/ListLiveAdTagDetailsResponse.php @@ -26,7 +26,7 @@ class ListLiveAdTagDetailsResponse 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/VideoStitcher/src/V1/ListLiveConfigsRequest.php b/VideoStitcher/src/V1/ListLiveConfigsRequest.php index 0ce2387ce32f..d45ae42d9d2d 100644 --- a/VideoStitcher/src/V1/ListLiveConfigsRequest.php +++ b/VideoStitcher/src/V1/ListLiveConfigsRequest.php @@ -21,26 +21,26 @@ class ListLiveConfigsRequest 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 items to return. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The next_page_token value returned from a previous List request, if any. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter to apply to list results (see * [Filtering](https://google.aip.dev/160)). * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Specifies the ordering of results following * [Cloud API @@ -48,7 +48,7 @@ class ListLiveConfigsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The project that contains the list of live configs, in the diff --git a/VideoStitcher/src/V1/ListLiveConfigsResponse.php b/VideoStitcher/src/V1/ListLiveConfigsResponse.php index 8c94daf2ba9c..1eae2969f2b1 100644 --- a/VideoStitcher/src/V1/ListLiveConfigsResponse.php +++ b/VideoStitcher/src/V1/ListLiveConfigsResponse.php @@ -26,7 +26,7 @@ class ListLiveConfigsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/VideoStitcher/src/V1/ListSlatesRequest.php b/VideoStitcher/src/V1/ListSlatesRequest.php index 95f26c7b6eca..7c24832d2b8a 100644 --- a/VideoStitcher/src/V1/ListSlatesRequest.php +++ b/VideoStitcher/src/V1/ListSlatesRequest.php @@ -21,32 +21,32 @@ class ListSlatesRequest 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 = ''; /** * Requested page size. Server may return fewer items than requested. * If unspecified, server will pick an appropriate default. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A token identifying a page of results the server should return. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * Filtering results * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Hint for how to order the results * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The project to list slates, in the form of diff --git a/VideoStitcher/src/V1/ListSlatesResponse.php b/VideoStitcher/src/V1/ListSlatesResponse.php index 10b5d48c58ef..d66e458e1618 100644 --- a/VideoStitcher/src/V1/ListSlatesResponse.php +++ b/VideoStitcher/src/V1/ListSlatesResponse.php @@ -26,7 +26,7 @@ class ListSlatesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/VideoStitcher/src/V1/ListVodAdTagDetailsRequest.php b/VideoStitcher/src/V1/ListVodAdTagDetailsRequest.php index 0374515917d0..a2f4d620fe34 100644 --- a/VideoStitcher/src/V1/ListVodAdTagDetailsRequest.php +++ b/VideoStitcher/src/V1/ListVodAdTagDetailsRequest.php @@ -21,19 +21,19 @@ class ListVodAdTagDetailsRequest 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 items to return. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The next_page_token value returned from a previous List request, if any. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The VOD session which the ad tag details belong to, in the form diff --git a/VideoStitcher/src/V1/ListVodAdTagDetailsResponse.php b/VideoStitcher/src/V1/ListVodAdTagDetailsResponse.php index 6c15f3864499..47ccb4edaccb 100644 --- a/VideoStitcher/src/V1/ListVodAdTagDetailsResponse.php +++ b/VideoStitcher/src/V1/ListVodAdTagDetailsResponse.php @@ -26,7 +26,7 @@ class ListVodAdTagDetailsResponse 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/VideoStitcher/src/V1/ListVodConfigsRequest.php b/VideoStitcher/src/V1/ListVodConfigsRequest.php index ed3e6be0f314..62a6511ad13d 100644 --- a/VideoStitcher/src/V1/ListVodConfigsRequest.php +++ b/VideoStitcher/src/V1/ListVodConfigsRequest.php @@ -21,27 +21,27 @@ class ListVodConfigsRequest 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 maximum number of items to return. * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. The next_page_token value returned from a previous List request, * if any. * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter to apply to list results (see * [Filtering](https://google.aip.dev/160)). * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Specifies the ordering of results following * [Cloud API @@ -49,7 +49,7 @@ class ListVodConfigsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The project that contains the list of VOD configs, in the diff --git a/VideoStitcher/src/V1/ListVodConfigsResponse.php b/VideoStitcher/src/V1/ListVodConfigsResponse.php index b6c364323967..53f656d03a7e 100644 --- a/VideoStitcher/src/V1/ListVodConfigsResponse.php +++ b/VideoStitcher/src/V1/ListVodConfigsResponse.php @@ -26,7 +26,7 @@ class ListVodConfigsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/VideoStitcher/src/V1/ListVodStitchDetailsRequest.php b/VideoStitcher/src/V1/ListVodStitchDetailsRequest.php index 02607583ec59..03a33b3b21dc 100644 --- a/VideoStitcher/src/V1/ListVodStitchDetailsRequest.php +++ b/VideoStitcher/src/V1/ListVodStitchDetailsRequest.php @@ -21,19 +21,19 @@ class ListVodStitchDetailsRequest 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 items to return. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The next_page_token value returned from a previous List request, if any. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The VOD session where the stitch details belong to, in the form diff --git a/VideoStitcher/src/V1/ListVodStitchDetailsResponse.php b/VideoStitcher/src/V1/ListVodStitchDetailsResponse.php index c0fd764364e4..202317ab5600 100644 --- a/VideoStitcher/src/V1/ListVodStitchDetailsResponse.php +++ b/VideoStitcher/src/V1/ListVodStitchDetailsResponse.php @@ -26,7 +26,7 @@ class ListVodStitchDetailsResponse 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/VideoStitcher/src/V1/LiveAdTagDetail.php b/VideoStitcher/src/V1/LiveAdTagDetail.php index 6a3f5b360ead..ec8d74fb88a1 100644 --- a/VideoStitcher/src/V1/LiveAdTagDetail.php +++ b/VideoStitcher/src/V1/LiveAdTagDetail.php @@ -23,7 +23,7 @@ class LiveAdTagDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * A list of ad requests. * diff --git a/VideoStitcher/src/V1/LiveConfig.php b/VideoStitcher/src/V1/LiveConfig.php index 8ece7cabf2ef..6428b9a34747 100644 --- a/VideoStitcher/src/V1/LiveConfig.php +++ b/VideoStitcher/src/V1/LiveConfig.php @@ -21,38 +21,38 @@ class LiveConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. Source URI for the live stream manifest. * * Generated from protobuf field string source_uri = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $source_uri = ''; + protected $source_uri = ''; /** * The default ad tag associated with this live stream config. * * Generated from protobuf field string ad_tag_uri = 3; */ - private $ad_tag_uri = ''; + protected $ad_tag_uri = ''; /** * Additional metadata used to register a live stream with Google Ad Manager * (GAM) * * Generated from protobuf field .google.cloud.video.stitcher.v1.GamLiveConfig gam_live_config = 4; */ - private $gam_live_config = null; + protected $gam_live_config = null; /** * Output only. State of the live config. * * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Required. Determines how the ads are tracked. * * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $ad_tracking = 0; + protected $ad_tracking = 0; /** * This must refer to a slate in the same * project. If Google Ad Manager (GAM) is used for ads, this string sets the @@ -61,26 +61,26 @@ class LiveConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string default_slate = 7 [(.google.api.resource_reference) = { */ - private $default_slate = ''; + protected $default_slate = ''; /** * Defines the stitcher behavior in case an ad does not align exactly with * the ad break boundaries. If not specified, the default is `CUT_CURRENT`. * * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.StitchingPolicy stitching_policy = 8; */ - private $stitching_policy = 0; + protected $stitching_policy = 0; /** * The configuration for prefetching ads. * * Generated from protobuf field .google.cloud.video.stitcher.v1.PrefetchConfig prefetch_config = 10; */ - private $prefetch_config = null; + protected $prefetch_config = null; /** * Options for fetching source manifests and segments. * * Generated from protobuf field .google.cloud.video.stitcher.v1.FetchOptions source_fetch_options = 16; */ - private $source_fetch_options = null; + protected $source_fetch_options = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/LiveSession.php b/VideoStitcher/src/V1/LiveSession.php index e83def9fcfc6..4d38c6dd0188 100644 --- a/VideoStitcher/src/V1/LiveSession.php +++ b/VideoStitcher/src/V1/LiveSession.php @@ -22,13 +22,13 @@ class LiveSession 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 URI to play the live session's ad-stitched stream. * * Generated from protobuf field string play_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $play_uri = ''; + protected $play_uri = ''; /** * Key value pairs for ad tag macro replacement, only available for live * sessions that do not implement Google Ad manager ad insertion. If the @@ -48,28 +48,28 @@ class LiveSession extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 10; */ - private $manifest_options = null; + protected $manifest_options = null; /** * This field should be set with appropriate values if GAM is being used for * ads. * * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings gam_settings = 15; */ - private $gam_settings = null; + protected $gam_settings = null; /** * Required. The resource name of the live config for this session, in the * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. * * Generated from protobuf field string live_config = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $live_config = ''; + protected $live_config = ''; /** * Determines how the ad should be tracked. This overrides the value set in * the live config for this session. * * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 17; */ - private $ad_tracking = 0; + protected $ad_tracking = 0; /** * Constructor. diff --git a/VideoStitcher/src/V1/LiveSession/GamSettings.php b/VideoStitcher/src/V1/LiveSession/GamSettings.php index 6b5eb6fd5af0..6f5396b6a980 100644 --- a/VideoStitcher/src/V1/LiveSession/GamSettings.php +++ b/VideoStitcher/src/V1/LiveSession/GamSettings.php @@ -21,7 +21,7 @@ class GamSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string stream_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $stream_id = ''; + protected $stream_id = ''; /** * [Targeting * parameters](https://support.google.com/admanager/answer/7320899) to send diff --git a/VideoStitcher/src/V1/LiveSession/GamSettings/GamDash.php b/VideoStitcher/src/V1/LiveSession/GamSettings/GamDash.php deleted file mode 100644 index 62f210feac4f..000000000000 --- a/VideoStitcher/src/V1/LiveSession/GamSettings/GamDash.php +++ /dev/null @@ -1,69 +0,0 @@ -google.cloud.video.stitcher.v1.LiveSession.GamSettings.GamDash - */ -class GamDash extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session template url by Ad Manager for DASH periods. - * - * Generated from protobuf field string period_template_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - private $period_template_uri = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $period_template_uri - * Required. The session template url by Ad Manager for DASH periods. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session template url by Ad Manager for DASH periods. - * - * Generated from protobuf field string period_template_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getPeriodTemplateUri() - { - return $this->period_template_uri; - } - - /** - * Required. The session template url by Ad Manager for DASH periods. - * - * Generated from protobuf field string period_template_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setPeriodTemplateUri($var) - { - GPBUtil::checkString($var, True); - $this->period_template_uri = $var; - - return $this; - } - -} - - diff --git a/VideoStitcher/src/V1/LiveSession/GamSettings/GamHls.php b/VideoStitcher/src/V1/LiveSession/GamSettings/GamHls.php deleted file mode 100644 index fb36797a1239..000000000000 --- a/VideoStitcher/src/V1/LiveSession/GamSettings/GamHls.php +++ /dev/null @@ -1,35 +0,0 @@ -google.cloud.video.stitcher.v1.LiveSession.GamSettings.GamHls - */ -class GamHls extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); - parent::__construct($data); - } - -} - - diff --git a/VideoStitcher/src/V1/LiveSession/StitchingPolicy.php b/VideoStitcher/src/V1/LiveSession/StitchingPolicy.php deleted file mode 100644 index 64a8eabfea93..000000000000 --- a/VideoStitcher/src/V1/LiveSession/StitchingPolicy.php +++ /dev/null @@ -1,63 +0,0 @@ -google.cloud.video.stitcher.v1.LiveSession.StitchingPolicy - */ -class StitchingPolicy -{ - /** - * Stitching policy is not specified. - * - * Generated from protobuf enum STITCHING_POLICY_UNSPECIFIED = 0; - */ - const STITCHING_POLICY_UNSPECIFIED = 0; - /** - * Finishes stitching the current ad before returning to content. - * - * Generated from protobuf enum COMPLETE_AD = 1; - */ - const COMPLETE_AD = 1; - /** - * Cuts an ad short and returns to content in the middle of the ad. - * - * Generated from protobuf enum CUT_CURRENT = 3; - */ - const CUT_CURRENT = 3; - - private static $valueToName = [ - self::STITCHING_POLICY_UNSPECIFIED => 'STITCHING_POLICY_UNSPECIFIED', - self::COMPLETE_AD => 'COMPLETE_AD', - self::CUT_CURRENT => 'CUT_CURRENT', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - - diff --git a/VideoStitcher/src/V1/ManifestOptions.php b/VideoStitcher/src/V1/ManifestOptions.php index 9a08498b6f80..27590ff366b0 100644 --- a/VideoStitcher/src/V1/ManifestOptions.php +++ b/VideoStitcher/src/V1/ManifestOptions.php @@ -28,7 +28,7 @@ class ManifestOptions extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions.OrderPolicy bitrate_order = 2; */ - private $bitrate_order = 0; + protected $bitrate_order = 0; /** * Constructor. diff --git a/VideoStitcher/src/V1/MediaCdnKey.php b/VideoStitcher/src/V1/MediaCdnKey.php index d2d386fb23aa..314895c575f6 100644 --- a/VideoStitcher/src/V1/MediaCdnKey.php +++ b/VideoStitcher/src/V1/MediaCdnKey.php @@ -20,20 +20,20 @@ class MediaCdnKey extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes private_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; */ - private $private_key = ''; + protected $private_key = ''; /** * The keyset name of the Media CDN key. * * Generated from protobuf field string key_name = 2; */ - private $key_name = ''; + protected $key_name = ''; /** * Optional. If set, the URL will be signed using the Media CDN token. * Otherwise, the URL would be signed using the standard Media CDN signature. * * Generated from protobuf field .google.cloud.video.stitcher.v1.MediaCdnKey.TokenConfig token_config = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $token_config = null; + protected $token_config = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/MediaCdnKey/TokenConfig.php b/VideoStitcher/src/V1/MediaCdnKey/TokenConfig.php index df552d0ab8d2..1a5f754d25ab 100644 --- a/VideoStitcher/src/V1/MediaCdnKey/TokenConfig.php +++ b/VideoStitcher/src/V1/MediaCdnKey/TokenConfig.php @@ -25,7 +25,7 @@ class TokenConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string query_parameter = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $query_parameter = ''; + protected $query_parameter = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/OperationMetadata.php b/VideoStitcher/src/V1/OperationMetadata.php index 0f87006b86ec..59afa335e40b 100644 --- a/VideoStitcher/src/V1/OperationMetadata.php +++ b/VideoStitcher/src/V1/OperationMetadata.php @@ -20,25 +20,25 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; */ - private $create_time = null; + protected $create_time = null; /** * The time the operation finished running. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; */ - private $end_time = null; + protected $end_time = null; /** * Server-defined resource path for the target of the operation. * * Generated from protobuf field string target = 3; */ - private $target = ''; + protected $target = ''; /** * Name of the verb executed by the operation. * * Generated from protobuf field string verb = 4; */ - private $verb = ''; + protected $verb = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/PrefetchConfig.php b/VideoStitcher/src/V1/PrefetchConfig.php index 16ca493de4e2..5a3e14be9089 100644 --- a/VideoStitcher/src/V1/PrefetchConfig.php +++ b/VideoStitcher/src/V1/PrefetchConfig.php @@ -20,7 +20,7 @@ class PrefetchConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enabled = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $enabled = false; + protected $enabled = false; /** * The duration in seconds of the part of the break to be prefetched. * This field is only relevant if prefetch is enabled. @@ -31,7 +31,7 @@ class PrefetchConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration initial_ad_request_duration = 2; */ - private $initial_ad_request_duration = null; + protected $initial_ad_request_duration = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/ProgressEvent.php b/VideoStitcher/src/V1/ProgressEvent.php index c2dba5491de7..e1b9852ccb27 100644 --- a/VideoStitcher/src/V1/ProgressEvent.php +++ b/VideoStitcher/src/V1/ProgressEvent.php @@ -22,7 +22,7 @@ class ProgressEvent extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration time_offset = 1; */ - private $time_offset = null; + protected $time_offset = null; /** * The list of progress tracking events for the ad break. These can be of * the following IAB types: `BREAK_START`, `BREAK_END`, `IMPRESSION`, diff --git a/VideoStitcher/src/V1/RenditionFilter.php b/VideoStitcher/src/V1/RenditionFilter.php index ce59834167df..0d12d8ea104e 100644 --- a/VideoStitcher/src/V1/RenditionFilter.php +++ b/VideoStitcher/src/V1/RenditionFilter.php @@ -21,14 +21,14 @@ class RenditionFilter extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 bitrate_bps = 1; */ - private $bitrate_bps = 0; + protected $bitrate_bps = 0; /** * Codecs for the rendition. If set, only renditions with the exact value * will match. * * Generated from protobuf field string codecs = 2; */ - private $codecs = ''; + protected $codecs = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/RequestMetadata.php b/VideoStitcher/src/V1/RequestMetadata.php index 59a7b03083bf..cf958970e04e 100644 --- a/VideoStitcher/src/V1/RequestMetadata.php +++ b/VideoStitcher/src/V1/RequestMetadata.php @@ -20,7 +20,7 @@ class RequestMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Struct headers = 1; */ - private $headers = null; + protected $headers = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/ResponseMetadata.php b/VideoStitcher/src/V1/ResponseMetadata.php index 725f9ba8606e..9996433d98a0 100644 --- a/VideoStitcher/src/V1/ResponseMetadata.php +++ b/VideoStitcher/src/V1/ResponseMetadata.php @@ -20,37 +20,37 @@ class ResponseMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string error = 1; */ - private $error = ''; + protected $error = ''; /** * Headers from the response. * * Generated from protobuf field .google.protobuf.Struct headers = 2; */ - private $headers = null; + protected $headers = null; /** * Status code for the response. * * Generated from protobuf field string status_code = 3; */ - private $status_code = ''; + protected $status_code = ''; /** * Size in bytes of the response. * * Generated from protobuf field int32 size_bytes = 4; */ - private $size_bytes = 0; + protected $size_bytes = 0; /** * Total time elapsed for the response. * * Generated from protobuf field .google.protobuf.Duration duration = 5; */ - private $duration = null; + protected $duration = null; /** * The body of the response. * * Generated from protobuf field string body = 6; */ - private $body = ''; + protected $body = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/Slate.php b/VideoStitcher/src/V1/Slate.php index f63a7810d230..ffa5a67fc3f1 100644 --- a/VideoStitcher/src/V1/Slate.php +++ b/VideoStitcher/src/V1/Slate.php @@ -21,20 +21,20 @@ class Slate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * The URI to fetch the source content for the slate. This URI must return an * MP4 video with at least one audio track. * * Generated from protobuf field string uri = 2; */ - private $uri = ''; + protected $uri = ''; /** * gam_slate has all the GAM-related attributes of slates. * * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate.GamSlate gam_slate = 3; */ - private $gam_slate = null; + protected $gam_slate = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/Slate/GamSlate.php b/VideoStitcher/src/V1/Slate/GamSlate.php index 25221535b436..1fed410e4891 100644 --- a/VideoStitcher/src/V1/Slate/GamSlate.php +++ b/VideoStitcher/src/V1/Slate/GamSlate.php @@ -21,13 +21,13 @@ class GamSlate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_code = ''; + protected $network_code = ''; /** * Output only. The identifier generated for the slate by GAM. * * Generated from protobuf field int64 gam_slate_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $gam_slate_id = 0; + protected $gam_slate_id = 0; /** * Constructor. diff --git a/VideoStitcher/src/V1/StaticAdResource.php b/VideoStitcher/src/V1/StaticAdResource.php index c28174156182..c52ed06d37cf 100644 --- a/VideoStitcher/src/V1/StaticAdResource.php +++ b/VideoStitcher/src/V1/StaticAdResource.php @@ -20,13 +20,13 @@ class StaticAdResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 1; */ - private $uri = ''; + protected $uri = ''; /** * Describes the MIME type of the ad resource. * * Generated from protobuf field string creative_type = 2; */ - private $creative_type = ''; + protected $creative_type = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/UpdateCdnKeyRequest.php b/VideoStitcher/src/V1/UpdateCdnKeyRequest.php index cc9ebd244576..b3f90236908c 100644 --- a/VideoStitcher/src/V1/UpdateCdnKeyRequest.php +++ b/VideoStitcher/src/V1/UpdateCdnKeyRequest.php @@ -20,7 +20,7 @@ class UpdateCdnKeyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.CdnKey cdn_key = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $cdn_key = null; + protected $cdn_key = null; /** * Required. The update mask applies to the resource. * For the `FieldMask` definition, see @@ -28,7 +28,7 @@ class UpdateCdnKeyRequest 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\Video\Stitcher\V1\CdnKey $cdnKey Required. The CDN key resource which replaces the resource on the server. diff --git a/VideoStitcher/src/V1/UpdateLiveConfigRequest.php b/VideoStitcher/src/V1/UpdateLiveConfigRequest.php index 30582f6f5281..8ac5eda08787 100644 --- a/VideoStitcher/src/V1/UpdateLiveConfigRequest.php +++ b/VideoStitcher/src/V1/UpdateLiveConfigRequest.php @@ -21,7 +21,7 @@ class UpdateLiveConfigRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig live_config = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $live_config = null; + protected $live_config = null; /** * Required. The update mask applies to the resource. * For the `FieldMask` definition, see @@ -29,7 +29,7 @@ class UpdateLiveConfigRequest 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\Video\Stitcher\V1\LiveConfig $liveConfig Required. The LiveConfig resource which replaces the resource on the diff --git a/VideoStitcher/src/V1/UpdateSlateRequest.php b/VideoStitcher/src/V1/UpdateSlateRequest.php index e773dd07452a..6e415aa29b8e 100644 --- a/VideoStitcher/src/V1/UpdateSlateRequest.php +++ b/VideoStitcher/src/V1/UpdateSlateRequest.php @@ -20,13 +20,13 @@ class UpdateSlateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate slate = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $slate = null; + protected $slate = null; /** * Required. The update mask which specifies fields which should be updated. * * 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\Video\Stitcher\V1\Slate $slate Required. The resource with updated fields. diff --git a/VideoStitcher/src/V1/UpdateVodConfigRequest.php b/VideoStitcher/src/V1/UpdateVodConfigRequest.php index 3126ff36419d..b85f3bf4d33e 100644 --- a/VideoStitcher/src/V1/UpdateVodConfigRequest.php +++ b/VideoStitcher/src/V1/UpdateVodConfigRequest.php @@ -21,7 +21,7 @@ class UpdateVodConfigRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.VodConfig vod_config = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $vod_config = null; + protected $vod_config = null; /** * Required. The update mask applies to the resource. * For the `FieldMask` definition, see @@ -29,7 +29,7 @@ class UpdateVodConfigRequest 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\Video\Stitcher\V1\VodConfig $vodConfig Required. The VOD config resource which replaces the resource on the diff --git a/VideoStitcher/src/V1/VideoStitcherServiceClient.php b/VideoStitcher/src/V1/VideoStitcherServiceClient.php deleted file mode 100644 index a58c39750e5d..000000000000 --- a/VideoStitcher/src/V1/VideoStitcherServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateCdnKey', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists all CDN keys in the specified project and location. - * @param \Google\Cloud\Video\Stitcher\V1\ListCdnKeysRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListCdnKeys(\Google\Cloud\Video\Stitcher\V1\ListCdnKeysRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/ListCdnKeys', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\ListCdnKeysResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns the specified CDN key. - * @param \Google\Cloud\Video\Stitcher\V1\GetCdnKeyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetCdnKey(\Google\Cloud\Video\Stitcher\V1\GetCdnKeyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/GetCdnKey', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\CdnKey', 'decode'], - $metadata, $options); - } - - /** - * Deletes the specified CDN key. - * @param \Google\Cloud\Video\Stitcher\V1\DeleteCdnKeyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteCdnKey(\Google\Cloud\Video\Stitcher\V1\DeleteCdnKeyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteCdnKey', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates the specified CDN key. Only update fields specified - * in the call method body. - * @param \Google\Cloud\Video\Stitcher\V1\UpdateCdnKeyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateCdnKey(\Google\Cloud\Video\Stitcher\V1\UpdateCdnKeyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/UpdateCdnKey', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a client side playback VOD session and returns the full - * tracking and playback metadata of the session. - * @param \Google\Cloud\Video\Stitcher\V1\CreateVodSessionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateVodSession(\Google\Cloud\Video\Stitcher\V1\CreateVodSessionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateVodSession', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\VodSession', 'decode'], - $metadata, $options); - } - - /** - * Returns the full tracking, playback metadata, and relevant ad-ops - * logs for the specified VOD session. - * @param \Google\Cloud\Video\Stitcher\V1\GetVodSessionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetVodSession(\Google\Cloud\Video\Stitcher\V1\GetVodSessionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/GetVodSession', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\VodSession', 'decode'], - $metadata, $options); - } - - /** - * Returns a list of detailed stitching information of the specified VOD - * session. - * @param \Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListVodStitchDetails(\Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/ListVodStitchDetails', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns the specified stitching information for the specified VOD session. - * @param \Google\Cloud\Video\Stitcher\V1\GetVodStitchDetailRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetVodStitchDetail(\Google\Cloud\Video\Stitcher\V1\GetVodStitchDetailRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/GetVodStitchDetail', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\VodStitchDetail', 'decode'], - $metadata, $options); - } - - /** - * Return the list of ad tag details for the specified VOD session. - * @param \Google\Cloud\Video\Stitcher\V1\ListVodAdTagDetailsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListVodAdTagDetails(\Google\Cloud\Video\Stitcher\V1\ListVodAdTagDetailsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/ListVodAdTagDetails', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\ListVodAdTagDetailsResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns the specified ad tag detail for the specified VOD session. - * @param \Google\Cloud\Video\Stitcher\V1\GetVodAdTagDetailRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetVodAdTagDetail(\Google\Cloud\Video\Stitcher\V1\GetVodAdTagDetailRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/GetVodAdTagDetail', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\VodAdTagDetail', 'decode'], - $metadata, $options); - } - - /** - * Return the list of ad tag details for the specified live session. - * @param \Google\Cloud\Video\Stitcher\V1\ListLiveAdTagDetailsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListLiveAdTagDetails(\Google\Cloud\Video\Stitcher\V1\ListLiveAdTagDetailsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveAdTagDetails', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\ListLiveAdTagDetailsResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns the specified ad tag detail for the specified live session. - * @param \Google\Cloud\Video\Stitcher\V1\GetLiveAdTagDetailRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetLiveAdTagDetail(\Google\Cloud\Video\Stitcher\V1\GetLiveAdTagDetailRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveAdTagDetail', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail', 'decode'], - $metadata, $options); - } - - /** - * Creates a slate. - * @param \Google\Cloud\Video\Stitcher\V1\CreateSlateRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateSlate(\Google\Cloud\Video\Stitcher\V1\CreateSlateRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateSlate', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists all slates in the specified project and location. - * @param \Google\Cloud\Video\Stitcher\V1\ListSlatesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListSlates(\Google\Cloud\Video\Stitcher\V1\ListSlatesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/ListSlates', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\ListSlatesResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns the specified slate. - * @param \Google\Cloud\Video\Stitcher\V1\GetSlateRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetSlate(\Google\Cloud\Video\Stitcher\V1\GetSlateRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/GetSlate', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\Slate', 'decode'], - $metadata, $options); - } - - /** - * Updates the specified slate. - * @param \Google\Cloud\Video\Stitcher\V1\UpdateSlateRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateSlate(\Google\Cloud\Video\Stitcher\V1\UpdateSlateRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/UpdateSlate', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes the specified slate. - * @param \Google\Cloud\Video\Stitcher\V1\DeleteSlateRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteSlate(\Google\Cloud\Video\Stitcher\V1\DeleteSlateRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteSlate', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a new live session. - * @param \Google\Cloud\Video\Stitcher\V1\CreateLiveSessionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateLiveSession(\Google\Cloud\Video\Stitcher\V1\CreateLiveSessionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateLiveSession', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\LiveSession', 'decode'], - $metadata, $options); - } - - /** - * Returns the details for the specified live session. - * @param \Google\Cloud\Video\Stitcher\V1\GetLiveSessionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetLiveSession(\Google\Cloud\Video\Stitcher\V1\GetLiveSessionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveSession', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\LiveSession', 'decode'], - $metadata, $options); - } - - /** - * Registers the live config with the provided unique ID in - * the specified region. - * @param \Google\Cloud\Video\Stitcher\V1\CreateLiveConfigRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateLiveConfig(\Google\Cloud\Video\Stitcher\V1\CreateLiveConfigRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateLiveConfig', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists all live configs managed by the Video Stitcher that - * belong to the specified project and region. - * @param \Google\Cloud\Video\Stitcher\V1\ListLiveConfigsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListLiveConfigs(\Google\Cloud\Video\Stitcher\V1\ListLiveConfigsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveConfigs', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\ListLiveConfigsResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns the specified live config managed by the Video - * Stitcher service. - * @param \Google\Cloud\Video\Stitcher\V1\GetLiveConfigRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetLiveConfig(\Google\Cloud\Video\Stitcher\V1\GetLiveConfigRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveConfig', - $argument, - ['\Google\Cloud\Video\Stitcher\V1\LiveConfig', 'decode'], - $metadata, $options); - } - - /** - * Deletes the specified live config. - * @param \Google\Cloud\Video\Stitcher\V1\DeleteLiveConfigRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteLiveConfig(\Google\Cloud\Video\Stitcher\V1\DeleteLiveConfigRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteLiveConfig', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - -} diff --git a/VideoStitcher/src/V1/VodAdTagDetail.php b/VideoStitcher/src/V1/VodAdTagDetail.php index de174ebfdac1..bbeee022d365 100644 --- a/VideoStitcher/src/V1/VodAdTagDetail.php +++ b/VideoStitcher/src/V1/VodAdTagDetail.php @@ -23,7 +23,7 @@ class VodAdTagDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * A list of ad requests for one ad tag. * diff --git a/VideoStitcher/src/V1/VodConfig.php b/VideoStitcher/src/V1/VodConfig.php index f3e51afcc7b9..d073063a514d 100644 --- a/VideoStitcher/src/V1/VodConfig.php +++ b/VideoStitcher/src/V1/VodConfig.php @@ -21,37 +21,37 @@ class VodConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. Source URI for the VOD stream manifest. * * Generated from protobuf field string source_uri = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $source_uri = ''; + protected $source_uri = ''; /** * Required. The default ad tag associated with this VOD config. * * Generated from protobuf field string ad_tag_uri = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $ad_tag_uri = ''; + protected $ad_tag_uri = ''; /** * Optional. Google Ad Manager (GAM) metadata. * * Generated from protobuf field .google.cloud.video.stitcher.v1.GamVodConfig gam_vod_config = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $gam_vod_config = null; + protected $gam_vod_config = null; /** * Output only. State of the VOD config. * * Generated from protobuf field .google.cloud.video.stitcher.v1.VodConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Options for fetching source manifests and segments. * * Generated from protobuf field .google.cloud.video.stitcher.v1.FetchOptions source_fetch_options = 8; */ - private $source_fetch_options = null; + protected $source_fetch_options = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/VodSession.php b/VideoStitcher/src/V1/VodSession.php index 3815df85da71..e409e1409dcf 100644 --- a/VideoStitcher/src/V1/VodSession.php +++ b/VideoStitcher/src/V1/VodSession.php @@ -21,19 +21,19 @@ class VodSession extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Metadata of what was stitched into the content. * * Generated from protobuf field .google.cloud.video.stitcher.v1.Interstitials interstitials = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $interstitials = null; + protected $interstitials = null; /** * Output only. The playback URI of the stitched content. * * Generated from protobuf field string play_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $play_uri = ''; + protected $play_uri = ''; /** * URI of the media to stitch. For most use cases, you should create a * [VodConfig][google.cloud.video.stitcher.v1.VodConfig] with this information @@ -41,7 +41,7 @@ class VodSession extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string source_uri = 5; */ - private $source_uri = ''; + protected $source_uri = ''; /** * Ad tag URI. For most use cases, you should create a * [VodConfig][google.cloud.video.stitcher.v1.VodConfig] with this information @@ -49,7 +49,7 @@ class VodSession extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string ad_tag_uri = 6; */ - private $ad_tag_uri = ''; + protected $ad_tag_uri = ''; /** * Key value pairs for ad tag macro replacement, only available for VOD * sessions that do not implement Google Ad manager ad insertion. If the @@ -69,33 +69,33 @@ class VodSession extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 9; */ - private $manifest_options = null; + protected $manifest_options = null; /** * Output only. The generated ID of the VodSession's source media. * * Generated from protobuf field string asset_id = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $asset_id = ''; + protected $asset_id = ''; /** * Required. Determines how the ad should be tracked. * * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 11 [(.google.api.field_behavior) = REQUIRED]; */ - private $ad_tracking = 0; + protected $ad_tracking = 0; /** * This field should be set with appropriate values if GAM is being used for * ads. * * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSession.GamSettings gam_settings = 13; */ - private $gam_settings = null; + protected $gam_settings = null; /** * The resource name of the VOD config for this session, in the form of * `projects/{project}/locations/{location}/vodConfigs/{id}`. * * Generated from protobuf field string vod_config = 14 [(.google.api.resource_reference) = { */ - private $vod_config = ''; + protected $vod_config = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/VodSession/GamSettings.php b/VideoStitcher/src/V1/VodSession/GamSettings.php index 86d95ad923c2..c4b3ce696858 100644 --- a/VideoStitcher/src/V1/VodSession/GamSettings.php +++ b/VideoStitcher/src/V1/VodSession/GamSettings.php @@ -21,13 +21,13 @@ class GamSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_code = ''; + protected $network_code = ''; /** * Required. The stream ID generated by Ad Manager. * * Generated from protobuf field string stream_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $stream_id = ''; + protected $stream_id = ''; /** * Constructor. diff --git a/VideoStitcher/src/V1/VodSessionAd.php b/VideoStitcher/src/V1/VodSessionAd.php index 2caec1b88d8f..d1b8a1b44103 100644 --- a/VideoStitcher/src/V1/VodSessionAd.php +++ b/VideoStitcher/src/V1/VodSessionAd.php @@ -20,13 +20,13 @@ class VodSessionAd extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration duration = 1; */ - private $duration = null; + protected $duration = null; /** * Metadata of companion ads associated with the ad. * * Generated from protobuf field .google.cloud.video.stitcher.v1.CompanionAds companion_ads = 2; */ - private $companion_ads = null; + protected $companion_ads = null; /** * The list of progress tracking events for the ad break. These can be of * the following IAB types: `MUTE`, `UNMUTE`, `PAUSE`, `CLICK`, diff --git a/VideoStitcher/src/V1/VodSessionAdBreak.php b/VideoStitcher/src/V1/VodSessionAdBreak.php index 920de59ea0ae..688d8754996b 100644 --- a/VideoStitcher/src/V1/VodSessionAdBreak.php +++ b/VideoStitcher/src/V1/VodSessionAdBreak.php @@ -32,13 +32,13 @@ class VodSessionAdBreak extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration end_time_offset = 3; */ - private $end_time_offset = null; + protected $end_time_offset = null; /** * Ad break start time in seconds relative to the start of the VOD asset. * * Generated from protobuf field .google.protobuf.Duration start_time_offset = 4; */ - private $start_time_offset = null; + protected $start_time_offset = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/VodSessionContent.php b/VideoStitcher/src/V1/VodSessionContent.php index a49745492fa0..d17cc36f962f 100644 --- a/VideoStitcher/src/V1/VodSessionContent.php +++ b/VideoStitcher/src/V1/VodSessionContent.php @@ -21,7 +21,7 @@ class VodSessionContent extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration duration = 1; */ - private $duration = null; + protected $duration = null; /** * Constructor. diff --git a/VideoStitcher/src/V1/VodStitchDetail.php b/VideoStitcher/src/V1/VodStitchDetail.php index 8a60aa2a3a1a..8d42eb7d99dd 100644 --- a/VideoStitcher/src/V1/VodStitchDetail.php +++ b/VideoStitcher/src/V1/VodStitchDetail.php @@ -23,7 +23,7 @@ class VodStitchDetail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * A list of ad processing details for the fetched ad playlist. * diff --git a/VideoStitcher/tests/Unit/V1/Client/VideoStitcherServiceClientTest.php b/VideoStitcher/tests/Unit/V1/Client/VideoStitcherServiceClientTest.php index 9af3449f7726..5afedd5041f7 100644 --- a/VideoStitcher/tests/Unit/V1/Client/VideoStitcherServiceClientTest.php +++ b/VideoStitcher/tests/Unit/V1/Client/VideoStitcherServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return VideoStitcherServiceClient */ @@ -211,12 +213,15 @@ public function createCdnKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -356,12 +361,15 @@ public function createLiveConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -419,9 +427,7 @@ public function createLiveSessionTest() $liveSession = new LiveSession(); $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); $liveSession->setLiveConfig($liveSessionLiveConfig); - $request = (new CreateLiveSessionRequest()) - ->setParent($formattedParent) - ->setLiveSession($liveSession); + $request = (new CreateLiveSessionRequest())->setParent($formattedParent)->setLiveSession($liveSession); $response = $gapicClient->createLiveSession($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -447,21 +453,22 @@ public function createLiveSessionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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]'); $liveSession = new LiveSession(); $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); $liveSession->setLiveConfig($liveSessionLiveConfig); - $request = (new CreateLiveSessionRequest()) - ->setParent($formattedParent) - ->setLiveSession($liveSession); + $request = (new CreateLiveSessionRequest())->setParent($formattedParent)->setLiveSession($liveSession); try { $gapicClient->createLiveSession($request); // If the $gapicClient method call did not throw, fail the test @@ -575,12 +582,15 @@ public function createSlateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -718,12 +728,15 @@ public function createVodConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -787,9 +800,7 @@ public function createVodSessionTest() $vodSession = new VodSession(); $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; $vodSession->setAdTracking($vodSessionAdTracking); - $request = (new CreateVodSessionRequest()) - ->setParent($formattedParent) - ->setVodSession($vodSession); + $request = (new CreateVodSessionRequest())->setParent($formattedParent)->setVodSession($vodSession); $response = $gapicClient->createVodSession($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -815,21 +826,22 @@ public function createVodSessionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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]'); $vodSession = new VodSession(); $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; $vodSession->setAdTracking($vodSessionAdTracking); - $request = (new CreateVodSessionRequest()) - ->setParent($formattedParent) - ->setVodSession($vodSession); + $request = (new CreateVodSessionRequest())->setParent($formattedParent)->setVodSession($vodSession); try { $gapicClient->createVodSession($request); // If the $gapicClient method call did not throw, fail the test @@ -874,8 +886,7 @@ public function deleteCdnKeyTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - $request = (new DeleteCdnKeyRequest()) - ->setName($formattedName); + $request = (new DeleteCdnKeyRequest())->setName($formattedName); $response = $gapicClient->deleteCdnKey($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -931,17 +942,19 @@ public function deleteCdnKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - $request = (new DeleteCdnKeyRequest()) - ->setName($formattedName); + $request = (new DeleteCdnKeyRequest())->setName($formattedName); $response = $gapicClient->deleteCdnKey($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -995,8 +1008,7 @@ public function deleteLiveConfigTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - $request = (new DeleteLiveConfigRequest()) - ->setName($formattedName); + $request = (new DeleteLiveConfigRequest())->setName($formattedName); $response = $gapicClient->deleteLiveConfig($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1052,17 +1064,19 @@ public function deleteLiveConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - $request = (new DeleteLiveConfigRequest()) - ->setName($formattedName); + $request = (new DeleteLiveConfigRequest())->setName($formattedName); $response = $gapicClient->deleteLiveConfig($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1116,8 +1130,7 @@ public function deleteSlateTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - $request = (new DeleteSlateRequest()) - ->setName($formattedName); + $request = (new DeleteSlateRequest())->setName($formattedName); $response = $gapicClient->deleteSlate($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1173,17 +1186,19 @@ public function deleteSlateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - $request = (new DeleteSlateRequest()) - ->setName($formattedName); + $request = (new DeleteSlateRequest())->setName($formattedName); $response = $gapicClient->deleteSlate($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1237,8 +1252,7 @@ public function deleteVodConfigTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - $request = (new DeleteVodConfigRequest()) - ->setName($formattedName); + $request = (new DeleteVodConfigRequest())->setName($formattedName); $response = $gapicClient->deleteVodConfig($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1294,17 +1308,19 @@ public function deleteVodConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - $request = (new DeleteVodConfigRequest()) - ->setName($formattedName); + $request = (new DeleteVodConfigRequest())->setName($formattedName); $response = $gapicClient->deleteVodConfig($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1344,8 +1360,7 @@ public function getCdnKeyTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - $request = (new GetCdnKeyRequest()) - ->setName($formattedName); + $request = (new GetCdnKeyRequest())->setName($formattedName); $response = $gapicClient->getCdnKey($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1369,17 +1384,19 @@ public function getCdnKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - $request = (new GetCdnKeyRequest()) - ->setName($formattedName); + $request = (new GetCdnKeyRequest())->setName($formattedName); try { $gapicClient->getCdnKey($request); // If the $gapicClient method call did not throw, fail the test @@ -1407,9 +1424,13 @@ public function getLiveAdTagDetailTest() $expectedResponse->setName($name2); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); - $request = (new GetLiveAdTagDetailRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->liveAdTagDetailName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_SESSION]', + '[LIVE_AD_TAG_DETAIL]' + ); + $request = (new GetLiveAdTagDetailRequest())->setName($formattedName); $response = $gapicClient->getLiveAdTagDetail($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1433,17 +1454,24 @@ public function getLiveAdTagDetailExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); - $request = (new GetLiveAdTagDetailRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->liveAdTagDetailName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_SESSION]', + '[LIVE_AD_TAG_DETAIL]' + ); + $request = (new GetLiveAdTagDetailRequest())->setName($formattedName); try { $gapicClient->getLiveAdTagDetail($request); // If the $gapicClient method call did not throw, fail the test @@ -1478,8 +1506,7 @@ public function getLiveConfigTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - $request = (new GetLiveConfigRequest()) - ->setName($formattedName); + $request = (new GetLiveConfigRequest())->setName($formattedName); $response = $gapicClient->getLiveConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1503,17 +1530,19 @@ public function getLiveConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - $request = (new GetLiveConfigRequest()) - ->setName($formattedName); + $request = (new GetLiveConfigRequest())->setName($formattedName); try { $gapicClient->getLiveConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -1546,8 +1575,7 @@ public function getLiveSessionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - $request = (new GetLiveSessionRequest()) - ->setName($formattedName); + $request = (new GetLiveSessionRequest())->setName($formattedName); $response = $gapicClient->getLiveSession($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1571,17 +1599,19 @@ public function getLiveSessionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - $request = (new GetLiveSessionRequest()) - ->setName($formattedName); + $request = (new GetLiveSessionRequest())->setName($formattedName); try { $gapicClient->getLiveSession($request); // If the $gapicClient method call did not throw, fail the test @@ -1612,8 +1642,7 @@ public function getSlateTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - $request = (new GetSlateRequest()) - ->setName($formattedName); + $request = (new GetSlateRequest())->setName($formattedName); $response = $gapicClient->getSlate($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1637,17 +1666,19 @@ public function getSlateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - $request = (new GetSlateRequest()) - ->setName($formattedName); + $request = (new GetSlateRequest())->setName($formattedName); try { $gapicClient->getSlate($request); // If the $gapicClient method call did not throw, fail the test @@ -1675,9 +1706,13 @@ public function getVodAdTagDetailTest() $expectedResponse->setName($name2); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); - $request = (new GetVodAdTagDetailRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->vodAdTagDetailName( + '[PROJECT]', + '[LOCATION]', + '[VOD_SESSION]', + '[VOD_AD_TAG_DETAIL]' + ); + $request = (new GetVodAdTagDetailRequest())->setName($formattedName); $response = $gapicClient->getVodAdTagDetail($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1701,17 +1736,24 @@ public function getVodAdTagDetailExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); - $request = (new GetVodAdTagDetailRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->vodAdTagDetailName( + '[PROJECT]', + '[LOCATION]', + '[VOD_SESSION]', + '[VOD_AD_TAG_DETAIL]' + ); + $request = (new GetVodAdTagDetailRequest())->setName($formattedName); try { $gapicClient->getVodAdTagDetail($request); // If the $gapicClient method call did not throw, fail the test @@ -1744,8 +1786,7 @@ public function getVodConfigTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - $request = (new GetVodConfigRequest()) - ->setName($formattedName); + $request = (new GetVodConfigRequest())->setName($formattedName); $response = $gapicClient->getVodConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1769,17 +1810,19 @@ public function getVodConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - $request = (new GetVodConfigRequest()) - ->setName($formattedName); + $request = (new GetVodConfigRequest())->setName($formattedName); try { $gapicClient->getVodConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -1818,8 +1861,7 @@ public function getVodSessionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - $request = (new GetVodSessionRequest()) - ->setName($formattedName); + $request = (new GetVodSessionRequest())->setName($formattedName); $response = $gapicClient->getVodSession($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1843,17 +1885,19 @@ public function getVodSessionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - $request = (new GetVodSessionRequest()) - ->setName($formattedName); + $request = (new GetVodSessionRequest())->setName($formattedName); try { $gapicClient->getVodSession($request); // If the $gapicClient method call did not throw, fail the test @@ -1881,9 +1925,13 @@ public function getVodStitchDetailTest() $expectedResponse->setName($name2); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); - $request = (new GetVodStitchDetailRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->vodStitchDetailName( + '[PROJECT]', + '[LOCATION]', + '[VOD_SESSION]', + '[VOD_STITCH_DETAIL]' + ); + $request = (new GetVodStitchDetailRequest())->setName($formattedName); $response = $gapicClient->getVodStitchDetail($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1907,17 +1955,24 @@ public function getVodStitchDetailExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); - $request = (new GetVodStitchDetailRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->vodStitchDetailName( + '[PROJECT]', + '[LOCATION]', + '[VOD_SESSION]', + '[VOD_STITCH_DETAIL]' + ); + $request = (new GetVodStitchDetailRequest())->setName($formattedName); try { $gapicClient->getVodStitchDetail($request); // If the $gapicClient method call did not throw, fail the test @@ -1942,17 +1997,14 @@ public function listCdnKeysTest() // Mock response $nextPageToken = ''; $cdnKeysElement = new CdnKey(); - $cdnKeys = [ - $cdnKeysElement, - ]; + $cdnKeys = [$cdnKeysElement]; $expectedResponse = new ListCdnKeysResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setCdnKeys($cdnKeys); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListCdnKeysRequest()) - ->setParent($formattedParent); + $request = (new ListCdnKeysRequest())->setParent($formattedParent); $response = $gapicClient->listCdnKeys($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1979,17 +2031,19 @@ public function listCdnKeysExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListCdnKeysRequest()) - ->setParent($formattedParent); + $request = (new ListCdnKeysRequest())->setParent($formattedParent); try { $gapicClient->listCdnKeys($request); // If the $gapicClient method call did not throw, fail the test @@ -2014,17 +2068,14 @@ public function listLiveAdTagDetailsTest() // Mock response $nextPageToken = ''; $liveAdTagDetailsElement = new LiveAdTagDetail(); - $liveAdTagDetails = [ - $liveAdTagDetailsElement, - ]; + $liveAdTagDetails = [$liveAdTagDetailsElement]; $expectedResponse = new ListLiveAdTagDetailsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLiveAdTagDetails($liveAdTagDetails); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - $request = (new ListLiveAdTagDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListLiveAdTagDetailsRequest())->setParent($formattedParent); $response = $gapicClient->listLiveAdTagDetails($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2051,17 +2102,19 @@ public function listLiveAdTagDetailsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - $request = (new ListLiveAdTagDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListLiveAdTagDetailsRequest())->setParent($formattedParent); try { $gapicClient->listLiveAdTagDetails($request); // If the $gapicClient method call did not throw, fail the test @@ -2086,17 +2139,14 @@ public function listLiveConfigsTest() // Mock response $nextPageToken = ''; $liveConfigsElement = new LiveConfig(); - $liveConfigs = [ - $liveConfigsElement, - ]; + $liveConfigs = [$liveConfigsElement]; $expectedResponse = new ListLiveConfigsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLiveConfigs($liveConfigs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListLiveConfigsRequest()) - ->setParent($formattedParent); + $request = (new ListLiveConfigsRequest())->setParent($formattedParent); $response = $gapicClient->listLiveConfigs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2123,17 +2173,19 @@ public function listLiveConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListLiveConfigsRequest()) - ->setParent($formattedParent); + $request = (new ListLiveConfigsRequest())->setParent($formattedParent); try { $gapicClient->listLiveConfigs($request); // If the $gapicClient method call did not throw, fail the test @@ -2158,17 +2210,14 @@ public function listSlatesTest() // Mock response $nextPageToken = ''; $slatesElement = new Slate(); - $slates = [ - $slatesElement, - ]; + $slates = [$slatesElement]; $expectedResponse = new ListSlatesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setSlates($slates); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListSlatesRequest()) - ->setParent($formattedParent); + $request = (new ListSlatesRequest())->setParent($formattedParent); $response = $gapicClient->listSlates($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2195,17 +2244,19 @@ public function listSlatesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListSlatesRequest()) - ->setParent($formattedParent); + $request = (new ListSlatesRequest())->setParent($formattedParent); try { $gapicClient->listSlates($request); // If the $gapicClient method call did not throw, fail the test @@ -2230,17 +2281,14 @@ public function listVodAdTagDetailsTest() // Mock response $nextPageToken = ''; $vodAdTagDetailsElement = new VodAdTagDetail(); - $vodAdTagDetails = [ - $vodAdTagDetailsElement, - ]; + $vodAdTagDetails = [$vodAdTagDetailsElement]; $expectedResponse = new ListVodAdTagDetailsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setVodAdTagDetails($vodAdTagDetails); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - $request = (new ListVodAdTagDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListVodAdTagDetailsRequest())->setParent($formattedParent); $response = $gapicClient->listVodAdTagDetails($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2267,17 +2315,19 @@ public function listVodAdTagDetailsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - $request = (new ListVodAdTagDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListVodAdTagDetailsRequest())->setParent($formattedParent); try { $gapicClient->listVodAdTagDetails($request); // If the $gapicClient method call did not throw, fail the test @@ -2302,17 +2352,14 @@ public function listVodConfigsTest() // Mock response $nextPageToken = ''; $vodConfigsElement = new VodConfig(); - $vodConfigs = [ - $vodConfigsElement, - ]; + $vodConfigs = [$vodConfigsElement]; $expectedResponse = new ListVodConfigsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setVodConfigs($vodConfigs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListVodConfigsRequest()) - ->setParent($formattedParent); + $request = (new ListVodConfigsRequest())->setParent($formattedParent); $response = $gapicClient->listVodConfigs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2339,17 +2386,19 @@ public function listVodConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListVodConfigsRequest()) - ->setParent($formattedParent); + $request = (new ListVodConfigsRequest())->setParent($formattedParent); try { $gapicClient->listVodConfigs($request); // If the $gapicClient method call did not throw, fail the test @@ -2374,17 +2423,14 @@ public function listVodStitchDetailsTest() // Mock response $nextPageToken = ''; $vodStitchDetailsElement = new VodStitchDetail(); - $vodStitchDetails = [ - $vodStitchDetailsElement, - ]; + $vodStitchDetails = [$vodStitchDetailsElement]; $expectedResponse = new ListVodStitchDetailsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setVodStitchDetails($vodStitchDetails); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - $request = (new ListVodStitchDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListVodStitchDetailsRequest())->setParent($formattedParent); $response = $gapicClient->listVodStitchDetails($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2411,17 +2457,19 @@ public function listVodStitchDetailsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - $request = (new ListVodStitchDetailsRequest()) - ->setParent($formattedParent); + $request = (new ListVodStitchDetailsRequest())->setParent($formattedParent); try { $gapicClient->listVodStitchDetails($request); // If the $gapicClient method call did not throw, fail the test @@ -2471,9 +2519,7 @@ public function updateCdnKeyTest() // Mock request $cdnKey = new CdnKey(); $updateMask = new FieldMask(); - $request = (new UpdateCdnKeyRequest()) - ->setCdnKey($cdnKey) - ->setUpdateMask($updateMask); + $request = (new UpdateCdnKeyRequest())->setCdnKey($cdnKey)->setUpdateMask($updateMask); $response = $gapicClient->updateCdnKey($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2531,19 +2577,20 @@ public function updateCdnKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $cdnKey = new CdnKey(); $updateMask = new FieldMask(); - $request = (new UpdateCdnKeyRequest()) - ->setCdnKey($cdnKey) - ->setUpdateMask($updateMask); + $request = (new UpdateCdnKeyRequest())->setCdnKey($cdnKey)->setUpdateMask($updateMask); $response = $gapicClient->updateCdnKey($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2610,9 +2657,7 @@ public function updateLiveConfigTest() $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; $liveConfig->setAdTracking($liveConfigAdTracking); $updateMask = new FieldMask(); - $request = (new UpdateLiveConfigRequest()) - ->setLiveConfig($liveConfig) - ->setUpdateMask($updateMask); + $request = (new UpdateLiveConfigRequest())->setLiveConfig($liveConfig)->setUpdateMask($updateMask); $response = $gapicClient->updateLiveConfig($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2670,12 +2715,15 @@ public function updateLiveConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $liveConfig = new LiveConfig(); @@ -2684,9 +2732,7 @@ public function updateLiveConfigExceptionTest() $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; $liveConfig->setAdTracking($liveConfigAdTracking); $updateMask = new FieldMask(); - $request = (new UpdateLiveConfigRequest()) - ->setLiveConfig($liveConfig) - ->setUpdateMask($updateMask); + $request = (new UpdateLiveConfigRequest())->setLiveConfig($liveConfig)->setUpdateMask($updateMask); $response = $gapicClient->updateLiveConfig($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2745,9 +2791,7 @@ public function updateSlateTest() // Mock request $slate = new Slate(); $updateMask = new FieldMask(); - $request = (new UpdateSlateRequest()) - ->setSlate($slate) - ->setUpdateMask($updateMask); + $request = (new UpdateSlateRequest())->setSlate($slate)->setUpdateMask($updateMask); $response = $gapicClient->updateSlate($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2805,19 +2849,20 @@ public function updateSlateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $slate = new Slate(); $updateMask = new FieldMask(); - $request = (new UpdateSlateRequest()) - ->setSlate($slate) - ->setUpdateMask($updateMask); + $request = (new UpdateSlateRequest())->setSlate($slate)->setUpdateMask($updateMask); $response = $gapicClient->updateSlate($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2882,9 +2927,7 @@ public function updateVodConfigTest() $vodConfigAdTagUri = 'vodConfigAdTagUri-1204642686'; $vodConfig->setAdTagUri($vodConfigAdTagUri); $updateMask = new FieldMask(); - $request = (new UpdateVodConfigRequest()) - ->setVodConfig($vodConfig) - ->setUpdateMask($updateMask); + $request = (new UpdateVodConfigRequest())->setVodConfig($vodConfig)->setUpdateMask($updateMask); $response = $gapicClient->updateVodConfig($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2942,12 +2985,15 @@ public function updateVodConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $vodConfig = new VodConfig(); @@ -2956,9 +3002,7 @@ public function updateVodConfigExceptionTest() $vodConfigAdTagUri = 'vodConfigAdTagUri-1204642686'; $vodConfig->setAdTagUri($vodConfigAdTagUri); $updateMask = new FieldMask(); - $request = (new UpdateVodConfigRequest()) - ->setVodConfig($vodConfig) - ->setUpdateMask($updateMask); + $request = (new UpdateVodConfigRequest())->setVodConfig($vodConfig)->setUpdateMask($updateMask); $response = $gapicClient->updateVodConfig($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/VideoStitcher/tests/Unit/V1/VideoStitcherServiceClientTest.php b/VideoStitcher/tests/Unit/V1/VideoStitcherServiceClientTest.php deleted file mode 100644 index 037c30eace81..000000000000 --- a/VideoStitcher/tests/Unit/V1/VideoStitcherServiceClientTest.php +++ /dev/null @@ -1,2805 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return VideoStitcherServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new VideoStitcherServiceClient($options); - } - - /** @test */ - public function createCdnKeyTest() - { - $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/createCdnKeyTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $hostname = 'hostname-299803597'; - $expectedResponse = new CdnKey(); - $expectedResponse->setName($name); - $expectedResponse->setHostname($hostname); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createCdnKeyTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $cdnKey = new CdnKey(); - $cdnKeyId = 'cdnKeyId1672586061'; - $response = $gapicClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); - $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.video.stitcher.v1.VideoStitcherService/CreateCdnKey', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getCdnKey(); - $this->assertProtobufEquals($cdnKey, $actualValue); - $actualValue = $actualApiRequestObject->getCdnKeyId(); - $this->assertProtobufEquals($cdnKeyId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createCdnKeyTest'); - $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 createCdnKeyExceptionTest() - { - $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/createCdnKeyTest'); - $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]'); - $cdnKey = new CdnKey(); - $cdnKeyId = 'cdnKeyId1672586061'; - $response = $gapicClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createCdnKeyTest'); - 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 createLiveConfigTest() - { - $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/createLiveConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $sourceUri = 'sourceUri-1111107768'; - $adTagUri = 'adTagUri-1429194965'; - $defaultSlate = 'defaultSlate1316218395'; - $expectedResponse = new LiveConfig(); - $expectedResponse->setName($name); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setAdTagUri($adTagUri); - $expectedResponse->setDefaultSlate($defaultSlate); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createLiveConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $liveConfigId = 'liveConfigId-558267483'; - $liveConfig = new LiveConfig(); - $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; - $liveConfig->setSourceUri($liveConfigSourceUri); - $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; - $liveConfig->setAdTracking($liveConfigAdTracking); - $response = $gapicClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); - $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.video.stitcher.v1.VideoStitcherService/CreateLiveConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getLiveConfigId(); - $this->assertProtobufEquals($liveConfigId, $actualValue); - $actualValue = $actualApiRequestObject->getLiveConfig(); - $this->assertProtobufEquals($liveConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createLiveConfigTest'); - $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 createLiveConfigExceptionTest() - { - $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/createLiveConfigTest'); - $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]'); - $liveConfigId = 'liveConfigId-558267483'; - $liveConfig = new LiveConfig(); - $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; - $liveConfig->setSourceUri($liveConfigSourceUri); - $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; - $liveConfig->setAdTracking($liveConfigAdTracking); - $response = $gapicClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createLiveConfigTest'); - 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 createLiveSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $playUri = 'playUri1879098849'; - $liveConfig = 'liveConfig-1498665483'; - $expectedResponse = new LiveSession(); - $expectedResponse->setName($name); - $expectedResponse->setPlayUri($playUri); - $expectedResponse->setLiveConfig($liveConfig); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $liveSession = new LiveSession(); - $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - $liveSession->setLiveConfig($liveSessionLiveConfig); - $response = $gapicClient->createLiveSession($formattedParent, $liveSession); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateLiveSession', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getLiveSession(); - $this->assertProtobufEquals($liveSession, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createLiveSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $liveSession = new LiveSession(); - $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - $liveSession->setLiveConfig($liveSessionLiveConfig); - try { - $gapicClient->createLiveSession($formattedParent, $liveSession); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSlateTest() - { - $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/createSlateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $uri = 'uri116076'; - $expectedResponse = new Slate(); - $expectedResponse->setName($name); - $expectedResponse->setUri($uri); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createSlateTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $slateId = 'slateId-1486865023'; - $slate = new Slate(); - $response = $gapicClient->createSlate($formattedParent, $slateId, $slate); - $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.video.stitcher.v1.VideoStitcherService/CreateSlate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getSlateId(); - $this->assertProtobufEquals($slateId, $actualValue); - $actualValue = $actualApiRequestObject->getSlate(); - $this->assertProtobufEquals($slate, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createSlateTest'); - $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 createSlateExceptionTest() - { - $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/createSlateTest'); - $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]'); - $slateId = 'slateId-1486865023'; - $slate = new Slate(); - $response = $gapicClient->createSlate($formattedParent, $slateId, $slate); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createSlateTest'); - 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 createVodConfigTest() - { - $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/createVodConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $sourceUri = 'sourceUri-1111107768'; - $adTagUri = 'adTagUri-1429194965'; - $expectedResponse = new VodConfig(); - $expectedResponse->setName($name); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setAdTagUri($adTagUri); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createVodConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $vodConfigId = 'vodConfigId-418410300'; - $vodConfig = new VodConfig(); - $vodConfigSourceUri = 'vodConfigSourceUri538718692'; - $vodConfig->setSourceUri($vodConfigSourceUri); - $vodConfigAdTagUri = 'vodConfigAdTagUri-1204642686'; - $vodConfig->setAdTagUri($vodConfigAdTagUri); - $response = $gapicClient->createVodConfig($formattedParent, $vodConfigId, $vodConfig); - $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.video.stitcher.v1.VideoStitcherService/CreateVodConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getVodConfigId(); - $this->assertProtobufEquals($vodConfigId, $actualValue); - $actualValue = $actualApiRequestObject->getVodConfig(); - $this->assertProtobufEquals($vodConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createVodConfigTest'); - $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 createVodConfigExceptionTest() - { - $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/createVodConfigTest'); - $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]'); - $vodConfigId = 'vodConfigId-418410300'; - $vodConfig = new VodConfig(); - $vodConfigSourceUri = 'vodConfigSourceUri538718692'; - $vodConfig->setSourceUri($vodConfigSourceUri); - $vodConfigAdTagUri = 'vodConfigAdTagUri-1204642686'; - $vodConfig->setAdTagUri($vodConfigAdTagUri); - $response = $gapicClient->createVodConfig($formattedParent, $vodConfigId, $vodConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createVodConfigTest'); - 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 createVodSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $playUri = 'playUri1879098849'; - $sourceUri = 'sourceUri-1111107768'; - $adTagUri = 'adTagUri-1429194965'; - $assetId = 'assetId-373202742'; - $vodConfig = 'vodConfig-936686282'; - $expectedResponse = new VodSession(); - $expectedResponse->setName($name); - $expectedResponse->setPlayUri($playUri); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setAdTagUri($adTagUri); - $expectedResponse->setAssetId($assetId); - $expectedResponse->setVodConfig($vodConfig); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $vodSession = new VodSession(); - $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; - $vodSession->setAdTracking($vodSessionAdTracking); - $response = $gapicClient->createVodSession($formattedParent, $vodSession); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateVodSession', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getVodSession(); - $this->assertProtobufEquals($vodSession, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createVodSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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]'); - $vodSession = new VodSession(); - $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; - $vodSession->setAdTracking($vodSessionAdTracking); - try { - $gapicClient->createVodSession($formattedParent, $vodSession); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteCdnKeyTest() - { - $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/deleteCdnKeyTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteCdnKeyTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - $response = $gapicClient->deleteCdnKey($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.video.stitcher.v1.VideoStitcherService/DeleteCdnKey', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteCdnKeyTest'); - $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 deleteCdnKeyExceptionTest() - { - $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/deleteCdnKeyTest'); - $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->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - $response = $gapicClient->deleteCdnKey($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteCdnKeyTest'); - 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 deleteLiveConfigTest() - { - $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/deleteLiveConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteLiveConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - $response = $gapicClient->deleteLiveConfig($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.video.stitcher.v1.VideoStitcherService/DeleteLiveConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteLiveConfigTest'); - $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 deleteLiveConfigExceptionTest() - { - $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/deleteLiveConfigTest'); - $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->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - $response = $gapicClient->deleteLiveConfig($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteLiveConfigTest'); - 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 deleteSlateTest() - { - $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/deleteSlateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteSlateTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - $response = $gapicClient->deleteSlate($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.video.stitcher.v1.VideoStitcherService/DeleteSlate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteSlateTest'); - $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 deleteSlateExceptionTest() - { - $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/deleteSlateTest'); - $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->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - $response = $gapicClient->deleteSlate($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteSlateTest'); - 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 deleteVodConfigTest() - { - $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/deleteVodConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteVodConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - $response = $gapicClient->deleteVodConfig($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.video.stitcher.v1.VideoStitcherService/DeleteVodConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteVodConfigTest'); - $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 deleteVodConfigExceptionTest() - { - $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/deleteVodConfigTest'); - $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->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - $response = $gapicClient->deleteVodConfig($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteVodConfigTest'); - 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 getCdnKeyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $hostname = 'hostname-299803597'; - $expectedResponse = new CdnKey(); - $expectedResponse->setName($name2); - $expectedResponse->setHostname($hostname); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - $response = $gapicClient->getCdnKey($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.video.stitcher.v1.VideoStitcherService/GetCdnKey', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getCdnKeyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - try { - $gapicClient->getCdnKey($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 getLiveAdTagDetailTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new LiveAdTagDetail(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); - $response = $gapicClient->getLiveAdTagDetail($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.video.stitcher.v1.VideoStitcherService/GetLiveAdTagDetail', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLiveAdTagDetailExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); - try { - $gapicClient->getLiveAdTagDetail($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 getLiveConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $sourceUri = 'sourceUri-1111107768'; - $adTagUri = 'adTagUri-1429194965'; - $defaultSlate = 'defaultSlate1316218395'; - $expectedResponse = new LiveConfig(); - $expectedResponse->setName($name2); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setAdTagUri($adTagUri); - $expectedResponse->setDefaultSlate($defaultSlate); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - $response = $gapicClient->getLiveConfig($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.video.stitcher.v1.VideoStitcherService/GetLiveConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLiveConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); - try { - $gapicClient->getLiveConfig($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 getLiveSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $playUri = 'playUri1879098849'; - $liveConfig = 'liveConfig-1498665483'; - $expectedResponse = new LiveSession(); - $expectedResponse->setName($name2); - $expectedResponse->setPlayUri($playUri); - $expectedResponse->setLiveConfig($liveConfig); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - $response = $gapicClient->getLiveSession($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.video.stitcher.v1.VideoStitcherService/GetLiveSession', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLiveSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - try { - $gapicClient->getLiveSession($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 getSlateTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $uri = 'uri116076'; - $expectedResponse = new Slate(); - $expectedResponse->setName($name2); - $expectedResponse->setUri($uri); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - $response = $gapicClient->getSlate($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.video.stitcher.v1.VideoStitcherService/GetSlate', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSlateExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - try { - $gapicClient->getSlate($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 getVodAdTagDetailTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new VodAdTagDetail(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); - $response = $gapicClient->getVodAdTagDetail($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.video.stitcher.v1.VideoStitcherService/GetVodAdTagDetail', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getVodAdTagDetailExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); - try { - $gapicClient->getVodAdTagDetail($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 getVodConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $sourceUri = 'sourceUri-1111107768'; - $adTagUri = 'adTagUri-1429194965'; - $expectedResponse = new VodConfig(); - $expectedResponse->setName($name2); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setAdTagUri($adTagUri); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - $response = $gapicClient->getVodConfig($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.video.stitcher.v1.VideoStitcherService/GetVodConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getVodConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->vodConfigName('[PROJECT]', '[LOCATION]', '[VOD_CONFIG]'); - try { - $gapicClient->getVodConfig($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 getVodSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $playUri = 'playUri1879098849'; - $sourceUri = 'sourceUri-1111107768'; - $adTagUri = 'adTagUri-1429194965'; - $assetId = 'assetId-373202742'; - $vodConfig = 'vodConfig-936686282'; - $expectedResponse = new VodSession(); - $expectedResponse->setName($name2); - $expectedResponse->setPlayUri($playUri); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setAdTagUri($adTagUri); - $expectedResponse->setAssetId($assetId); - $expectedResponse->setVodConfig($vodConfig); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - $response = $gapicClient->getVodSession($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.video.stitcher.v1.VideoStitcherService/GetVodSession', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getVodSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - try { - $gapicClient->getVodSession($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 getVodStitchDetailTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new VodStitchDetail(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); - $response = $gapicClient->getVodStitchDetail($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.video.stitcher.v1.VideoStitcherService/GetVodStitchDetail', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getVodStitchDetailExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); - try { - $gapicClient->getVodStitchDetail($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 listCdnKeysTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $cdnKeysElement = new CdnKey(); - $cdnKeys = [ - $cdnKeysElement, - ]; - $expectedResponse = new ListCdnKeysResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setCdnKeys($cdnKeys); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listCdnKeys($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getCdnKeys()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListCdnKeys', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listCdnKeysExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listCdnKeys($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 listLiveAdTagDetailsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $liveAdTagDetailsElement = new LiveAdTagDetail(); - $liveAdTagDetails = [ - $liveAdTagDetailsElement, - ]; - $expectedResponse = new ListLiveAdTagDetailsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLiveAdTagDetails($liveAdTagDetails); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - $response = $gapicClient->listLiveAdTagDetails($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLiveAdTagDetails()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveAdTagDetails', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLiveAdTagDetailsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); - try { - $gapicClient->listLiveAdTagDetails($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 listLiveConfigsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $liveConfigsElement = new LiveConfig(); - $liveConfigs = [ - $liveConfigsElement, - ]; - $expectedResponse = new ListLiveConfigsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLiveConfigs($liveConfigs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listLiveConfigs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLiveConfigs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveConfigs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLiveConfigsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listLiveConfigs($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 listSlatesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $slatesElement = new Slate(); - $slates = [ - $slatesElement, - ]; - $expectedResponse = new ListSlatesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSlates($slates); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listSlates($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSlates()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListSlates', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSlatesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listSlates($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 listVodAdTagDetailsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $vodAdTagDetailsElement = new VodAdTagDetail(); - $vodAdTagDetails = [ - $vodAdTagDetailsElement, - ]; - $expectedResponse = new ListVodAdTagDetailsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setVodAdTagDetails($vodAdTagDetails); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - $response = $gapicClient->listVodAdTagDetails($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getVodAdTagDetails()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListVodAdTagDetails', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listVodAdTagDetailsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - try { - $gapicClient->listVodAdTagDetails($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 listVodConfigsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $vodConfigsElement = new VodConfig(); - $vodConfigs = [ - $vodConfigsElement, - ]; - $expectedResponse = new ListVodConfigsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setVodConfigs($vodConfigs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listVodConfigs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getVodConfigs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListVodConfigs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listVodConfigsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listVodConfigs($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 listVodStitchDetailsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $vodStitchDetailsElement = new VodStitchDetail(); - $vodStitchDetails = [ - $vodStitchDetailsElement, - ]; - $expectedResponse = new ListVodStitchDetailsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setVodStitchDetails($vodStitchDetails); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - $response = $gapicClient->listVodStitchDetails($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getVodStitchDetails()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListVodStitchDetails', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listVodStitchDetailsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); - try { - $gapicClient->listVodStitchDetails($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 updateCdnKeyTest() - { - $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/updateCdnKeyTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $hostname = 'hostname-299803597'; - $expectedResponse = new CdnKey(); - $expectedResponse->setName($name); - $expectedResponse->setHostname($hostname); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateCdnKeyTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $cdnKey = new CdnKey(); - $updateMask = new FieldMask(); - $response = $gapicClient->updateCdnKey($cdnKey, $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.video.stitcher.v1.VideoStitcherService/UpdateCdnKey', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getCdnKey(); - $this->assertProtobufEquals($cdnKey, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateCdnKeyTest'); - $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 updateCdnKeyExceptionTest() - { - $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/updateCdnKeyTest'); - $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 - $cdnKey = new CdnKey(); - $updateMask = new FieldMask(); - $response = $gapicClient->updateCdnKey($cdnKey, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateCdnKeyTest'); - 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 updateLiveConfigTest() - { - $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/updateLiveConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $sourceUri = 'sourceUri-1111107768'; - $adTagUri = 'adTagUri-1429194965'; - $defaultSlate = 'defaultSlate1316218395'; - $expectedResponse = new LiveConfig(); - $expectedResponse->setName($name); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setAdTagUri($adTagUri); - $expectedResponse->setDefaultSlate($defaultSlate); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateLiveConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $liveConfig = new LiveConfig(); - $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; - $liveConfig->setSourceUri($liveConfigSourceUri); - $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; - $liveConfig->setAdTracking($liveConfigAdTracking); - $updateMask = new FieldMask(); - $response = $gapicClient->updateLiveConfig($liveConfig, $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.video.stitcher.v1.VideoStitcherService/UpdateLiveConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getLiveConfig(); - $this->assertProtobufEquals($liveConfig, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateLiveConfigTest'); - $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 updateLiveConfigExceptionTest() - { - $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/updateLiveConfigTest'); - $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 - $liveConfig = new LiveConfig(); - $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; - $liveConfig->setSourceUri($liveConfigSourceUri); - $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; - $liveConfig->setAdTracking($liveConfigAdTracking); - $updateMask = new FieldMask(); - $response = $gapicClient->updateLiveConfig($liveConfig, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateLiveConfigTest'); - 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 updateSlateTest() - { - $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/updateSlateTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $uri = 'uri116076'; - $expectedResponse = new Slate(); - $expectedResponse->setName($name); - $expectedResponse->setUri($uri); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateSlateTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $slate = new Slate(); - $updateMask = new FieldMask(); - $response = $gapicClient->updateSlate($slate, $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.video.stitcher.v1.VideoStitcherService/UpdateSlate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getSlate(); - $this->assertProtobufEquals($slate, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateSlateTest'); - $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 updateSlateExceptionTest() - { - $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/updateSlateTest'); - $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 - $slate = new Slate(); - $updateMask = new FieldMask(); - $response = $gapicClient->updateSlate($slate, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateSlateTest'); - 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 updateVodConfigTest() - { - $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/updateVodConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $sourceUri = 'sourceUri-1111107768'; - $adTagUri = 'adTagUri-1429194965'; - $expectedResponse = new VodConfig(); - $expectedResponse->setName($name); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setAdTagUri($adTagUri); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateVodConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $vodConfig = new VodConfig(); - $vodConfigSourceUri = 'vodConfigSourceUri538718692'; - $vodConfig->setSourceUri($vodConfigSourceUri); - $vodConfigAdTagUri = 'vodConfigAdTagUri-1204642686'; - $vodConfig->setAdTagUri($vodConfigAdTagUri); - $updateMask = new FieldMask(); - $response = $gapicClient->updateVodConfig($vodConfig, $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.video.stitcher.v1.VideoStitcherService/UpdateVodConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getVodConfig(); - $this->assertProtobufEquals($vodConfig, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateVodConfigTest'); - $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 updateVodConfigExceptionTest() - { - $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/updateVodConfigTest'); - $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 - $vodConfig = new VodConfig(); - $vodConfigSourceUri = 'vodConfigSourceUri538718692'; - $vodConfig->setSourceUri($vodConfigSourceUri); - $vodConfigAdTagUri = 'vodConfigAdTagUri-1204642686'; - $vodConfig->setAdTagUri($vodConfigAdTagUri); - $updateMask = new FieldMask(); - $response = $gapicClient->updateVodConfig($vodConfig, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateVodConfigTest'); - 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()); - } -} diff --git a/VmwareEngine/.OwlBot.yaml b/VmwareEngine/.OwlBot.yaml index 87bacb1e1e63..332ea8a2be7e 100644 --- a/VmwareEngine/.OwlBot.yaml +++ b/VmwareEngine/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/vmwareengine/v1/.*-php/(.*) - dest: /owl-bot-staging/VmwareEngine/v1/$1 + - source: /google/cloud/vmwareengine/(v1)/.*-php/(.*) + dest: /owl-bot-staging/VmwareEngine/$1/$2 api-name: VmwareEngine diff --git a/VmwareEngine/owlbot.py b/VmwareEngine/owlbot.py index 28fbd220c0ea..b30dd9582348 100644 --- a/VmwareEngine/owlbot.py +++ b/VmwareEngine/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. @@ -30,14 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php", - src / "**/*GrpcClient.php", - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -48,32 +41,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', @@ -82,8 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) + '--print-width=120']) diff --git a/VmwareEngine/src/V1/Client/VmwareEngineClient.php b/VmwareEngine/src/V1/Client/VmwareEngineClient.php index b9778956c452..22767cf25bf9 100644 --- a/VmwareEngine/src/V1/Client/VmwareEngineClient.php +++ b/VmwareEngine/src/V1/Client/VmwareEngineClient.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 cluster * resource. @@ -375,8 +394,12 @@ public static function dnsForwardingName(string $project, string $location, stri * * @return string The formatted external_access_rule resource. */ - public static function externalAccessRuleName(string $project, string $location, string $networkPolicy, string $externalAccessRule): string - { + public static function externalAccessRuleName( + string $project, + string $location, + string $networkPolicy, + string $externalAccessRule + ): string { return self::getPathTemplate('externalAccessRule')->render([ 'project' => $project, 'location' => $location, @@ -396,8 +419,12 @@ public static function externalAccessRuleName(string $project, string $location, * * @return string The formatted external_address resource. */ - public static function externalAddressName(string $project, string $location, string $privateCloud, string $externalAddress): string - { + public static function externalAddressName( + string $project, + string $location, + string $privateCloud, + string $externalAddress + ): string { return self::getPathTemplate('externalAddress')->render([ 'project' => $project, 'location' => $location, @@ -417,8 +444,12 @@ public static function externalAddressName(string $project, string $location, st * * @return string The formatted hcx_activation_key resource. */ - public static function hcxActivationKeyName(string $project, string $location, string $privateCloud, string $hcxActivationKey): string - { + public static function hcxActivationKeyName( + string $project, + string $location, + string $privateCloud, + string $hcxActivationKey + ): string { return self::getPathTemplate('hcxActivationKey')->render([ 'project' => $project, 'location' => $location, @@ -455,8 +486,12 @@ public static function locationName(string $project, string $location): string * * @return string The formatted logging_server resource. */ - public static function loggingServerName(string $project, string $location, string $privateCloud, string $loggingServer): string - { + public static function loggingServerName( + string $project, + string $location, + string $privateCloud, + string $loggingServer + ): string { return self::getPathTemplate('loggingServer')->render([ 'project' => $project, 'location' => $location, @@ -476,8 +511,12 @@ public static function loggingServerName(string $project, string $location, stri * * @return string The formatted management_dns_zone_binding resource. */ - public static function managementDnsZoneBindingName(string $project, string $location, string $privateCloud, string $managementDnsZoneBinding): string - { + public static function managementDnsZoneBindingName( + string $project, + string $location, + string $privateCloud, + string $managementDnsZoneBinding + ): string { return self::getPathTemplate('managementDnsZoneBinding')->render([ 'project' => $project, 'location' => $location, @@ -553,8 +592,13 @@ public static function networkPolicyName(string $project, string $location, stri * * @return string The formatted node resource. */ - public static function nodeName(string $project, string $location, string $privateCloud, string $cluster, string $node): string - { + public static function nodeName( + string $project, + string $location, + string $privateCloud, + string $cluster, + string $node + ): string { return self::getPathTemplate('node')->render([ 'project' => $project, 'location' => $location, @@ -652,8 +696,11 @@ public static function subnetName(string $project, string $location, string $pri * * @return string The formatted vmware_engine_network resource. */ - public static function vmwareEngineNetworkName(string $project, string $location, string $vmwareEngineNetwork): string - { + public static function vmwareEngineNetworkName( + string $project, + string $location, + string $vmwareEngineNetwork + ): string { return self::getPathTemplate('vmwareEngineNetwork')->render([ 'project' => $project, 'location' => $location, @@ -825,8 +872,10 @@ public function createCluster(CreateClusterRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function createExternalAccessRule(CreateExternalAccessRuleRequest $request, array $callOptions = []): OperationResponse - { + public function createExternalAccessRule( + CreateExternalAccessRuleRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateExternalAccessRule', $request, $callOptions)->wait(); } @@ -853,8 +902,10 @@ public function createExternalAccessRule(CreateExternalAccessRuleRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function createExternalAddress(CreateExternalAddressRequest $request, array $callOptions = []): OperationResponse - { + public function createExternalAddress( + CreateExternalAddressRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateExternalAddress', $request, $callOptions)->wait(); } @@ -879,8 +930,10 @@ public function createExternalAddress(CreateExternalAddressRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function createHcxActivationKey(CreateHcxActivationKeyRequest $request, array $callOptions = []): OperationResponse - { + public function createHcxActivationKey( + CreateHcxActivationKeyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateHcxActivationKey', $request, $callOptions)->wait(); } @@ -938,8 +991,10 @@ public function createLoggingServer(CreateLoggingServerRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function createManagementDnsZoneBinding(CreateManagementDnsZoneBindingRequest $request, array $callOptions = []): OperationResponse - { + public function createManagementDnsZoneBinding( + CreateManagementDnsZoneBindingRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateManagementDnsZoneBinding', $request, $callOptions)->wait(); } @@ -966,8 +1021,10 @@ public function createManagementDnsZoneBinding(CreateManagementDnsZoneBindingReq * * @throws ApiException Thrown if the API call fails. */ - public function createNetworkPeering(CreateNetworkPeeringRequest $request, array $callOptions = []): OperationResponse - { + public function createNetworkPeering( + CreateNetworkPeeringRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateNetworkPeering', $request, $callOptions)->wait(); } @@ -1053,8 +1110,10 @@ public function createPrivateCloud(CreatePrivateCloudRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function createPrivateConnection(CreatePrivateConnectionRequest $request, array $callOptions = []): OperationResponse - { + public function createPrivateConnection( + CreatePrivateConnectionRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreatePrivateConnection', $request, $callOptions)->wait(); } @@ -1080,8 +1139,10 @@ public function createPrivateConnection(CreatePrivateConnectionRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function createVmwareEngineNetwork(CreateVmwareEngineNetworkRequest $request, array $callOptions = []): OperationResponse - { + public function createVmwareEngineNetwork( + CreateVmwareEngineNetworkRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateVmwareEngineNetwork', $request, $callOptions)->wait(); } @@ -1136,8 +1197,10 @@ public function deleteCluster(DeleteClusterRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function deleteExternalAccessRule(DeleteExternalAccessRuleRequest $request, array $callOptions = []): OperationResponse - { + public function deleteExternalAccessRule( + DeleteExternalAccessRuleRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteExternalAccessRule', $request, $callOptions)->wait(); } @@ -1164,8 +1227,10 @@ public function deleteExternalAccessRule(DeleteExternalAccessRuleRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function deleteExternalAddress(DeleteExternalAddressRequest $request, array $callOptions = []): OperationResponse - { + public function deleteExternalAddress( + DeleteExternalAddressRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteExternalAddress', $request, $callOptions)->wait(); } @@ -1219,8 +1284,10 @@ public function deleteLoggingServer(DeleteLoggingServerRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function deleteManagementDnsZoneBinding(DeleteManagementDnsZoneBindingRequest $request, array $callOptions = []): OperationResponse - { + public function deleteManagementDnsZoneBinding( + DeleteManagementDnsZoneBindingRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteManagementDnsZoneBinding', $request, $callOptions)->wait(); } @@ -1248,8 +1315,10 @@ public function deleteManagementDnsZoneBinding(DeleteManagementDnsZoneBindingReq * * @throws ApiException Thrown if the API call fails. */ - public function deleteNetworkPeering(DeleteNetworkPeeringRequest $request, array $callOptions = []): OperationResponse - { + public function deleteNetworkPeering( + DeleteNetworkPeeringRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteNetworkPeering', $request, $callOptions)->wait(); } @@ -1344,8 +1413,10 @@ public function deletePrivateCloud(DeletePrivateCloudRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function deletePrivateConnection(DeletePrivateConnectionRequest $request, array $callOptions = []): OperationResponse - { + public function deletePrivateConnection( + DeletePrivateConnectionRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeletePrivateConnection', $request, $callOptions)->wait(); } @@ -1374,8 +1445,10 @@ public function deletePrivateConnection(DeletePrivateConnectionRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function deleteVmwareEngineNetwork(DeleteVmwareEngineNetworkRequest $request, array $callOptions = []): OperationResponse - { + public function deleteVmwareEngineNetwork( + DeleteVmwareEngineNetworkRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteVmwareEngineNetwork', $request, $callOptions)->wait(); } @@ -1402,8 +1475,10 @@ public function deleteVmwareEngineNetwork(DeleteVmwareEngineNetworkRequest $requ * * @throws ApiException Thrown if the API call fails. */ - public function fetchNetworkPolicyExternalAddresses(FetchNetworkPolicyExternalAddressesRequest $request, array $callOptions = []): PagedListResponse - { + public function fetchNetworkPolicyExternalAddresses( + FetchNetworkPolicyExternalAddressesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('FetchNetworkPolicyExternalAddresses', $request, $callOptions); } @@ -1456,8 +1531,10 @@ public function getCluster(GetClusterRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function getDnsBindPermission(GetDnsBindPermissionRequest $request, array $callOptions = []): DnsBindPermission - { + public function getDnsBindPermission( + GetDnsBindPermissionRequest $request, + array $callOptions = [] + ): DnsBindPermission { return $this->startApiCall('GetDnsBindPermission', $request, $callOptions)->wait(); } @@ -1508,8 +1585,10 @@ public function getDnsForwarding(GetDnsForwardingRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function getExternalAccessRule(GetExternalAccessRuleRequest $request, array $callOptions = []): ExternalAccessRule - { + public function getExternalAccessRule( + GetExternalAccessRuleRequest $request, + array $callOptions = [] + ): ExternalAccessRule { return $this->startApiCall('GetExternalAccessRule', $request, $callOptions)->wait(); } @@ -1613,8 +1692,10 @@ public function getLoggingServer(GetLoggingServerRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function getManagementDnsZoneBinding(GetManagementDnsZoneBindingRequest $request, array $callOptions = []): ManagementDnsZoneBinding - { + public function getManagementDnsZoneBinding( + GetManagementDnsZoneBindingRequest $request, + array $callOptions = [] + ): ManagementDnsZoneBinding { return $this->startApiCall('GetManagementDnsZoneBinding', $request, $callOptions)->wait(); } @@ -1774,8 +1855,10 @@ public function getPrivateCloud(GetPrivateCloudRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function getPrivateConnection(GetPrivateConnectionRequest $request, array $callOptions = []): PrivateConnection - { + public function getPrivateConnection( + GetPrivateConnectionRequest $request, + array $callOptions = [] + ): PrivateConnection { return $this->startApiCall('GetPrivateConnection', $request, $callOptions)->wait(); } @@ -1829,8 +1912,10 @@ public function getSubnet(GetSubnetRequest $request, array $callOptions = []): S * * @throws ApiException Thrown if the API call fails. */ - public function getVmwareEngineNetwork(GetVmwareEngineNetworkRequest $request, array $callOptions = []): VmwareEngineNetwork - { + public function getVmwareEngineNetwork( + GetVmwareEngineNetworkRequest $request, + array $callOptions = [] + ): VmwareEngineNetwork { return $this->startApiCall('GetVmwareEngineNetwork', $request, $callOptions)->wait(); } @@ -1858,8 +1943,10 @@ public function getVmwareEngineNetwork(GetVmwareEngineNetworkRequest $request, a * * @throws ApiException Thrown if the API call fails. */ - public function grantDnsBindPermission(GrantDnsBindPermissionRequest $request, array $callOptions = []): OperationResponse - { + public function grantDnsBindPermission( + GrantDnsBindPermissionRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('GrantDnsBindPermission', $request, $callOptions)->wait(); } @@ -1910,8 +1997,10 @@ public function listClusters(ListClustersRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function listExternalAccessRules(ListExternalAccessRulesRequest $request, array $callOptions = []): PagedListResponse - { + public function listExternalAccessRules( + ListExternalAccessRulesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListExternalAccessRules', $request, $callOptions); } @@ -1937,8 +2026,10 @@ public function listExternalAccessRules(ListExternalAccessRulesRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function listExternalAddresses(ListExternalAddressesRequest $request, array $callOptions = []): PagedListResponse - { + public function listExternalAddresses( + ListExternalAddressesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListExternalAddresses', $request, $callOptions); } @@ -1963,8 +2054,10 @@ public function listExternalAddresses(ListExternalAddressesRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function listHcxActivationKeys(ListHcxActivationKeysRequest $request, array $callOptions = []): PagedListResponse - { + public function listHcxActivationKeys( + ListHcxActivationKeysRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListHcxActivationKeys', $request, $callOptions); } @@ -2017,8 +2110,10 @@ public function listLoggingServers(ListLoggingServersRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function listManagementDnsZoneBindings(ListManagementDnsZoneBindingsRequest $request, array $callOptions = []): PagedListResponse - { + public function listManagementDnsZoneBindings( + ListManagementDnsZoneBindingsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListManagementDnsZoneBindings', $request, $callOptions); } @@ -2202,8 +2297,10 @@ public function listPrivateClouds(ListPrivateCloudsRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function listPrivateConnectionPeeringRoutes(ListPrivateConnectionPeeringRoutesRequest $request, array $callOptions = []): PagedListResponse - { + public function listPrivateConnectionPeeringRoutes( + ListPrivateConnectionPeeringRoutesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListPrivateConnectionPeeringRoutes', $request, $callOptions); } @@ -2228,8 +2325,10 @@ public function listPrivateConnectionPeeringRoutes(ListPrivateConnectionPeeringR * * @throws ApiException Thrown if the API call fails. */ - public function listPrivateConnections(ListPrivateConnectionsRequest $request, array $callOptions = []): PagedListResponse - { + public function listPrivateConnections( + ListPrivateConnectionsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListPrivateConnections', $request, $callOptions); } @@ -2281,8 +2380,10 @@ public function listSubnets(ListSubnetsRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function listVmwareEngineNetworks(ListVmwareEngineNetworksRequest $request, array $callOptions = []): PagedListResponse - { + public function listVmwareEngineNetworks( + ListVmwareEngineNetworksRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListVmwareEngineNetworks', $request, $callOptions); } @@ -2309,8 +2410,10 @@ public function listVmwareEngineNetworks(ListVmwareEngineNetworksRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function repairManagementDnsZoneBinding(RepairManagementDnsZoneBindingRequest $request, array $callOptions = []): OperationResponse - { + public function repairManagementDnsZoneBinding( + RepairManagementDnsZoneBindingRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RepairManagementDnsZoneBinding', $request, $callOptions)->wait(); } @@ -2361,8 +2464,10 @@ public function resetNsxCredentials(ResetNsxCredentialsRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function resetVcenterCredentials(ResetVcenterCredentialsRequest $request, array $callOptions = []): OperationResponse - { + public function resetVcenterCredentials( + ResetVcenterCredentialsRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('ResetVcenterCredentials', $request, $callOptions)->wait(); } @@ -2389,8 +2494,10 @@ public function resetVcenterCredentials(ResetVcenterCredentialsRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function revokeDnsBindPermission(RevokeDnsBindPermissionRequest $request, array $callOptions = []): OperationResponse - { + public function revokeDnsBindPermission( + RevokeDnsBindPermissionRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RevokeDnsBindPermission', $request, $callOptions)->wait(); } @@ -2470,8 +2577,10 @@ public function showVcenterCredentials(ShowVcenterCredentialsRequest $request, a * * @throws ApiException Thrown if the API call fails. */ - public function undeletePrivateCloud(UndeletePrivateCloudRequest $request, array $callOptions = []): OperationResponse - { + public function undeletePrivateCloud( + UndeletePrivateCloudRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UndeletePrivateCloud', $request, $callOptions)->wait(); } @@ -2557,8 +2666,10 @@ public function updateDnsForwarding(UpdateDnsForwardingRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function updateExternalAccessRule(UpdateExternalAccessRuleRequest $request, array $callOptions = []): OperationResponse - { + public function updateExternalAccessRule( + UpdateExternalAccessRuleRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateExternalAccessRule', $request, $callOptions)->wait(); } @@ -2589,8 +2700,10 @@ public function updateExternalAccessRule(UpdateExternalAccessRuleRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function updateExternalAddress(UpdateExternalAddressRequest $request, array $callOptions = []): OperationResponse - { + public function updateExternalAddress( + UpdateExternalAddressRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateExternalAddress', $request, $callOptions)->wait(); } @@ -2644,8 +2757,10 @@ public function updateLoggingServer(UpdateLoggingServerRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function updateManagementDnsZoneBinding(UpdateManagementDnsZoneBindingRequest $request, array $callOptions = []): OperationResponse - { + public function updateManagementDnsZoneBinding( + UpdateManagementDnsZoneBindingRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateManagementDnsZoneBinding', $request, $callOptions)->wait(); } @@ -2672,8 +2787,10 @@ public function updateManagementDnsZoneBinding(UpdateManagementDnsZoneBindingReq * * @throws ApiException Thrown if the API call fails. */ - public function updateNetworkPeering(UpdateNetworkPeeringRequest $request, array $callOptions = []): OperationResponse - { + public function updateNetworkPeering( + UpdateNetworkPeeringRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateNetworkPeering', $request, $callOptions)->wait(); } @@ -2770,8 +2887,10 @@ public function updatePrivateCloud(UpdatePrivateCloudRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function updatePrivateConnection(UpdatePrivateConnectionRequest $request, array $callOptions = []): OperationResponse - { + public function updatePrivateConnection( + UpdatePrivateConnectionRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdatePrivateConnection', $request, $callOptions)->wait(); } @@ -2830,8 +2949,10 @@ public function updateSubnet(UpdateSubnetRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function updateVmwareEngineNetwork(UpdateVmwareEngineNetworkRequest $request, array $callOptions = []): OperationResponse - { + public function updateVmwareEngineNetwork( + UpdateVmwareEngineNetworkRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateVmwareEngineNetwork', $request, $callOptions)->wait(); } @@ -2971,8 +3092,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/VmwareEngine/src/V1/Cluster.php b/VmwareEngine/src/V1/Cluster.php index ccd5f6c641a6..090566a8295d 100644 --- a/VmwareEngine/src/V1/Cluster.php +++ b/VmwareEngine/src/V1/Cluster.php @@ -24,25 +24,25 @@ class Cluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. State of the resource. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. True if the cluster is a management cluster; false otherwise. * There can only be one management cluster in a private cloud @@ -50,13 +50,13 @@ class Cluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool management = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $management = false; + protected $management = false; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Required. The map of cluster node types in this cluster, where the key is * canonical identifier of the node type (corresponds to the `NodeType`). @@ -70,7 +70,7 @@ class Cluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.StretchedClusterConfig stretched_cluster_config = 17 [(.google.api.field_behavior) = OPTIONAL]; */ - private $stretched_cluster_config = null; + protected $stretched_cluster_config = null; /** * Constructor. diff --git a/VmwareEngine/src/V1/CreateClusterRequest.php b/VmwareEngine/src/V1/CreateClusterRequest.php index 9a176a7bb523..9194b7c095aa 100644 --- a/VmwareEngine/src/V1/CreateClusterRequest.php +++ b/VmwareEngine/src/V1/CreateClusterRequest.php @@ -25,7 +25,7 @@ class CreateClusterRequest 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 user-provided identifier of the new `Cluster`. * This identifier must be unique among clusters within the parent and becomes @@ -40,27 +40,27 @@ class CreateClusterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $cluster_id = ''; + protected $cluster_id = ''; /** * Required. The initial description of the new cluster. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $cluster = null; + protected $cluster = null; /** * Optional. The request ID must be a valid UUID with the exception that zero * UUID is not supported (00000000-0000-0000-0000-000000000000). * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * Optional. True if you want the request to be validated and not executed; * false otherwise. * * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The resource name of the private cloud to create a new cluster diff --git a/VmwareEngine/src/V1/CreateExternalAccessRuleRequest.php b/VmwareEngine/src/V1/CreateExternalAccessRuleRequest.php index 24fa63ddd131..ca58f7c39894 100644 --- a/VmwareEngine/src/V1/CreateExternalAccessRuleRequest.php +++ b/VmwareEngine/src/V1/CreateExternalAccessRuleRequest.php @@ -26,13 +26,13 @@ class CreateExternalAccessRuleRequest 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 initial description of a new external access rule. * * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rule = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $external_access_rule = null; + protected $external_access_rule = null; /** * Required. The user-provided identifier of the `ExternalAccessRule` to be * created. This identifier must be unique among `ExternalAccessRule` @@ -47,7 +47,7 @@ class CreateExternalAccessRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string external_access_rule_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $external_access_rule_id = ''; + protected $external_access_rule_id = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -64,7 +64,7 @@ class CreateExternalAccessRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The resource name of the network policy diff --git a/VmwareEngine/src/V1/CreateExternalAddressRequest.php b/VmwareEngine/src/V1/CreateExternalAddressRequest.php index 82bbea81b59d..a21a6b76744f 100644 --- a/VmwareEngine/src/V1/CreateExternalAddressRequest.php +++ b/VmwareEngine/src/V1/CreateExternalAddressRequest.php @@ -26,13 +26,13 @@ class CreateExternalAddressRequest 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 initial description of a new external IP address. * * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress external_address = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $external_address = null; + protected $external_address = null; /** * Required. The user-provided identifier of the `ExternalAddress` to be * created. This identifier must be unique among `ExternalAddress` resources @@ -47,7 +47,7 @@ class CreateExternalAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string external_address_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $external_address_id = ''; + protected $external_address_id = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -64,7 +64,7 @@ class CreateExternalAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The resource name of the private cloud diff --git a/VmwareEngine/src/V1/CreateHcxActivationKeyRequest.php b/VmwareEngine/src/V1/CreateHcxActivationKeyRequest.php index ccbee2d35185..7e2526646b8d 100644 --- a/VmwareEngine/src/V1/CreateHcxActivationKeyRequest.php +++ b/VmwareEngine/src/V1/CreateHcxActivationKeyRequest.php @@ -25,14 +25,14 @@ class CreateHcxActivationKeyRequest 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 initial description of a new HCX activation key. When * creating a new key, this field must be an empty object. * * Generated from protobuf field .google.cloud.vmwareengine.v1.HcxActivationKey hcx_activation_key = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $hcx_activation_key = null; + protected $hcx_activation_key = null; /** * Required. The user-provided identifier of the `HcxActivationKey` to be * created. This identifier must be unique among `HcxActivationKey` resources @@ -47,7 +47,7 @@ class CreateHcxActivationKeyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string hcx_activation_key_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $hcx_activation_key_id = ''; + protected $hcx_activation_key_id = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -64,7 +64,7 @@ class CreateHcxActivationKeyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The resource name of the private cloud to create the key for. diff --git a/VmwareEngine/src/V1/CreateLoggingServerRequest.php b/VmwareEngine/src/V1/CreateLoggingServerRequest.php index 346cf2921cbe..c3b6ecf53119 100644 --- a/VmwareEngine/src/V1/CreateLoggingServerRequest.php +++ b/VmwareEngine/src/V1/CreateLoggingServerRequest.php @@ -26,13 +26,13 @@ class CreateLoggingServerRequest 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 initial description of a new logging server. * * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer logging_server = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $logging_server = null; + protected $logging_server = null; /** * Required. The user-provided identifier of the `LoggingServer` to be * created. This identifier must be unique among `LoggingServer` resources @@ -47,7 +47,7 @@ class CreateLoggingServerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string logging_server_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $logging_server_id = ''; + protected $logging_server_id = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -64,7 +64,7 @@ class CreateLoggingServerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The resource name of the private cloud diff --git a/VmwareEngine/src/V1/CreateManagementDnsZoneBindingRequest.php b/VmwareEngine/src/V1/CreateManagementDnsZoneBindingRequest.php index 0e80dc4f076d..aa2ffc5ad336 100644 --- a/VmwareEngine/src/V1/CreateManagementDnsZoneBindingRequest.php +++ b/VmwareEngine/src/V1/CreateManagementDnsZoneBindingRequest.php @@ -25,13 +25,13 @@ class CreateManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The initial values for a new management DNS zone binding. * * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_binding = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $management_dns_zone_binding = null; + protected $management_dns_zone_binding = null; /** * Required. The user-provided identifier of the `ManagementDnsZoneBinding` * resource to be created. This identifier must be unique among @@ -47,7 +47,7 @@ class CreateManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string management_dns_zone_binding_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $management_dns_zone_binding_id = ''; + protected $management_dns_zone_binding_id = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -64,7 +64,7 @@ class CreateManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The resource name of the private cloud diff --git a/VmwareEngine/src/V1/CreateNetworkPeeringRequest.php b/VmwareEngine/src/V1/CreateNetworkPeeringRequest.php index f0e77f524d93..f7c7bb305194 100644 --- a/VmwareEngine/src/V1/CreateNetworkPeeringRequest.php +++ b/VmwareEngine/src/V1/CreateNetworkPeeringRequest.php @@ -25,7 +25,7 @@ class CreateNetworkPeeringRequest 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 user-provided identifier of the new `NetworkPeering`. * This identifier must be unique among `NetworkPeering` resources within the @@ -40,13 +40,13 @@ class CreateNetworkPeeringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_peering_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_peering_id = ''; + protected $network_peering_id = ''; /** * Required. The initial description of the new network peering. * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering network_peering = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_peering = null; + protected $network_peering = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -63,7 +63,7 @@ class CreateNetworkPeeringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The resource name of the location to create the new network diff --git a/VmwareEngine/src/V1/CreateNetworkPolicyRequest.php b/VmwareEngine/src/V1/CreateNetworkPolicyRequest.php index c9aea77523de..de757cee24d1 100644 --- a/VmwareEngine/src/V1/CreateNetworkPolicyRequest.php +++ b/VmwareEngine/src/V1/CreateNetworkPolicyRequest.php @@ -26,7 +26,7 @@ class CreateNetworkPolicyRequest 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 user-provided identifier of the network policy to be created. * This identifier must be unique within parent @@ -42,13 +42,13 @@ class CreateNetworkPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_policy_id = ''; + protected $network_policy_id = ''; /** * Required. The network policy configuration to use in the request. * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy network_policy = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_policy = null; + protected $network_policy = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -65,7 +65,7 @@ class CreateNetworkPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The resource name of the location (region) diff --git a/VmwareEngine/src/V1/CreatePrivateCloudRequest.php b/VmwareEngine/src/V1/CreatePrivateCloudRequest.php index 714d0f93ff67..4b306cdb6911 100644 --- a/VmwareEngine/src/V1/CreatePrivateCloudRequest.php +++ b/VmwareEngine/src/V1/CreatePrivateCloudRequest.php @@ -25,7 +25,7 @@ class CreatePrivateCloudRequest 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 user-provided identifier of the private cloud to be created. * This identifier must be unique among each `PrivateCloud` within the parent @@ -40,27 +40,27 @@ class CreatePrivateCloudRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string private_cloud_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $private_cloud_id = ''; + protected $private_cloud_id = ''; /** * Required. The initial description of the new private cloud. * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud private_cloud = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $private_cloud = null; + protected $private_cloud = null; /** * Optional. The request ID must be a valid UUID with the exception that zero * UUID is not supported (00000000-0000-0000-0000-000000000000). * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * Optional. True if you want the request to be validated and not executed; * false otherwise. * * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $validate_only = false; + protected $validate_only = false; /** * @param string $parent Required. The resource name of the location to create the new diff --git a/VmwareEngine/src/V1/CreatePrivateConnectionRequest.php b/VmwareEngine/src/V1/CreatePrivateConnectionRequest.php index 39d476d36db2..a86804b320b0 100644 --- a/VmwareEngine/src/V1/CreatePrivateConnectionRequest.php +++ b/VmwareEngine/src/V1/CreatePrivateConnectionRequest.php @@ -25,7 +25,7 @@ class CreatePrivateConnectionRequest 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 user-provided identifier of the new private connection. * This identifier must be unique among private connection resources @@ -40,13 +40,13 @@ class CreatePrivateConnectionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string private_connection_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $private_connection_id = ''; + protected $private_connection_id = ''; /** * Required. The initial description of the new private connection. * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection private_connection = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $private_connection = null; + protected $private_connection = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -63,7 +63,7 @@ class CreatePrivateConnectionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The resource name of the location to create the new private diff --git a/VmwareEngine/src/V1/CreateVmwareEngineNetworkRequest.php b/VmwareEngine/src/V1/CreateVmwareEngineNetworkRequest.php index edc4a5db0cdb..ba26cffddd41 100644 --- a/VmwareEngine/src/V1/CreateVmwareEngineNetworkRequest.php +++ b/VmwareEngine/src/V1/CreateVmwareEngineNetworkRequest.php @@ -27,7 +27,7 @@ class CreateVmwareEngineNetworkRequest 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 user-provided identifier of the new VMware Engine network. * This identifier must be unique among VMware Engine network resources @@ -45,13 +45,13 @@ class CreateVmwareEngineNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vmware_engine_network_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $vmware_engine_network_id = ''; + protected $vmware_engine_network_id = ''; /** * Required. The initial description of the new VMware Engine network. * * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_network = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $vmware_engine_network = null; + protected $vmware_engine_network = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -68,7 +68,7 @@ class CreateVmwareEngineNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The resource name of the location to create the new VMware Engine diff --git a/VmwareEngine/src/V1/Credentials.php b/VmwareEngine/src/V1/Credentials.php index b07abc44fef4..262d839c299f 100644 --- a/VmwareEngine/src/V1/Credentials.php +++ b/VmwareEngine/src/V1/Credentials.php @@ -20,13 +20,13 @@ class Credentials extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string username = 1; */ - private $username = ''; + protected $username = ''; /** * Initial password. * * Generated from protobuf field string password = 2; */ - private $password = ''; + protected $password = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/DeleteClusterRequest.php b/VmwareEngine/src/V1/DeleteClusterRequest.php index 4866a3d67ee3..9338e958e48b 100644 --- a/VmwareEngine/src/V1/DeleteClusterRequest.php +++ b/VmwareEngine/src/V1/DeleteClusterRequest.php @@ -25,14 +25,14 @@ class DeleteClusterRequest 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 request ID must be a valid UUID with the exception that zero * UUID is not supported (00000000-0000-0000-0000-000000000000). * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the cluster to delete. diff --git a/VmwareEngine/src/V1/DeleteExternalAccessRuleRequest.php b/VmwareEngine/src/V1/DeleteExternalAccessRuleRequest.php index 35efbcee3a7e..0b810d04d2e5 100644 --- a/VmwareEngine/src/V1/DeleteExternalAccessRuleRequest.php +++ b/VmwareEngine/src/V1/DeleteExternalAccessRuleRequest.php @@ -25,7 +25,7 @@ class DeleteExternalAccessRuleRequest 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. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -42,7 +42,7 @@ class DeleteExternalAccessRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the external access firewall rule to delete. diff --git a/VmwareEngine/src/V1/DeleteExternalAddressRequest.php b/VmwareEngine/src/V1/DeleteExternalAddressRequest.php index 1f41be2bf881..1c37bf2f2a3d 100644 --- a/VmwareEngine/src/V1/DeleteExternalAddressRequest.php +++ b/VmwareEngine/src/V1/DeleteExternalAddressRequest.php @@ -25,7 +25,7 @@ class DeleteExternalAddressRequest 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. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -42,7 +42,7 @@ class DeleteExternalAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the external IP address to delete. diff --git a/VmwareEngine/src/V1/DeleteLoggingServerRequest.php b/VmwareEngine/src/V1/DeleteLoggingServerRequest.php index d0e02f0824a5..ed81af1f5072 100644 --- a/VmwareEngine/src/V1/DeleteLoggingServerRequest.php +++ b/VmwareEngine/src/V1/DeleteLoggingServerRequest.php @@ -25,7 +25,7 @@ class DeleteLoggingServerRequest 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. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -42,7 +42,7 @@ class DeleteLoggingServerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the logging server to delete. diff --git a/VmwareEngine/src/V1/DeleteManagementDnsZoneBindingRequest.php b/VmwareEngine/src/V1/DeleteManagementDnsZoneBindingRequest.php index 6ccc2ae04354..492d3b27efff 100644 --- a/VmwareEngine/src/V1/DeleteManagementDnsZoneBindingRequest.php +++ b/VmwareEngine/src/V1/DeleteManagementDnsZoneBindingRequest.php @@ -25,7 +25,7 @@ class DeleteManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -42,7 +42,7 @@ class DeleteManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the management DNS zone binding to delete. diff --git a/VmwareEngine/src/V1/DeleteNetworkPeeringRequest.php b/VmwareEngine/src/V1/DeleteNetworkPeeringRequest.php index 43a86564611a..1e47b474ef77 100644 --- a/VmwareEngine/src/V1/DeleteNetworkPeeringRequest.php +++ b/VmwareEngine/src/V1/DeleteNetworkPeeringRequest.php @@ -25,7 +25,7 @@ class DeleteNetworkPeeringRequest 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. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -42,7 +42,7 @@ class DeleteNetworkPeeringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the network peering to be deleted. diff --git a/VmwareEngine/src/V1/DeleteNetworkPolicyRequest.php b/VmwareEngine/src/V1/DeleteNetworkPolicyRequest.php index 304fa3483143..557ee72de847 100644 --- a/VmwareEngine/src/V1/DeleteNetworkPolicyRequest.php +++ b/VmwareEngine/src/V1/DeleteNetworkPolicyRequest.php @@ -25,7 +25,7 @@ class DeleteNetworkPolicyRequest 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. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -42,7 +42,7 @@ class DeleteNetworkPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the network policy to delete. diff --git a/VmwareEngine/src/V1/DeletePrivateCloudRequest.php b/VmwareEngine/src/V1/DeletePrivateCloudRequest.php index a2ad0ad92ebf..4421609c05c7 100644 --- a/VmwareEngine/src/V1/DeletePrivateCloudRequest.php +++ b/VmwareEngine/src/V1/DeletePrivateCloudRequest.php @@ -25,14 +25,14 @@ class DeletePrivateCloudRequest 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 request ID must be a valid UUID with the exception that zero * UUID is not supported (00000000-0000-0000-0000-000000000000). * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * Optional. If set to true, cascade delete is enabled and all children of * this private cloud resource are also deleted. When this flag is set to @@ -42,7 +42,7 @@ class DeletePrivateCloudRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool force = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $force = false; + protected $force = false; /** * Optional. Time delay of the deletion specified in hours. The default value * is `3`. Specifying a non-zero value for this field changes the value of @@ -55,7 +55,7 @@ class DeletePrivateCloudRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 delay_hours = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $delay_hours = null; + protected $delay_hours = null; /** * @param string $name Required. The resource name of the private cloud to delete. diff --git a/VmwareEngine/src/V1/DeletePrivateConnectionRequest.php b/VmwareEngine/src/V1/DeletePrivateConnectionRequest.php index 9582af3d0c09..58bb810feba2 100644 --- a/VmwareEngine/src/V1/DeletePrivateConnectionRequest.php +++ b/VmwareEngine/src/V1/DeletePrivateConnectionRequest.php @@ -25,7 +25,7 @@ class DeletePrivateConnectionRequest 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. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -42,7 +42,7 @@ class DeletePrivateConnectionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the private connection to be deleted. diff --git a/VmwareEngine/src/V1/DeleteVmwareEngineNetworkRequest.php b/VmwareEngine/src/V1/DeleteVmwareEngineNetworkRequest.php index 3b93da5085e3..27b7a9e393f0 100644 --- a/VmwareEngine/src/V1/DeleteVmwareEngineNetworkRequest.php +++ b/VmwareEngine/src/V1/DeleteVmwareEngineNetworkRequest.php @@ -25,7 +25,7 @@ class DeleteVmwareEngineNetworkRequest 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. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -42,7 +42,7 @@ class DeleteVmwareEngineNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * Optional. Checksum used to ensure that the user-provided value is up to * date before the server processes the request. The server compares provided @@ -51,7 +51,7 @@ class DeleteVmwareEngineNetworkRequest 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 VMware Engine network to be deleted. diff --git a/VmwareEngine/src/V1/DnsBindPermission.php b/VmwareEngine/src/V1/DnsBindPermission.php index 2cfc79163af5..64797809c801 100644 --- a/VmwareEngine/src/V1/DnsBindPermission.php +++ b/VmwareEngine/src/V1/DnsBindPermission.php @@ -27,7 +27,7 @@ class DnsBindPermission extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Users/Service accounts which have access for binding on the * intranet VPC project corresponding to the consumer project. diff --git a/VmwareEngine/src/V1/DnsForwarding.php b/VmwareEngine/src/V1/DnsForwarding.php index 03127e170c08..d21001a105d9 100644 --- a/VmwareEngine/src/V1/DnsForwarding.php +++ b/VmwareEngine/src/V1/DnsForwarding.php @@ -26,19 +26,19 @@ class DnsForwarding extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Required. List of domain mappings to configure * diff --git a/VmwareEngine/src/V1/DnsForwarding/ForwardingRule.php b/VmwareEngine/src/V1/DnsForwarding/ForwardingRule.php index 434d60de841a..5a1d30de6d55 100644 --- a/VmwareEngine/src/V1/DnsForwarding/ForwardingRule.php +++ b/VmwareEngine/src/V1/DnsForwarding/ForwardingRule.php @@ -23,7 +23,7 @@ class ForwardingRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string domain = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $domain = ''; + protected $domain = ''; /** * Required. List of DNS servers to use for domain resolution * diff --git a/VmwareEngine/src/V1/ExternalAccessRule.php b/VmwareEngine/src/V1/ExternalAccessRule.php index c0180b0175a6..3df395f4ba3b 100644 --- a/VmwareEngine/src/V1/ExternalAccessRule.php +++ b/VmwareEngine/src/V1/ExternalAccessRule.php @@ -25,25 +25,25 @@ class ExternalAccessRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * User-provided description for this external access rule. * * Generated from protobuf field string description = 5; */ - private $description = ''; + protected $description = ''; /** * External access rule priority, which determines the external access rule to * use when multiple rules apply. If multiple rules have the same priority, @@ -55,13 +55,13 @@ class ExternalAccessRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 priority = 6; */ - private $priority = 0; + protected $priority = 0; /** * The action that the external access rule performs. * * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule.Action action = 7; */ - private $action = 0; + protected $action = 0; /** * The IP protocol to which the external access rule applies. This value can * be one of the following three protocol strings (not case-sensitive): @@ -69,7 +69,7 @@ class ExternalAccessRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string ip_protocol = 8; */ - private $ip_protocol = ''; + protected $ip_protocol = ''; /** * If source ranges are specified, the external access rule applies only to * traffic that has a source IP address in these ranges. These ranges can @@ -118,13 +118,13 @@ class ExternalAccessRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/ExternalAddress.php b/VmwareEngine/src/V1/ExternalAddress.php index 2045ba7196d8..8d15877850b6 100644 --- a/VmwareEngine/src/V1/ExternalAddress.php +++ b/VmwareEngine/src/V1/ExternalAddress.php @@ -25,49 +25,49 @@ class ExternalAddress extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The internal IP address of a workload VM. * * Generated from protobuf field string internal_ip = 6; */ - private $internal_ip = ''; + protected $internal_ip = ''; /** * Output only. The external IP address of a workload VM. * * Generated from protobuf field string external_ip = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $external_ip = ''; + protected $external_ip = ''; /** * Output only. The state of the resource. * * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * User-provided description for this resource. * * Generated from protobuf field string description = 11; */ - private $description = ''; + protected $description = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/FetchNetworkPolicyExternalAddressesRequest.php b/VmwareEngine/src/V1/FetchNetworkPolicyExternalAddressesRequest.php index b0e65976c186..33a7dc9f663b 100644 --- a/VmwareEngine/src/V1/FetchNetworkPolicyExternalAddressesRequest.php +++ b/VmwareEngine/src/V1/FetchNetworkPolicyExternalAddressesRequest.php @@ -25,7 +25,7 @@ class FetchNetworkPolicyExternalAddressesRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string network_policy = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $network_policy = ''; + protected $network_policy = ''; /** * The maximum number of external IP addresses to return in one page. * The service may return fewer than this value. @@ -34,7 +34,7 @@ class FetchNetworkPolicyExternalAddressesRequest extends \Google\Protobuf\Intern * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the @@ -45,7 +45,7 @@ class FetchNetworkPolicyExternalAddressesRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $networkPolicy Required. The resource name of the network policy to query for assigned diff --git a/VmwareEngine/src/V1/FetchNetworkPolicyExternalAddressesResponse.php b/VmwareEngine/src/V1/FetchNetworkPolicyExternalAddressesResponse.php index 543ce3ac34f3..46faea61006d 100644 --- a/VmwareEngine/src/V1/FetchNetworkPolicyExternalAddressesResponse.php +++ b/VmwareEngine/src/V1/FetchNetworkPolicyExternalAddressesResponse.php @@ -29,7 +29,7 @@ class FetchNetworkPolicyExternalAddressesResponse extends \Google\Protobuf\Inter * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/Gapic/VmwareEngineGapicClient.php b/VmwareEngine/src/V1/Gapic/VmwareEngineGapicClient.php deleted file mode 100644 index 0e3cfc17285f..000000000000 --- a/VmwareEngine/src/V1/Gapic/VmwareEngineGapicClient.php +++ /dev/null @@ -1,8341 +0,0 @@ -privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $clusterId = 'cluster_id'; - * $cluster = new Cluster(); - * $operationResponse = $vmwareEngineClient->createCluster($formattedParent, $clusterId, $cluster); - * $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 = $vmwareEngineClient->createCluster($formattedParent, $clusterId, $cluster); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->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\VmwareEngine\V1\Client\VmwareEngineClient}. - */ -class VmwareEngineGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.vmwareengine.v1.VmwareEngine'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'vmwareengine.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'vmwareengine.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 $clusterNameTemplate; - - private static $dnsBindPermissionNameTemplate; - - private static $dnsForwardingNameTemplate; - - private static $externalAccessRuleNameTemplate; - - private static $externalAddressNameTemplate; - - private static $hcxActivationKeyNameTemplate; - - private static $locationNameTemplate; - - private static $loggingServerNameTemplate; - - private static $managementDnsZoneBindingNameTemplate; - - private static $networkNameTemplate; - - private static $networkPeeringNameTemplate; - - private static $networkPolicyNameTemplate; - - private static $nodeNameTemplate; - - private static $nodeTypeNameTemplate; - - private static $privateCloudNameTemplate; - - private static $privateConnectionNameTemplate; - - private static $subnetNameTemplate; - - private static $vmwareEngineNetworkNameTemplate; - - 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/vmware_engine_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/vmware_engine_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/vmware_engine_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/vmware_engine_rest_client_config.php', - ], - ], - ]; - } - - private static function getClusterNameTemplate() - { - if (self::$clusterNameTemplate == null) { - self::$clusterNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}' - ); - } - - return self::$clusterNameTemplate; - } - - private static function getDnsBindPermissionNameTemplate() - { - if (self::$dnsBindPermissionNameTemplate == null) { - self::$dnsBindPermissionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/dnsBindPermission' - ); - } - - return self::$dnsBindPermissionNameTemplate; - } - - private static function getDnsForwardingNameTemplate() - { - if (self::$dnsForwardingNameTemplate == null) { - self::$dnsForwardingNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/dnsForwarding' - ); - } - - return self::$dnsForwardingNameTemplate; - } - - private static function getExternalAccessRuleNameTemplate() - { - if (self::$externalAccessRuleNameTemplate == null) { - self::$externalAccessRuleNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/networkPolicies/{network_policy}/externalAccessRules/{external_access_rule}' - ); - } - - return self::$externalAccessRuleNameTemplate; - } - - private static function getExternalAddressNameTemplate() - { - if (self::$externalAddressNameTemplate == null) { - self::$externalAddressNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}' - ); - } - - return self::$externalAddressNameTemplate; - } - - private static function getHcxActivationKeyNameTemplate() - { - if (self::$hcxActivationKeyNameTemplate == null) { - self::$hcxActivationKeyNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}' - ); - } - - return self::$hcxActivationKeyNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getLoggingServerNameTemplate() - { - if (self::$loggingServerNameTemplate == null) { - self::$loggingServerNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/loggingServers/{logging_server}' - ); - } - - return self::$loggingServerNameTemplate; - } - - private static function getManagementDnsZoneBindingNameTemplate() - { - if (self::$managementDnsZoneBindingNameTemplate == null) { - self::$managementDnsZoneBindingNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/managementDnsZoneBindings/{management_dns_zone_binding}' - ); - } - - return self::$managementDnsZoneBindingNameTemplate; - } - - private static function getNetworkNameTemplate() - { - if (self::$networkNameTemplate == null) { - self::$networkNameTemplate = new PathTemplate( - 'projects/{project}/global/networks/{network}' - ); - } - - return self::$networkNameTemplate; - } - - private static function getNetworkPeeringNameTemplate() - { - if (self::$networkPeeringNameTemplate == null) { - self::$networkPeeringNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/networkPeerings/{network_peering}' - ); - } - - return self::$networkPeeringNameTemplate; - } - - private static function getNetworkPolicyNameTemplate() - { - if (self::$networkPolicyNameTemplate == null) { - self::$networkPolicyNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/networkPolicies/{network_policy}' - ); - } - - return self::$networkPolicyNameTemplate; - } - - private static function getNodeNameTemplate() - { - if (self::$nodeNameTemplate == null) { - self::$nodeNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}' - ); - } - - return self::$nodeNameTemplate; - } - - private static function getNodeTypeNameTemplate() - { - if (self::$nodeTypeNameTemplate == null) { - self::$nodeTypeNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/nodeTypes/{node_type}' - ); - } - - return self::$nodeTypeNameTemplate; - } - - private static function getPrivateCloudNameTemplate() - { - if (self::$privateCloudNameTemplate == null) { - self::$privateCloudNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}' - ); - } - - return self::$privateCloudNameTemplate; - } - - private static function getPrivateConnectionNameTemplate() - { - if (self::$privateConnectionNameTemplate == null) { - self::$privateConnectionNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateConnections/{private_connection}' - ); - } - - return self::$privateConnectionNameTemplate; - } - - private static function getSubnetNameTemplate() - { - if (self::$subnetNameTemplate == null) { - self::$subnetNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}' - ); - } - - return self::$subnetNameTemplate; - } - - private static function getVmwareEngineNetworkNameTemplate() - { - if (self::$vmwareEngineNetworkNameTemplate == null) { - self::$vmwareEngineNetworkNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}' - ); - } - - return self::$vmwareEngineNetworkNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'cluster' => self::getClusterNameTemplate(), - 'dnsBindPermission' => self::getDnsBindPermissionNameTemplate(), - 'dnsForwarding' => self::getDnsForwardingNameTemplate(), - 'externalAccessRule' => self::getExternalAccessRuleNameTemplate(), - 'externalAddress' => self::getExternalAddressNameTemplate(), - 'hcxActivationKey' => self::getHcxActivationKeyNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'loggingServer' => self::getLoggingServerNameTemplate(), - 'managementDnsZoneBinding' => self::getManagementDnsZoneBindingNameTemplate(), - 'network' => self::getNetworkNameTemplate(), - 'networkPeering' => self::getNetworkPeeringNameTemplate(), - 'networkPolicy' => self::getNetworkPolicyNameTemplate(), - 'node' => self::getNodeNameTemplate(), - 'nodeType' => self::getNodeTypeNameTemplate(), - 'privateCloud' => self::getPrivateCloudNameTemplate(), - 'privateConnection' => self::getPrivateConnectionNameTemplate(), - 'subnet' => self::getSubnetNameTemplate(), - 'vmwareEngineNetwork' => self::getVmwareEngineNetworkNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a cluster - * resource. - * - * @param string $project - * @param string $location - * @param string $privateCloud - * @param string $cluster - * - * @return string The formatted cluster resource. - */ - public static function clusterName( - $project, - $location, - $privateCloud, - $cluster - ) { - return self::getClusterNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_cloud' => $privateCloud, - 'cluster' => $cluster, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * dns_bind_permission resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted dns_bind_permission resource. - */ - public static function dnsBindPermissionName($project, $location) - { - return self::getDnsBindPermissionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * dns_forwarding resource. - * - * @param string $project - * @param string $location - * @param string $privateCloud - * - * @return string The formatted dns_forwarding resource. - */ - public static function dnsForwardingName($project, $location, $privateCloud) - { - return self::getDnsForwardingNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_cloud' => $privateCloud, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * external_access_rule resource. - * - * @param string $project - * @param string $location - * @param string $networkPolicy - * @param string $externalAccessRule - * - * @return string The formatted external_access_rule resource. - */ - public static function externalAccessRuleName( - $project, - $location, - $networkPolicy, - $externalAccessRule - ) { - return self::getExternalAccessRuleNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'network_policy' => $networkPolicy, - 'external_access_rule' => $externalAccessRule, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * external_address resource. - * - * @param string $project - * @param string $location - * @param string $privateCloud - * @param string $externalAddress - * - * @return string The formatted external_address resource. - */ - public static function externalAddressName( - $project, - $location, - $privateCloud, - $externalAddress - ) { - return self::getExternalAddressNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_cloud' => $privateCloud, - 'external_address' => $externalAddress, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * hcx_activation_key resource. - * - * @param string $project - * @param string $location - * @param string $privateCloud - * @param string $hcxActivationKey - * - * @return string The formatted hcx_activation_key resource. - */ - public static function hcxActivationKeyName( - $project, - $location, - $privateCloud, - $hcxActivationKey - ) { - return self::getHcxActivationKeyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_cloud' => $privateCloud, - 'hcx_activation_key' => $hcxActivationKey, - ]); - } - - /** - * 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 - * logging_server resource. - * - * @param string $project - * @param string $location - * @param string $privateCloud - * @param string $loggingServer - * - * @return string The formatted logging_server resource. - */ - public static function loggingServerName( - $project, - $location, - $privateCloud, - $loggingServer - ) { - return self::getLoggingServerNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_cloud' => $privateCloud, - 'logging_server' => $loggingServer, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * management_dns_zone_binding resource. - * - * @param string $project - * @param string $location - * @param string $privateCloud - * @param string $managementDnsZoneBinding - * - * @return string The formatted management_dns_zone_binding resource. - */ - public static function managementDnsZoneBindingName( - $project, - $location, - $privateCloud, - $managementDnsZoneBinding - ) { - return self::getManagementDnsZoneBindingNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_cloud' => $privateCloud, - 'management_dns_zone_binding' => $managementDnsZoneBinding, - ]); - } - - /** - * 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 - * network_peering resource. - * - * @param string $project - * @param string $location - * @param string $networkPeering - * - * @return string The formatted network_peering resource. - */ - public static function networkPeeringName( - $project, - $location, - $networkPeering - ) { - return self::getNetworkPeeringNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'network_peering' => $networkPeering, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * network_policy resource. - * - * @param string $project - * @param string $location - * @param string $networkPolicy - * - * @return string The formatted network_policy resource. - */ - public static function networkPolicyName( - $project, - $location, - $networkPolicy - ) { - return self::getNetworkPolicyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'network_policy' => $networkPolicy, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a node - * resource. - * - * @param string $project - * @param string $location - * @param string $privateCloud - * @param string $cluster - * @param string $node - * - * @return string The formatted node resource. - */ - public static function nodeName( - $project, - $location, - $privateCloud, - $cluster, - $node - ) { - return self::getNodeNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_cloud' => $privateCloud, - 'cluster' => $cluster, - 'node' => $node, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a node_type - * resource. - * - * @param string $project - * @param string $location - * @param string $nodeType - * - * @return string The formatted node_type resource. - */ - public static function nodeTypeName($project, $location, $nodeType) - { - return self::getNodeTypeNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'node_type' => $nodeType, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * private_cloud resource. - * - * @param string $project - * @param string $location - * @param string $privateCloud - * - * @return string The formatted private_cloud resource. - */ - public static function privateCloudName($project, $location, $privateCloud) - { - return self::getPrivateCloudNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_cloud' => $privateCloud, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * private_connection resource. - * - * @param string $project - * @param string $location - * @param string $privateConnection - * - * @return string The formatted private_connection resource. - */ - public static function privateConnectionName( - $project, - $location, - $privateConnection - ) { - return self::getPrivateConnectionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_connection' => $privateConnection, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a subnet - * resource. - * - * @param string $project - * @param string $location - * @param string $privateCloud - * @param string $subnet - * - * @return string The formatted subnet resource. - */ - public static function subnetName( - $project, - $location, - $privateCloud, - $subnet - ) { - return self::getSubnetNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'private_cloud' => $privateCloud, - 'subnet' => $subnet, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * vmware_engine_network resource. - * - * @param string $project - * @param string $location - * @param string $vmwareEngineNetwork - * - * @return string The formatted vmware_engine_network resource. - */ - public static function vmwareEngineNetworkName( - $project, - $location, - $vmwareEngineNetwork - ) { - return self::getVmwareEngineNetworkNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'vmware_engine_network' => $vmwareEngineNetwork, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - cluster: projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster} - * - dnsBindPermission: projects/{project}/locations/{location}/dnsBindPermission - * - dnsForwarding: projects/{project}/locations/{location}/privateClouds/{private_cloud}/dnsForwarding - * - externalAccessRule: projects/{project}/locations/{location}/networkPolicies/{network_policy}/externalAccessRules/{external_access_rule} - * - externalAddress: projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address} - * - hcxActivationKey: projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key} - * - location: projects/{project}/locations/{location} - * - loggingServer: projects/{project}/locations/{location}/privateClouds/{private_cloud}/loggingServers/{logging_server} - * - managementDnsZoneBinding: projects/{project}/locations/{location}/privateClouds/{private_cloud}/managementDnsZoneBindings/{management_dns_zone_binding} - * - network: projects/{project}/global/networks/{network} - * - networkPeering: projects/{project}/locations/{location}/networkPeerings/{network_peering} - * - networkPolicy: projects/{project}/locations/{location}/networkPolicies/{network_policy} - * - node: projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node} - * - nodeType: projects/{project}/locations/{location}/nodeTypes/{node_type} - * - privateCloud: projects/{project}/locations/{location}/privateClouds/{private_cloud} - * - privateConnection: projects/{project}/locations/{location}/privateConnections/{private_connection} - * - subnet: projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet} - * - vmwareEngineNetwork: projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network} - * - * 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 'vmwareengine.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 cluster in a given private cloud. - * Creating a new cluster provides additional nodes for - * use in the parent private cloud and requires sufficient [node - * quota](https://cloud.google.com/vmware-engine/quotas). - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $clusterId = 'cluster_id'; - * $cluster = new Cluster(); - * $operationResponse = $vmwareEngineClient->createCluster($formattedParent, $clusterId, $cluster); - * $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 = $vmwareEngineClient->createCluster($formattedParent, $clusterId, $cluster); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud to create a new cluster - * in. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param string $clusterId Required. The user-provided identifier of the new `Cluster`. - * This identifier must be unique among clusters within the parent and becomes - * the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param Cluster $cluster Required. The initial description of the new cluster. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @type bool $validateOnly - * Optional. True if you want the request to be validated and not executed; - * false otherwise. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createCluster( - $parent, - $clusterId, - $cluster, - array $optionalArgs = [] - ) { - $request = new CreateClusterRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setClusterId($clusterId); - $request->setCluster($cluster); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new external access rule in a given network policy. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - * $externalAccessRule = new ExternalAccessRule(); - * $externalAccessRuleId = 'external_access_rule_id'; - * $operationResponse = $vmwareEngineClient->createExternalAccessRule($formattedParent, $externalAccessRule, $externalAccessRuleId); - * $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 = $vmwareEngineClient->createExternalAccessRule($formattedParent, $externalAccessRule, $externalAccessRuleId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createExternalAccessRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the network policy - * to create a new external access firewall rule in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @param ExternalAccessRule $externalAccessRule Required. The initial description of a new external access rule. - * @param string $externalAccessRuleId Required. The user-provided identifier of the `ExternalAccessRule` to be - * created. This identifier must be unique among `ExternalAccessRule` - * resources within the parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createExternalAccessRule( - $parent, - $externalAccessRule, - $externalAccessRuleId, - array $optionalArgs = [] - ) { - $request = new CreateExternalAccessRuleRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setExternalAccessRule($externalAccessRule); - $request->setExternalAccessRuleId($externalAccessRuleId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateExternalAccessRule', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new `ExternalAddress` resource in a given private cloud. The - * network policy that corresponds to the private cloud must have the external - * IP address network service enabled (`NetworkPolicy.external_ip`). - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $externalAddress = new ExternalAddress(); - * $externalAddressId = 'external_address_id'; - * $operationResponse = $vmwareEngineClient->createExternalAddress($formattedParent, $externalAddress, $externalAddressId); - * $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 = $vmwareEngineClient->createExternalAddress($formattedParent, $externalAddress, $externalAddressId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createExternalAddress'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud - * to create a new external IP address in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param ExternalAddress $externalAddress Required. The initial description of a new external IP address. - * @param string $externalAddressId Required. The user-provided identifier of the `ExternalAddress` to be - * created. This identifier must be unique among `ExternalAddress` resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createExternalAddress( - $parent, - $externalAddress, - $externalAddressId, - array $optionalArgs = [] - ) { - $request = new CreateExternalAddressRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setExternalAddress($externalAddress); - $request->setExternalAddressId($externalAddressId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateExternalAddress', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new HCX activation key in a given private cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $hcxActivationKey = new HcxActivationKey(); - * $hcxActivationKeyId = 'hcx_activation_key_id'; - * $operationResponse = $vmwareEngineClient->createHcxActivationKey($formattedParent, $hcxActivationKey, $hcxActivationKeyId); - * $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 = $vmwareEngineClient->createHcxActivationKey($formattedParent, $hcxActivationKey, $hcxActivationKeyId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createHcxActivationKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud to create the key for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @param HcxActivationKey $hcxActivationKey Required. The initial description of a new HCX activation key. When - * creating a new key, this field must be an empty object. - * @param string $hcxActivationKeyId Required. The user-provided identifier of the `HcxActivationKey` to be - * created. This identifier must be unique among `HcxActivationKey` resources - * within the parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createHcxActivationKey( - $parent, - $hcxActivationKey, - $hcxActivationKeyId, - array $optionalArgs = [] - ) { - $request = new CreateHcxActivationKeyRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setHcxActivationKey($hcxActivationKey); - $request->setHcxActivationKeyId($hcxActivationKeyId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateHcxActivationKey', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Create a new logging server for a given private cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $loggingServer = new LoggingServer(); - * $loggingServerId = 'logging_server_id'; - * $operationResponse = $vmwareEngineClient->createLoggingServer($formattedParent, $loggingServer, $loggingServerId); - * $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 = $vmwareEngineClient->createLoggingServer($formattedParent, $loggingServer, $loggingServerId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createLoggingServer'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud - * to create a new Logging Server in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param LoggingServer $loggingServer Required. The initial description of a new logging server. - * @param string $loggingServerId Required. The user-provided identifier of the `LoggingServer` to be - * created. This identifier must be unique among `LoggingServer` resources - * within the parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createLoggingServer( - $parent, - $loggingServer, - $loggingServerId, - array $optionalArgs = [] - ) { - $request = new CreateLoggingServerRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setLoggingServer($loggingServer); - $request->setLoggingServerId($loggingServerId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateLoggingServer', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new `ManagementDnsZoneBinding` resource in a private cloud. - * This RPC creates the DNS binding and the resource that represents the - * DNS binding of the consumer VPC network to the management DNS zone. A - * management DNS zone is the Cloud DNS cross-project binding zone that - * VMware Engine creates for each private cloud. It contains FQDNs and - * corresponding IP addresses for the private cloud's ESXi hosts and - * management VM appliances like vCenter and NSX Manager. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $managementDnsZoneBinding = new ManagementDnsZoneBinding(); - * $managementDnsZoneBindingId = 'management_dns_zone_binding_id'; - * $operationResponse = $vmwareEngineClient->createManagementDnsZoneBinding($formattedParent, $managementDnsZoneBinding, $managementDnsZoneBindingId); - * $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 = $vmwareEngineClient->createManagementDnsZoneBinding($formattedParent, $managementDnsZoneBinding, $managementDnsZoneBindingId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createManagementDnsZoneBinding'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud - * to create a new management DNS zone binding for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param ManagementDnsZoneBinding $managementDnsZoneBinding Required. The initial values for a new management DNS zone binding. - * @param string $managementDnsZoneBindingId Required. The user-provided identifier of the `ManagementDnsZoneBinding` - * resource to be created. This identifier must be unique among - * `ManagementDnsZoneBinding` resources within the parent and becomes the - * final token in the name URI. The identifier must meet the following - * requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createManagementDnsZoneBinding( - $parent, - $managementDnsZoneBinding, - $managementDnsZoneBindingId, - array $optionalArgs = [] - ) { - $request = new CreateManagementDnsZoneBindingRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setManagementDnsZoneBinding($managementDnsZoneBinding); - $request->setManagementDnsZoneBindingId($managementDnsZoneBindingId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateManagementDnsZoneBinding', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new network peering between the peer network and VMware Engine - * network provided in a `NetworkPeering` resource. NetworkPeering is a - * global resource and location can only be global. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * $networkPeeringId = 'network_peering_id'; - * $networkPeering = new NetworkPeering(); - * $operationResponse = $vmwareEngineClient->createNetworkPeering($formattedParent, $networkPeeringId, $networkPeering); - * $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 = $vmwareEngineClient->createNetworkPeering($formattedParent, $networkPeeringId, $networkPeering); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createNetworkPeering'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location to create the new network - * peering in. This value is always `global`, because `NetworkPeering` is a - * global resource. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param string $networkPeeringId Required. The user-provided identifier of the new `NetworkPeering`. - * This identifier must be unique among `NetworkPeering` resources within the - * parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param NetworkPeering $networkPeering Required. The initial description of the new network peering. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createNetworkPeering( - $parent, - $networkPeeringId, - $networkPeering, - array $optionalArgs = [] - ) { - $request = new CreateNetworkPeeringRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setNetworkPeeringId($networkPeeringId); - $request->setNetworkPeering($networkPeering); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateNetworkPeering', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new network policy in a given VMware Engine network of a - * project and location (region). A new network policy cannot be created if - * another network policy already exists in the same scope. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * $networkPolicyId = 'network_policy_id'; - * $networkPolicy = new NetworkPolicy(); - * $operationResponse = $vmwareEngineClient->createNetworkPolicy($formattedParent, $networkPolicyId, $networkPolicy); - * $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 = $vmwareEngineClient->createNetworkPolicy($formattedParent, $networkPolicyId, $networkPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createNetworkPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location (region) - * to create the new network policy in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1` - * @param string $networkPolicyId Required. The user-provided identifier of the network policy to be created. - * This identifier must be unique within parent - * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes - * the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param NetworkPolicy $networkPolicy Required. The network policy configuration to use in the request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createNetworkPolicy( - $parent, - $networkPolicyId, - $networkPolicy, - array $optionalArgs = [] - ) { - $request = new CreateNetworkPolicyRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setNetworkPolicyId($networkPolicyId); - $request->setNetworkPolicy($networkPolicy); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateNetworkPolicy', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new `PrivateCloud` resource in a given project and location. - * Private clouds of type `STANDARD` and - * `TIME_LIMITED` are zonal resources, `STRETCHED` private clouds are - * regional. - * Creating a private cloud also creates a [management - * cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) - * for that private cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * $privateCloudId = 'private_cloud_id'; - * $privateCloud = new PrivateCloud(); - * $operationResponse = $vmwareEngineClient->createPrivateCloud($formattedParent, $privateCloudId, $privateCloud); - * $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 = $vmwareEngineClient->createPrivateCloud($formattedParent, $privateCloudId, $privateCloud); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createPrivateCloud'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location to create the new - * private cloud in. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param string $privateCloudId Required. The user-provided identifier of the private cloud to be created. - * This identifier must be unique among each `PrivateCloud` within the parent - * and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param PrivateCloud $privateCloud Required. The initial description of the new private cloud. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @type bool $validateOnly - * Optional. True if you want the request to be validated and not executed; - * false otherwise. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createPrivateCloud( - $parent, - $privateCloudId, - $privateCloud, - array $optionalArgs = [] - ) { - $request = new CreatePrivateCloudRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPrivateCloudId($privateCloudId); - $request->setPrivateCloud($privateCloud); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreatePrivateCloud', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new private connection that can be used for accessing private - * Clouds. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * $privateConnectionId = 'private_connection_id'; - * $privateConnection = new PrivateConnection(); - * $operationResponse = $vmwareEngineClient->createPrivateConnection($formattedParent, $privateConnectionId, $privateConnection); - * $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 = $vmwareEngineClient->createPrivateConnection($formattedParent, $privateConnectionId, $privateConnection); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createPrivateConnection'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location to create the new private - * connection in. Private connection is a regional resource. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-central1` - * @param string $privateConnectionId Required. The user-provided identifier of the new private connection. - * This identifier must be unique among private connection resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param PrivateConnection $privateConnection Required. The initial description of the new private connection. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createPrivateConnection( - $parent, - $privateConnectionId, - $privateConnection, - array $optionalArgs = [] - ) { - $request = new CreatePrivateConnectionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPrivateConnectionId($privateConnectionId); - $request->setPrivateConnection($privateConnection); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreatePrivateConnection', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new VMware Engine network that can be used by a private cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * $vmwareEngineNetworkId = 'vmware_engine_network_id'; - * $vmwareEngineNetwork = new VmwareEngineNetwork(); - * $operationResponse = $vmwareEngineClient->createVmwareEngineNetwork($formattedParent, $vmwareEngineNetworkId, $vmwareEngineNetwork); - * $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 = $vmwareEngineClient->createVmwareEngineNetwork($formattedParent, $vmwareEngineNetworkId, $vmwareEngineNetwork); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createVmwareEngineNetwork'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location to create the new VMware Engine - * network in. A VMware Engine network of type - * `LEGACY` is a regional resource, and a VMware - * Engine network of type `STANDARD` is a global resource. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global` - * @param string $vmwareEngineNetworkId Required. The user-provided identifier of the new VMware Engine network. - * This identifier must be unique among VMware Engine network resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * - * * For networks of type LEGACY, adheres to the format: - * `{region-id}-default`. Replace `{region-id}` with the region where you want - * to create the VMware Engine network. For example, "us-central1-default". - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param VmwareEngineNetwork $vmwareEngineNetwork Required. The initial description of the new VMware Engine network. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 createVmwareEngineNetwork( - $parent, - $vmwareEngineNetworkId, - $vmwareEngineNetwork, - array $optionalArgs = [] - ) { - $request = new CreateVmwareEngineNetworkRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setVmwareEngineNetworkId($vmwareEngineNetworkId); - $request->setVmwareEngineNetwork($vmwareEngineNetwork); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateVmwareEngineNetwork', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a `Cluster` resource. To avoid unintended data loss, migrate or - * gracefully shut down any workloads running on the cluster before deletion. - * You cannot delete the management cluster of a private cloud using this - * method. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - * $operationResponse = $vmwareEngineClient->deleteCluster($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 = $vmwareEngineClient->deleteCluster($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the cluster to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteCluster($name, array $optionalArgs = []) - { - $request = new DeleteClusterRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single external access rule. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - * $operationResponse = $vmwareEngineClient->deleteExternalAccessRule($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 = $vmwareEngineClient->deleteExternalAccessRule($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteExternalAccessRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the external access firewall rule to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if the original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteExternalAccessRule($name, array $optionalArgs = []) - { - $request = new DeleteExternalAccessRuleRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteExternalAccessRule', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single external IP address. When you delete an external IP - * address, connectivity between the external IP address and the corresponding - * internal IP address is lost. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - * $operationResponse = $vmwareEngineClient->deleteExternalAddress($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 = $vmwareEngineClient->deleteExternalAddress($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteExternalAddress'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the external IP address to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if the original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteExternalAddress($name, array $optionalArgs = []) - { - $request = new DeleteExternalAddressRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteExternalAddress', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single logging server. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - * $operationResponse = $vmwareEngineClient->deleteLoggingServer($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 = $vmwareEngineClient->deleteLoggingServer($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteLoggingServer'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the logging server to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteLoggingServer($name, array $optionalArgs = []) - { - $request = new DeleteLoggingServerRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteLoggingServer', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a `ManagementDnsZoneBinding` resource. When a management DNS zone - * binding is deleted, the corresponding consumer VPC network is no longer - * bound to the management DNS zone. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - * $operationResponse = $vmwareEngineClient->deleteManagementDnsZoneBinding($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 = $vmwareEngineClient->deleteManagementDnsZoneBinding($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteManagementDnsZoneBinding'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the management DNS zone binding to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if the original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteManagementDnsZoneBinding( - $name, - array $optionalArgs = [] - ) { - $request = new DeleteManagementDnsZoneBindingRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteManagementDnsZoneBinding', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a `NetworkPeering` resource. When a network peering is deleted for - * a VMware Engine network, the peer network becomes inaccessible to that - * VMware Engine network. NetworkPeering is a global resource and location can - * only be global. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - * $operationResponse = $vmwareEngineClient->deleteNetworkPeering($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 = $vmwareEngineClient->deleteNetworkPeering($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteNetworkPeering'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the network peering to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/networkPeerings/my-peering` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteNetworkPeering($name, array $optionalArgs = []) - { - $request = new DeleteNetworkPeeringRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteNetworkPeering', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a `NetworkPolicy` resource. A network policy cannot be deleted - * when `NetworkService.state` is set to `RECONCILING` for either its external - * IP or internet access service. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - * $operationResponse = $vmwareEngineClient->deleteNetworkPolicy($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 = $vmwareEngineClient->deleteNetworkPolicy($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteNetworkPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the network policy to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteNetworkPolicy($name, array $optionalArgs = []) - { - $request = new DeleteNetworkPolicyRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteNetworkPolicy', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Schedules a `PrivateCloud` resource for deletion. - * - * A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` - * set to `DELETED` and `expireTime` set to the time when deletion is final - * and can no longer be reversed. The delete operation is marked as done - * as soon as the `PrivateCloud` is successfully scheduled for deletion - * (this also applies when `delayHours` is set to zero), and the operation is - * not kept in pending state until `PrivateCloud` is purged. - * `PrivateCloud` can be restored using `UndeletePrivateCloud` method before - * the `expireTime` elapses. When `expireTime` is reached, deletion is final - * and all private cloud resources are irreversibly removed and billing stops. - * During the final removal process, `PrivateCloud.state` is set to `PURGING`. - * `PrivateCloud` can be polled using standard `GET` method for the whole - * period of deletion and purging. It will not be returned only - * when it is completely purged. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $operationResponse = $vmwareEngineClient->deletePrivateCloud($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 = $vmwareEngineClient->deletePrivateCloud($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deletePrivateCloud'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the private cloud to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @type bool $force - * Optional. If set to true, cascade delete is enabled and all children of - * this private cloud resource are also deleted. When this flag is set to - * false, the private cloud will not be deleted if there are any children - * other than the management cluster. The management cluster is always - * deleted. - * @type int $delayHours - * Optional. Time delay of the deletion specified in hours. The default value - * is `3`. Specifying a non-zero value for this field changes the value of - * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned - * deletion time. Deletion can be cancelled before `expire_time` elapses using - * [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud]. - * Specifying a value of `0` for this field instead begins the deletion - * process and ceases billing immediately. During the final deletion process, - * the value of `PrivateCloud.state` becomes `PURGING`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deletePrivateCloud($name, array $optionalArgs = []) - { - $request = new DeletePrivateCloudRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['force'])) { - $request->setForce($optionalArgs['force']); - } - - if (isset($optionalArgs['delayHours'])) { - $request->setDelayHours($optionalArgs['delayHours']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeletePrivateCloud', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a `PrivateConnection` resource. When a private connection is - * deleted for a VMware Engine network, the connected network becomes - * inaccessible to that VMware Engine network. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - * $operationResponse = $vmwareEngineClient->deletePrivateConnection($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 = $vmwareEngineClient->deletePrivateConnection($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deletePrivateConnection'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the private connection to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateConnections/my-connection` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deletePrivateConnection($name, array $optionalArgs = []) - { - $request = new DeletePrivateConnectionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeletePrivateConnection', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware - * Engine network after all resources that refer to it are deleted. For - * example, a private cloud, a network peering, and a network policy can all - * refer to the same VMware Engine network. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - * $operationResponse = $vmwareEngineClient->deleteVmwareEngineNetwork($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 = $vmwareEngineClient->deleteVmwareEngineNetwork($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteVmwareEngineNetwork'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the VMware Engine network to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type string $etag - * Optional. Checksum used to ensure that the user-provided value is up to - * date before the server processes the request. The server compares provided - * checksum with the current checksum of the resource. If the user-provided - * value is out of date, this request returns an `ABORTED` error. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 deleteVmwareEngineNetwork($name, array $optionalArgs = []) - { - $request = new DeleteVmwareEngineNetworkRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - 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( - 'DeleteVmwareEngineNetwork', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Lists external IP addresses assigned to VMware workload VMs within the - * scope of the given network policy. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedNetworkPolicy = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->fetchNetworkPolicyExternalAddresses($formattedNetworkPolicy); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->fetchNetworkPolicyExternalAddresses($formattedNetworkPolicy); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $networkPolicy Required. The resource name of the network policy to query for assigned - * external IP addresses. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @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 fetchNetworkPolicyExternalAddresses( - $networkPolicy, - array $optionalArgs = [] - ) { - $request = new FetchNetworkPolicyExternalAddressesRequest(); - $requestParamHeaders = []; - $request->setNetworkPolicy($networkPolicy); - $requestParamHeaders['network_policy'] = $networkPolicy; - 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( - 'FetchNetworkPolicyExternalAddresses', - $optionalArgs, - FetchNetworkPolicyExternalAddressesResponse::class, - $request - ); - } - - /** - * Retrieves a `Cluster` resource by its resource name. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - * $response = $vmwareEngineClient->getCluster($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The cluster resource name to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - * @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\VmwareEngine\V1\Cluster - * - * @throws ApiException if the remote call fails - */ - public function getCluster($name, array $optionalArgs = []) - { - $request = new GetClusterRequest(); - $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( - 'GetCluster', - Cluster::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets all the principals having bind permission on the intranet VPC - * associated with the consumer project granted by the Grant API. - * DnsBindPermission is a global resource and location can only be global. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - * $response = $vmwareEngineClient->getDnsBindPermission($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the resource which stores the users/service accounts - * having the permission to bind to the corresponding intranet VPC of the - * consumer project. DnsBindPermission is a global resource. Resource names - * are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/dnsBindPermission` - * @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\VmwareEngine\V1\DnsBindPermission - * - * @throws ApiException if the remote call fails - */ - public function getDnsBindPermission($name, array $optionalArgs = []) - { - $request = new GetDnsBindPermissionRequest(); - $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( - 'GetDnsBindPermission', - DnsBindPermission::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of the `DnsForwarding` config. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $response = $vmwareEngineClient->getDnsForwarding($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of a `DnsForwarding` to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` - * @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\VmwareEngine\V1\DnsForwarding - * - * @throws ApiException if the remote call fails - */ - public function getDnsForwarding($name, array $optionalArgs = []) - { - $request = new GetDnsForwardingRequest(); - $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( - 'GetDnsForwarding', - DnsForwarding::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single external access rule. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - * $response = $vmwareEngineClient->getExternalAccessRule($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the external access firewall rule to - * retrieve. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` - * @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\VmwareEngine\V1\ExternalAccessRule - * - * @throws ApiException if the remote call fails - */ - public function getExternalAccessRule($name, array $optionalArgs = []) - { - $request = new GetExternalAccessRuleRequest(); - $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( - 'GetExternalAccessRule', - ExternalAccessRule::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single external IP address. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - * $response = $vmwareEngineClient->getExternalAddress($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the external IP address to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` - * @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\VmwareEngine\V1\ExternalAddress - * - * @throws ApiException if the remote call fails - */ - public function getExternalAddress($name, array $optionalArgs = []) - { - $request = new GetExternalAddressRequest(); - $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( - 'GetExternalAddress', - ExternalAddress::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a `HcxActivationKey` resource by its resource name. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); - * $response = $vmwareEngineClient->getHcxActivationKey($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the HCX activation key to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` - * @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\VmwareEngine\V1\HcxActivationKey - * - * @throws ApiException if the remote call fails - */ - public function getHcxActivationKey($name, array $optionalArgs = []) - { - $request = new GetHcxActivationKeyRequest(); - $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( - 'GetHcxActivationKey', - HcxActivationKey::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a logging server. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - * $response = $vmwareEngineClient->getLoggingServer($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the Logging Server to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` - * @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\VmwareEngine\V1\LoggingServer - * - * @throws ApiException if the remote call fails - */ - public function getLoggingServer($name, array $optionalArgs = []) - { - $request = new GetLoggingServerRequest(); - $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( - 'GetLoggingServer', - LoggingServer::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a 'ManagementDnsZoneBinding' resource by its resource name. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - * $response = $vmwareEngineClient->getManagementDnsZoneBinding($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the management DNS zone binding to - * retrieve. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` - * @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\VmwareEngine\V1\ManagementDnsZoneBinding - * - * @throws ApiException if the remote call fails - */ - public function getManagementDnsZoneBinding($name, array $optionalArgs = []) - { - $request = new GetManagementDnsZoneBindingRequest(); - $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( - 'GetManagementDnsZoneBinding', - ManagementDnsZoneBinding::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a `NetworkPeering` resource by its resource name. The resource - * contains details of the network peering, such as peered - * networks, import and export custom route configurations, and peering state. - * NetworkPeering is a global resource and location can only be global. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - * $response = $vmwareEngineClient->getNetworkPeering($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the network peering to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/networkPeerings/my-peering` - * @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\VmwareEngine\V1\NetworkPeering - * - * @throws ApiException if the remote call fails - */ - public function getNetworkPeering($name, array $optionalArgs = []) - { - $request = new GetNetworkPeeringRequest(); - $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( - 'GetNetworkPeering', - NetworkPeering::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a `NetworkPolicy` resource by its resource name. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - * $response = $vmwareEngineClient->getNetworkPolicy($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the network policy to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - * @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\VmwareEngine\V1\NetworkPolicy - * - * @throws ApiException if the remote call fails - */ - public function getNetworkPolicy($name, array $optionalArgs = []) - { - $request = new GetNetworkPolicyRequest(); - $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( - 'GetNetworkPolicy', - NetworkPolicy::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single node. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); - * $response = $vmwareEngineClient->getNode($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the node to retrieve. - * For example: - * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}` - * @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\VmwareEngine\V1\Node - * - * @throws ApiException if the remote call fails - */ - public function getNode($name, array $optionalArgs = []) - { - $request = new GetNodeRequest(); - $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( - 'GetNode', - Node::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single `NodeType`. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); - * $response = $vmwareEngineClient->getNodeType($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the node type to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` - * @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\VmwareEngine\V1\NodeType - * - * @throws ApiException if the remote call fails - */ - public function getNodeType($name, array $optionalArgs = []) - { - $request = new GetNodeTypeRequest(); - $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( - 'GetNodeType', - NodeType::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a `PrivateCloud` resource by its resource name. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $response = $vmwareEngineClient->getPrivateCloud($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the private cloud to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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\VmwareEngine\V1\PrivateCloud - * - * @throws ApiException if the remote call fails - */ - public function getPrivateCloud($name, array $optionalArgs = []) - { - $request = new GetPrivateCloudRequest(); - $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( - 'GetPrivateCloud', - PrivateCloud::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a `PrivateConnection` resource by its resource name. The resource - * contains details of the private connection, such as connected - * network, routing mode and state. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - * $response = $vmwareEngineClient->getPrivateConnection($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the private connection to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateConnections/my-connection` - * @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\VmwareEngine\V1\PrivateConnection - * - * @throws ApiException if the remote call fails - */ - public function getPrivateConnection($name, array $optionalArgs = []) - { - $request = new GetPrivateConnectionRequest(); - $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( - 'GetPrivateConnection', - PrivateConnection::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single subnet. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); - * $response = $vmwareEngineClient->getSubnet($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the subnet to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` - * @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\VmwareEngine\V1\Subnet - * - * @throws ApiException if the remote call fails - */ - public function getSubnet($name, array $optionalArgs = []) - { - $request = new GetSubnetRequest(); - $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( - 'GetSubnet', - Subnet::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Retrieves a `VmwareEngineNetwork` resource by its resource name. The - * resource contains details of the VMware Engine network, such as its VMware - * Engine network type, peered networks in a service project, and state - * (for example, `CREATING`, `ACTIVE`, `DELETING`). - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - * $response = $vmwareEngineClient->getVmwareEngineNetwork($formattedName); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the VMware Engine network to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - * @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\VmwareEngine\V1\VmwareEngineNetwork - * - * @throws ApiException if the remote call fails - */ - public function getVmwareEngineNetwork($name, array $optionalArgs = []) - { - $request = new GetVmwareEngineNetworkRequest(); - $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( - 'GetVmwareEngineNetwork', - VmwareEngineNetwork::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Grants the bind permission to the customer provided principal(user / - * service account) to bind their DNS zone with the intranet VPC associated - * with the project. DnsBindPermission is a global resource and location can - * only be global. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - * $principal = new Principal(); - * $operationResponse = $vmwareEngineClient->grantDnsBindPermission($formattedName, $principal); - * $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 = $vmwareEngineClient->grantDnsBindPermission($formattedName, $principal); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'grantDnsBindPermission'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the resource which stores the users/service accounts - * having the permission to bind to the corresponding intranet VPC of the - * consumer project. DnsBindPermission is a global resource. Resource names - * are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/dnsBindPermission` - * @param Principal $principal Required. The consumer provided user/service account which needs to be - * granted permission to bind with the intranet VPC corresponding to the - * consumer project. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 grantDnsBindPermission( - $name, - $principal, - array $optionalArgs = [] - ) { - $request = new GrantDnsBindPermissionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setPrincipal($principal); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'GrantDnsBindPermission', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Lists `Cluster` resources in a given private cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listClusters($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listClusters($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud to query for clusters. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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 - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-cluster") - * (nodeCount = "3") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "example-cluster-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-cluster-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listClusters($parent, array $optionalArgs = []) - { - $request = new ListClustersRequest(); - $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( - 'ListClusters', - $optionalArgs, - ListClustersResponse::class, - $request - ); - } - - /** - * Lists `ExternalAccessRule` resources in the specified network policy. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listExternalAccessRules($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listExternalAccessRules($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the network policy to query for external - * access firewall rules. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of external access rules, you can - * exclude the ones named `example-rule` by specifying - * `name != "example-rule"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-rule") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-rule-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-rule-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listExternalAccessRules($parent, array $optionalArgs = []) - { - $request = new ListExternalAccessRulesRequest(); - $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( - 'ListExternalAccessRules', - $optionalArgs, - ListExternalAccessRulesResponse::class, - $request - ); - } - - /** - * Lists external IP addresses assigned to VMware workload VMs in a given - * private cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listExternalAddresses($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listExternalAddresses($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud to be queried for - * external IP addresses. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of IP addresses, you can - * exclude the ones named `example-ip` by specifying - * `name != "example-ip"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-ip") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-ip-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-ip-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listExternalAddresses($parent, array $optionalArgs = []) - { - $request = new ListExternalAddressesRequest(); - $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( - 'ListExternalAddresses', - $optionalArgs, - ListExternalAddressesResponse::class, - $request - ); - } - - /** - * Lists `HcxActivationKey` resources in a given private cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listHcxActivationKeys($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listHcxActivationKeys($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud - * to be queried for HCX activation keys. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @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 listHcxActivationKeys($parent, array $optionalArgs = []) - { - $request = new ListHcxActivationKeysRequest(); - $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( - 'ListHcxActivationKeys', - $optionalArgs, - ListHcxActivationKeysResponse::class, - $request - ); - } - - /** - * Lists logging servers configured for a given private - * cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listLoggingServers($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listLoggingServers($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud to be queried for - * logging servers. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of logging servers, you can - * exclude the ones named `example-server` by specifying - * `name != "example-server"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-server") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-server-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-server-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLoggingServers($parent, array $optionalArgs = []) - { - $request = new ListLoggingServersRequest(); - $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( - 'ListLoggingServers', - $optionalArgs, - ListLoggingServersResponse::class, - $request - ); - } - - /** - * Lists Consumer VPCs bound to Management DNS Zone of a given private cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listManagementDnsZoneBindings($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listManagementDnsZoneBindings($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud to be queried for - * management DNS zone bindings. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of Management DNS Zone Bindings, - * you can exclude the ones named `example-management-dns-zone-binding` by - * specifying `name != "example-management-dns-zone-binding"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-management-dns-zone-binding") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-management-dns-zone-binding-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-management-dns-zone-binding-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listManagementDnsZoneBindings( - $parent, - array $optionalArgs = [] - ) { - $request = new ListManagementDnsZoneBindingsRequest(); - $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( - 'ListManagementDnsZoneBindings', - $optionalArgs, - ListManagementDnsZoneBindingsResponse::class, - $request - ); - } - - /** - * Lists `NetworkPeering` resources in a given project. NetworkPeering is a - * global resource and location can only be global. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listNetworkPeerings($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listNetworkPeerings($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location (global) to query for - * network peerings. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-peering` by specifying - * `name != "example-peering"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-peering") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-peering-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-peering-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listNetworkPeerings($parent, array $optionalArgs = []) - { - $request = new ListNetworkPeeringsRequest(); - $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( - 'ListNetworkPeerings', - $optionalArgs, - ListNetworkPeeringsResponse::class, - $request - ); - } - - /** - * Lists `NetworkPolicy` resources in a specified project and location. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listNetworkPolicies($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listNetworkPolicies($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location (region) to query for - * network policies. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network policies, you can - * exclude the ones named `example-policy` by specifying - * `name != "example-policy"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-policy") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-policy-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-policy-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listNetworkPolicies($parent, array $optionalArgs = []) - { - $request = new ListNetworkPoliciesRequest(); - $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( - 'ListNetworkPolicies', - $optionalArgs, - ListNetworkPoliciesResponse::class, - $request - ); - } - - /** - * Lists node types - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listNodeTypes($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listNodeTypes($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location to be queried for node types. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of node types, you can - * exclude the ones named `standard-72` by specifying - * `name != "standard-72"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "standard-72") - * (virtual_cpu_count > 2) - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "standard-96") AND - * (virtual_cpu_count > 2) OR - * (name = "standard-72") - * ``` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 listNodeTypes($parent, array $optionalArgs = []) - { - $request = new ListNodeTypesRequest(); - $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( - 'ListNodeTypes', - $optionalArgs, - ListNodeTypesResponse::class, - $request - ); - } - - /** - * Lists nodes in a given cluster. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listNodes($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listNodes($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the cluster to be queried for nodes. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - * @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 listNodes($parent, array $optionalArgs = []) - { - $request = new ListNodesRequest(); - $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( - 'ListNodes', - $optionalArgs, - ListNodesResponse::class, - $request - ); - } - - /** - * Lists the network peering routes exchanged over a peering connection. - * NetworkPeering is a global resource and location can only be global. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listPeeringRoutes($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listPeeringRoutes($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the network peering to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/networkPeerings/my-peering` - * @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 expression that matches resources returned in the response. - * Currently, only filtering on the `direction` field is supported. To return - * routes imported from the peer network, provide "direction=INCOMING". To - * return routes exported from the VMware Engine network, provide - * "direction=OUTGOING". Other filter expressions return an error. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 listPeeringRoutes($parent, array $optionalArgs = []) - { - $request = new ListPeeringRoutesRequest(); - $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( - 'ListPeeringRoutes', - $optionalArgs, - ListPeeringRoutesResponse::class, - $request - ); - } - - /** - * Lists `PrivateCloud` resources in a given project and location. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listPrivateClouds($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listPrivateClouds($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud to be queried for - * clusters. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison operator, and the - * value that you want to use for filtering. The value must be a string, a - * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or - * `<`. - * - * For example, if you are filtering a list of private clouds, you can exclude - * the ones named `example-pc` by specifying `name != "example-pc"`. - * - * You can also filter nested fields. For example, you could specify - * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds - * only if they have a matching address in their network configuration. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-pc") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "private-cloud-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "private-cloud-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listPrivateClouds($parent, array $optionalArgs = []) - { - $request = new ListPrivateCloudsRequest(); - $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( - 'ListPrivateClouds', - $optionalArgs, - ListPrivateCloudsResponse::class, - $request - ); - } - - /** - * Lists the private connection routes exchanged over a peering connection. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listPrivateConnectionPeeringRoutes($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listPrivateConnectionPeeringRoutes($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private connection to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-west1/privateConnections/my-connection` - * @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 listPrivateConnectionPeeringRoutes( - $parent, - array $optionalArgs = [] - ) { - $request = new ListPrivateConnectionPeeringRoutesRequest(); - $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( - 'ListPrivateConnectionPeeringRoutes', - $optionalArgs, - ListPrivateConnectionPeeringRoutesResponse::class, - $request - ); - } - - /** - * Lists `PrivateConnection` resources in a given project and location. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listPrivateConnections($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listPrivateConnections($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location to query for - * private connections. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of private connections, you can - * exclude the ones named `example-connection` by specifying - * `name != "example-connection"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-connection") - * (createTime > "2022-09-22T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-connection-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-connection-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listPrivateConnections($parent, array $optionalArgs = []) - { - $request = new ListPrivateConnectionsRequest(); - $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( - 'ListPrivateConnections', - $optionalArgs, - ListPrivateConnectionsResponse::class, - $request - ); - } - - /** - * Lists subnets in a given private cloud. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listSubnets($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listSubnets($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the private cloud to be queried for - * subnets. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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 listSubnets($parent, array $optionalArgs = []) - { - $request = new ListSubnetsRequest(); - $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( - 'ListSubnets', - $optionalArgs, - ListSubnetsResponse::class, - $request - ); - } - - /** - * Lists `VmwareEngineNetwork` resources in a given project and location. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listVmwareEngineNetworks($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listVmwareEngineNetworks($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $parent Required. The resource name of the location to query for - * VMware Engine networks. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @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 expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-network` by specifying - * `name != "example-network"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-network") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-network-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-network-2") - * ``` - * @type string $orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is 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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listVmwareEngineNetworks($parent, array $optionalArgs = []) - { - $request = new ListVmwareEngineNetworksRequest(); - $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( - 'ListVmwareEngineNetworks', - $optionalArgs, - ListVmwareEngineNetworksResponse::class, - $request - ); - } - - /** - * Retries to create a `ManagementDnsZoneBinding` resource that is - * in failed state. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - * $operationResponse = $vmwareEngineClient->repairManagementDnsZoneBinding($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 = $vmwareEngineClient->repairManagementDnsZoneBinding($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'repairManagementDnsZoneBinding'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the management DNS zone binding to repair. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 repairManagementDnsZoneBinding( - $name, - array $optionalArgs = [] - ) { - $request = new RepairManagementDnsZoneBindingRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'RepairManagementDnsZoneBinding', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Resets credentials of the NSX appliance. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedPrivateCloud = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $operationResponse = $vmwareEngineClient->resetNsxCredentials($formattedPrivateCloud); - * $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 = $vmwareEngineClient->resetNsxCredentials($formattedPrivateCloud); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'resetNsxCredentials'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $privateCloud Required. The resource name of the private cloud - * to reset credentials for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 resetNsxCredentials($privateCloud, array $optionalArgs = []) - { - $request = new ResetNsxCredentialsRequest(); - $requestParamHeaders = []; - $request->setPrivateCloud($privateCloud); - $requestParamHeaders['private_cloud'] = $privateCloud; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'ResetNsxCredentials', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Resets credentials of the Vcenter appliance. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedPrivateCloud = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $operationResponse = $vmwareEngineClient->resetVcenterCredentials($formattedPrivateCloud); - * $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 = $vmwareEngineClient->resetVcenterCredentials($formattedPrivateCloud); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'resetVcenterCredentials'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $privateCloud Required. The resource name of the private cloud - * to reset credentials for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type string $username - * Optional. The username of the user to be to reset the credentials. - * The default value of this field is CloudOwner@gve.local. - * The provided value should be one of the following: - * solution-user-01@gve.local, - * solution-user-02@gve.local, - * solution-user-03@gve.local, - * solution-user-04@gve.local, - * solution-user-05@gve.local, - * zertoadmin@gve.local. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 resetVcenterCredentials( - $privateCloud, - array $optionalArgs = [] - ) { - $request = new ResetVcenterCredentialsRequest(); - $requestParamHeaders = []; - $request->setPrivateCloud($privateCloud); - $requestParamHeaders['private_cloud'] = $privateCloud; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['username'])) { - $request->setUsername($optionalArgs['username']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'ResetVcenterCredentials', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Revokes the bind permission from the customer provided principal(user / - * service account) on the intranet VPC associated with the consumer project. - * DnsBindPermission is a global resource and location can only be global. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - * $principal = new Principal(); - * $operationResponse = $vmwareEngineClient->revokeDnsBindPermission($formattedName, $principal); - * $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 = $vmwareEngineClient->revokeDnsBindPermission($formattedName, $principal); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'revokeDnsBindPermission'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the resource which stores the users/service accounts - * having the permission to bind to the corresponding intranet VPC of the - * consumer project. DnsBindPermission is a global resource. Resource names - * are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/dnsBindPermission` - * @param Principal $principal Required. The consumer provided user/service account which needs to be - * granted permission to bind with the intranet VPC corresponding to the - * consumer project. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 revokeDnsBindPermission( - $name, - $principal, - array $optionalArgs = [] - ) { - $request = new RevokeDnsBindPermissionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setPrincipal($principal); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'RevokeDnsBindPermission', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets details of credentials for NSX appliance. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedPrivateCloud = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $response = $vmwareEngineClient->showNsxCredentials($formattedPrivateCloud); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $privateCloud Required. The resource name of the private cloud - * to be queried for credentials. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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\VmwareEngine\V1\Credentials - * - * @throws ApiException if the remote call fails - */ - public function showNsxCredentials($privateCloud, array $optionalArgs = []) - { - $request = new ShowNsxCredentialsRequest(); - $requestParamHeaders = []; - $request->setPrivateCloud($privateCloud); - $requestParamHeaders['private_cloud'] = $privateCloud; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ShowNsxCredentials', - Credentials::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of credentials for Vcenter appliance. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedPrivateCloud = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $response = $vmwareEngineClient->showVcenterCredentials($formattedPrivateCloud); - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $privateCloud Required. The resource name of the private cloud - * to be queried for credentials. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param array $optionalArgs { - * Optional. - * - * @type string $username - * Optional. The username of the user to be queried for credentials. - * The default value of this field is CloudOwner@gve.local. - * The provided value must be one of the following: - * CloudOwner@gve.local, - * solution-user-01@gve.local, - * solution-user-02@gve.local, - * solution-user-03@gve.local, - * solution-user-04@gve.local, - * solution-user-05@gve.local, - * zertoadmin@gve.local. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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\VmwareEngine\V1\Credentials - * - * @throws ApiException if the remote call fails - */ - public function showVcenterCredentials( - $privateCloud, - array $optionalArgs = [] - ) { - $request = new ShowVcenterCredentialsRequest(); - $requestParamHeaders = []; - $request->setPrivateCloud($privateCloud); - $requestParamHeaders['private_cloud'] = $privateCloud; - if (isset($optionalArgs['username'])) { - $request->setUsername($optionalArgs['username']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'ShowVcenterCredentials', - Credentials::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Restores a private cloud that was previously scheduled for deletion by - * `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has - * `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to - * the time when deletion can no longer be reversed. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $formattedName = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - * $operationResponse = $vmwareEngineClient->undeletePrivateCloud($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 = $vmwareEngineClient->undeletePrivateCloud($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'undeletePrivateCloud'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the private cloud scheduled for deletion. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 undeletePrivateCloud($name, array $optionalArgs = []) - { - $request = new UndeletePrivateCloudRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UndeletePrivateCloud', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Modifies a `Cluster` resource. Only fields specified in `updateMask` are - * applied. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $updateMask = new FieldMask(); - * $cluster = new Cluster(); - * $operationResponse = $vmwareEngineClient->updateCluster($updateMask, $cluster); - * $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 = $vmwareEngineClient->updateCluster($updateMask, $cluster); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateCluster'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `Cluster` resource by the update. The fields specified in the `updateMask` - * 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 - * all fields will be overwritten. - * @param Cluster $cluster Required. The description of the cluster. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. The request ID must be a valid UUID with the exception that - * zero UUID is not supported (00000000-0000-0000-0000-000000000000). - * @type bool $validateOnly - * Optional. True if you want the request to be validated and not executed; - * false otherwise. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateCluster( - $updateMask, - $cluster, - array $optionalArgs = [] - ) { - $request = new UpdateClusterRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setCluster($cluster); - $requestParamHeaders['cluster.name'] = $cluster->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateCluster', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of the `DnsForwarding` config, like associated - * domains. Only fields specified in `update_mask` are applied. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $dnsForwarding = new DnsForwarding(); - * $updateMask = new FieldMask(); - * $operationResponse = $vmwareEngineClient->updateDnsForwarding($dnsForwarding, $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 = $vmwareEngineClient->updateDnsForwarding($dnsForwarding, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateDnsForwarding'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param DnsForwarding $dnsForwarding Required. DnsForwarding config details. - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `DnsForwarding` 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 all fields will be overwritten. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateDnsForwarding( - $dnsForwarding, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateDnsForwardingRequest(); - $requestParamHeaders = []; - $request->setDnsForwarding($dnsForwarding); - $request->setUpdateMask($updateMask); - $requestParamHeaders['dns_forwarding.name'] = $dnsForwarding->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateDnsForwarding', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single external access rule. - * Only fields specified in `update_mask` are applied. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $updateMask = new FieldMask(); - * $externalAccessRule = new ExternalAccessRule(); - * $operationResponse = $vmwareEngineClient->updateExternalAccessRule($updateMask, $externalAccessRule); - * $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 = $vmwareEngineClient->updateExternalAccessRule($updateMask, $externalAccessRule); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateExternalAccessRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `ExternalAccessRule` 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 all fields will be overwritten. - * @param ExternalAccessRule $externalAccessRule Required. Description of the external access rule. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateExternalAccessRule( - $updateMask, - $externalAccessRule, - array $optionalArgs = [] - ) { - $request = new UpdateExternalAccessRuleRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setExternalAccessRule($externalAccessRule); - $requestParamHeaders[ - 'external_access_rule.name' - ] = $externalAccessRule->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateExternalAccessRule', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single external IP address. - * Only fields specified in `update_mask` are applied. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $updateMask = new FieldMask(); - * $externalAddress = new ExternalAddress(); - * $operationResponse = $vmwareEngineClient->updateExternalAddress($updateMask, $externalAddress); - * $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 = $vmwareEngineClient->updateExternalAddress($updateMask, $externalAddress); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateExternalAddress'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `ExternalAddress` 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 all fields will be overwritten. - * @param ExternalAddress $externalAddress Required. External IP address description. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateExternalAddress( - $updateMask, - $externalAddress, - array $optionalArgs = [] - ) { - $request = new UpdateExternalAddressRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setExternalAddress($externalAddress); - $requestParamHeaders[ - 'external_address.name' - ] = $externalAddress->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateExternalAddress', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single logging server. - * Only fields specified in `update_mask` are applied. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $updateMask = new FieldMask(); - * $loggingServer = new LoggingServer(); - * $operationResponse = $vmwareEngineClient->updateLoggingServer($updateMask, $loggingServer); - * $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 = $vmwareEngineClient->updateLoggingServer($updateMask, $loggingServer); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateLoggingServer'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `LoggingServer` 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 all fields will be overwritten. - * @param LoggingServer $loggingServer Required. Logging server description. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateLoggingServer( - $updateMask, - $loggingServer, - array $optionalArgs = [] - ) { - $request = new UpdateLoggingServerRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setLoggingServer($loggingServer); - $requestParamHeaders['logging_server.name'] = $loggingServer->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateLoggingServer', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates a `ManagementDnsZoneBinding` resource. - * Only fields specified in `update_mask` are applied. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $updateMask = new FieldMask(); - * $managementDnsZoneBinding = new ManagementDnsZoneBinding(); - * $operationResponse = $vmwareEngineClient->updateManagementDnsZoneBinding($updateMask, $managementDnsZoneBinding); - * $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 = $vmwareEngineClient->updateManagementDnsZoneBinding($updateMask, $managementDnsZoneBinding); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateManagementDnsZoneBinding'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `ManagementDnsZoneBinding` 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 all fields will be overwritten. - * @param ManagementDnsZoneBinding $managementDnsZoneBinding Required. New values to update the management DNS zone binding with. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateManagementDnsZoneBinding( - $updateMask, - $managementDnsZoneBinding, - array $optionalArgs = [] - ) { - $request = new UpdateManagementDnsZoneBindingRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setManagementDnsZoneBinding($managementDnsZoneBinding); - $requestParamHeaders[ - 'management_dns_zone_binding.name' - ] = $managementDnsZoneBinding->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateManagementDnsZoneBinding', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Modifies a `NetworkPeering` resource. Only the `description` field can be - * updated. Only fields specified in `updateMask` are applied. NetworkPeering - * is a global resource and location can only be global. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $networkPeering = new NetworkPeering(); - * $updateMask = new FieldMask(); - * $operationResponse = $vmwareEngineClient->updateNetworkPeering($networkPeering, $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 = $vmwareEngineClient->updateNetworkPeering($networkPeering, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateNetworkPeering'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param NetworkPeering $networkPeering Required. Network peering description. - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `NetworkPeering` 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 all fields will be overwritten. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateNetworkPeering( - $networkPeering, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateNetworkPeeringRequest(); - $requestParamHeaders = []; - $request->setNetworkPeering($networkPeering); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'network_peering.name' - ] = $networkPeering->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateNetworkPeering', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Modifies a `NetworkPolicy` resource. Only the following fields can be - * updated: `internet_access`, `external_ip`, `edge_services_cidr`. - * Only fields specified in `updateMask` are applied. When updating a network - * policy, the external IP network service can only be disabled if there are - * no external IP addresses present in the scope of the policy. Also, a - * `NetworkService` cannot be updated when `NetworkService.state` is set - * to `RECONCILING`. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $networkPolicy = new NetworkPolicy(); - * $updateMask = new FieldMask(); - * $operationResponse = $vmwareEngineClient->updateNetworkPolicy($networkPolicy, $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 = $vmwareEngineClient->updateNetworkPolicy($networkPolicy, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateNetworkPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param NetworkPolicy $networkPolicy Required. Network policy description. - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `NetworkPolicy` 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 all fields will be overwritten. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateNetworkPolicy( - $networkPolicy, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateNetworkPolicyRequest(); - $requestParamHeaders = []; - $request->setNetworkPolicy($networkPolicy); - $request->setUpdateMask($updateMask); - $requestParamHeaders['network_policy.name'] = $networkPolicy->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateNetworkPolicy', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Modifies a `PrivateCloud` resource. Only the following fields can be - * updated: `description`. - * Only fields specified in `updateMask` are applied. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $privateCloud = new PrivateCloud(); - * $updateMask = new FieldMask(); - * $operationResponse = $vmwareEngineClient->updatePrivateCloud($privateCloud, $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 = $vmwareEngineClient->updatePrivateCloud($privateCloud, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updatePrivateCloud'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param PrivateCloud $privateCloud Required. Private cloud description. - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `PrivateCloud` resource by the update. The fields specified in `updateMask` - * 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 - * all fields will be overwritten. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updatePrivateCloud( - $privateCloud, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdatePrivateCloudRequest(); - $requestParamHeaders = []; - $request->setPrivateCloud($privateCloud); - $request->setUpdateMask($updateMask); - $requestParamHeaders['private_cloud.name'] = $privateCloud->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdatePrivateCloud', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Modifies a `PrivateConnection` resource. Only `description` and - * `routing_mode` fields can be updated. Only fields specified in `updateMask` - * are applied. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $privateConnection = new PrivateConnection(); - * $updateMask = new FieldMask(); - * $operationResponse = $vmwareEngineClient->updatePrivateConnection($privateConnection, $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 = $vmwareEngineClient->updatePrivateConnection($privateConnection, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updatePrivateConnection'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param PrivateConnection $privateConnection Required. Private connection description. - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `PrivateConnection` 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 all fields will be overwritten. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updatePrivateConnection( - $privateConnection, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdatePrivateConnectionRequest(); - $requestParamHeaders = []; - $request->setPrivateConnection($privateConnection); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'private_connection.name' - ] = $privateConnection->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdatePrivateConnection', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single subnet. Only fields specified in - * `update_mask` are applied. - * - * *Note*: This API is synchronous and always returns a successful - * `google.longrunning.Operation` (LRO). The returned LRO will only have - * `done` and `response` fields. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $updateMask = new FieldMask(); - * $subnet = new Subnet(); - * $operationResponse = $vmwareEngineClient->updateSubnet($updateMask, $subnet); - * $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 = $vmwareEngineClient->updateSubnet($updateMask, $subnet); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateSubnet'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * `Subnet` 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 all fields will be overwritten. - * @param Subnet $subnet Required. Subnet description. - * @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 updateSubnet($updateMask, $subnet, array $optionalArgs = []) - { - $request = new UpdateSubnetRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setSubnet($subnet); - $requestParamHeaders['subnet.name'] = $subnet->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateSubnet', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Modifies a VMware Engine network resource. Only the following fields can be - * updated: `description`. Only fields specified in `updateMask` are - * applied. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $vmwareEngineNetwork = new VmwareEngineNetwork(); - * $updateMask = new FieldMask(); - * $operationResponse = $vmwareEngineClient->updateVmwareEngineNetwork($vmwareEngineNetwork, $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 = $vmwareEngineClient->updateVmwareEngineNetwork($vmwareEngineNetwork, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateVmwareEngineNetwork'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmwareEngineClient->close(); - * } - * ``` - * - * @param VmwareEngineNetwork $vmwareEngineNetwork Required. VMware Engine network description. - * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the - * VMware Engine network 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 all fields will be overwritten. Only the - * following fields can be updated: `description`. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 updateVmwareEngineNetwork( - $vmwareEngineNetwork, - $updateMask, - array $optionalArgs = [] - ) { - $request = new UpdateVmwareEngineNetworkRequest(); - $requestParamHeaders = []; - $request->setVmwareEngineNetwork($vmwareEngineNetwork); - $request->setUpdateMask($updateMask); - $requestParamHeaders[ - 'vmware_engine_network.name' - ] = $vmwareEngineNetwork->getName(); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateVmwareEngineNetwork', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $response = $vmwareEngineClient->getLocation(); - * } finally { - * $vmwareEngineClient->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: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $vmwareEngineClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmwareEngineClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmwareEngineClient->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: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $resource = 'resource'; - * $response = $vmwareEngineClient->getIamPolicy($resource); - * } finally { - * $vmwareEngineClient->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: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $vmwareEngineClient->setIamPolicy($resource, $policy); - * } finally { - * $vmwareEngineClient->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: - * ``` - * $vmwareEngineClient = new VmwareEngineClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $vmwareEngineClient->testIamPermissions($resource, $permissions); - * } finally { - * $vmwareEngineClient->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/VmwareEngine/src/V1/GetClusterRequest.php b/VmwareEngine/src/V1/GetClusterRequest.php index 7b4446234e34..765ce8ca31d1 100644 --- a/VmwareEngine/src/V1/GetClusterRequest.php +++ b/VmwareEngine/src/V1/GetClusterRequest.php @@ -25,7 +25,7 @@ class GetClusterRequest 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 cluster resource name to retrieve. diff --git a/VmwareEngine/src/V1/GetDnsBindPermissionRequest.php b/VmwareEngine/src/V1/GetDnsBindPermissionRequest.php index 0084869370c4..b198700ee8da 100644 --- a/VmwareEngine/src/V1/GetDnsBindPermissionRequest.php +++ b/VmwareEngine/src/V1/GetDnsBindPermissionRequest.php @@ -26,7 +26,7 @@ class GetDnsBindPermissionRequest 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 resource which stores the users/service accounts diff --git a/VmwareEngine/src/V1/GetDnsForwardingRequest.php b/VmwareEngine/src/V1/GetDnsForwardingRequest.php index 1268b46457dd..6b6e94423647 100644 --- a/VmwareEngine/src/V1/GetDnsForwardingRequest.php +++ b/VmwareEngine/src/V1/GetDnsForwardingRequest.php @@ -25,7 +25,7 @@ class GetDnsForwardingRequest 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 a `DnsForwarding` to retrieve. diff --git a/VmwareEngine/src/V1/GetExternalAccessRuleRequest.php b/VmwareEngine/src/V1/GetExternalAccessRuleRequest.php index e32ff4e6478c..4d0397c9063e 100644 --- a/VmwareEngine/src/V1/GetExternalAccessRuleRequest.php +++ b/VmwareEngine/src/V1/GetExternalAccessRuleRequest.php @@ -25,7 +25,7 @@ class GetExternalAccessRuleRequest 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 external access firewall rule to diff --git a/VmwareEngine/src/V1/GetExternalAddressRequest.php b/VmwareEngine/src/V1/GetExternalAddressRequest.php index 6ee16ab2c631..d75f2f69ca54 100644 --- a/VmwareEngine/src/V1/GetExternalAddressRequest.php +++ b/VmwareEngine/src/V1/GetExternalAddressRequest.php @@ -25,7 +25,7 @@ class GetExternalAddressRequest 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 external IP address to retrieve. diff --git a/VmwareEngine/src/V1/GetHcxActivationKeyRequest.php b/VmwareEngine/src/V1/GetHcxActivationKeyRequest.php index 5f4aa526cdaf..d561638f4a50 100644 --- a/VmwareEngine/src/V1/GetHcxActivationKeyRequest.php +++ b/VmwareEngine/src/V1/GetHcxActivationKeyRequest.php @@ -24,7 +24,7 @@ class GetHcxActivationKeyRequest 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 HCX activation key to retrieve. diff --git a/VmwareEngine/src/V1/GetLoggingServerRequest.php b/VmwareEngine/src/V1/GetLoggingServerRequest.php index baff4d61b484..ad4278ca8c84 100644 --- a/VmwareEngine/src/V1/GetLoggingServerRequest.php +++ b/VmwareEngine/src/V1/GetLoggingServerRequest.php @@ -25,7 +25,7 @@ class GetLoggingServerRequest 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 Logging Server to retrieve. diff --git a/VmwareEngine/src/V1/GetManagementDnsZoneBindingRequest.php b/VmwareEngine/src/V1/GetManagementDnsZoneBindingRequest.php index 3e904387d757..f9dbac4170c3 100644 --- a/VmwareEngine/src/V1/GetManagementDnsZoneBindingRequest.php +++ b/VmwareEngine/src/V1/GetManagementDnsZoneBindingRequest.php @@ -25,7 +25,7 @@ class GetManagementDnsZoneBindingRequest 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 resource name of the management DNS zone binding to diff --git a/VmwareEngine/src/V1/GetNetworkPeeringRequest.php b/VmwareEngine/src/V1/GetNetworkPeeringRequest.php index e10a4c7a44d5..51572fd7732f 100644 --- a/VmwareEngine/src/V1/GetNetworkPeeringRequest.php +++ b/VmwareEngine/src/V1/GetNetworkPeeringRequest.php @@ -25,7 +25,7 @@ class GetNetworkPeeringRequest 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 network peering to retrieve. diff --git a/VmwareEngine/src/V1/GetNetworkPolicyRequest.php b/VmwareEngine/src/V1/GetNetworkPolicyRequest.php index 54fcdb48bc63..ca390af59e74 100644 --- a/VmwareEngine/src/V1/GetNetworkPolicyRequest.php +++ b/VmwareEngine/src/V1/GetNetworkPolicyRequest.php @@ -25,7 +25,7 @@ class GetNetworkPolicyRequest 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 network policy to retrieve. diff --git a/VmwareEngine/src/V1/GetNodeRequest.php b/VmwareEngine/src/V1/GetNodeRequest.php index 3e61bb546056..823d63726078 100644 --- a/VmwareEngine/src/V1/GetNodeRequest.php +++ b/VmwareEngine/src/V1/GetNodeRequest.php @@ -23,7 +23,7 @@ class GetNodeRequest 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 node to retrieve. diff --git a/VmwareEngine/src/V1/GetNodeTypeRequest.php b/VmwareEngine/src/V1/GetNodeTypeRequest.php index 097e2209e360..a117aa736a7c 100644 --- a/VmwareEngine/src/V1/GetNodeTypeRequest.php +++ b/VmwareEngine/src/V1/GetNodeTypeRequest.php @@ -25,7 +25,7 @@ class GetNodeTypeRequest 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 node type to retrieve. diff --git a/VmwareEngine/src/V1/GetPrivateCloudRequest.php b/VmwareEngine/src/V1/GetPrivateCloudRequest.php index b3cbed260a45..16b916600d36 100644 --- a/VmwareEngine/src/V1/GetPrivateCloudRequest.php +++ b/VmwareEngine/src/V1/GetPrivateCloudRequest.php @@ -25,7 +25,7 @@ class GetPrivateCloudRequest 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 private cloud to retrieve. diff --git a/VmwareEngine/src/V1/GetPrivateConnectionRequest.php b/VmwareEngine/src/V1/GetPrivateConnectionRequest.php index 365039e875b2..2ca419dbafd6 100644 --- a/VmwareEngine/src/V1/GetPrivateConnectionRequest.php +++ b/VmwareEngine/src/V1/GetPrivateConnectionRequest.php @@ -25,7 +25,7 @@ class GetPrivateConnectionRequest 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 private connection to retrieve. diff --git a/VmwareEngine/src/V1/GetSubnetRequest.php b/VmwareEngine/src/V1/GetSubnetRequest.php index d45eeb389df5..657585bb0c76 100644 --- a/VmwareEngine/src/V1/GetSubnetRequest.php +++ b/VmwareEngine/src/V1/GetSubnetRequest.php @@ -25,7 +25,7 @@ class GetSubnetRequest 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 subnet to retrieve. diff --git a/VmwareEngine/src/V1/GetVmwareEngineNetworkRequest.php b/VmwareEngine/src/V1/GetVmwareEngineNetworkRequest.php index 674de70bb2c5..d9f69bd5c370 100644 --- a/VmwareEngine/src/V1/GetVmwareEngineNetworkRequest.php +++ b/VmwareEngine/src/V1/GetVmwareEngineNetworkRequest.php @@ -25,7 +25,7 @@ class GetVmwareEngineNetworkRequest 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 VMware Engine network to retrieve. diff --git a/VmwareEngine/src/V1/GrantDnsBindPermissionRequest.php b/VmwareEngine/src/V1/GrantDnsBindPermissionRequest.php index bedd8cbbe952..b3fa012f224f 100644 --- a/VmwareEngine/src/V1/GrantDnsBindPermissionRequest.php +++ b/VmwareEngine/src/V1/GrantDnsBindPermissionRequest.php @@ -26,7 +26,7 @@ class GrantDnsBindPermissionRequest 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 consumer provided user/service account which needs to be * granted permission to bind with the intranet VPC corresponding to the @@ -34,7 +34,7 @@ class GrantDnsBindPermissionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.Principal principal = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $principal = null; + protected $principal = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -51,7 +51,7 @@ class GrantDnsBindPermissionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The name of the resource which stores the users/service accounts diff --git a/VmwareEngine/src/V1/Hcx.php b/VmwareEngine/src/V1/Hcx.php index 075d5274111c..2beef5b8868d 100644 --- a/VmwareEngine/src/V1/Hcx.php +++ b/VmwareEngine/src/V1/Hcx.php @@ -20,25 +20,25 @@ class Hcx extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string internal_ip = 2; */ - private $internal_ip = ''; + protected $internal_ip = ''; /** * Version of the appliance. * * Generated from protobuf field string version = 4; */ - private $version = ''; + protected $version = ''; /** * Output only. The state of the appliance. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Hcx.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Fully qualified domain name of the appliance. * * Generated from protobuf field string fqdn = 6; */ - private $fqdn = ''; + protected $fqdn = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/HcxActivationKey.php b/VmwareEngine/src/V1/HcxActivationKey.php index 7084d88b3591..2ac89929e489 100644 --- a/VmwareEngine/src/V1/HcxActivationKey.php +++ b/VmwareEngine/src/V1/HcxActivationKey.php @@ -31,31 +31,31 @@ class HcxActivationKey extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of HCX activation key. * * 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. State of HCX activation key. * * Generated from protobuf field .google.cloud.vmwareengine.v1.HcxActivationKey.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. HCX activation key. * * Generated from protobuf field string activation_key = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $activation_key = ''; + protected $activation_key = ''; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/ListClustersRequest.php b/VmwareEngine/src/V1/ListClustersRequest.php index 41f28f011028..e5a2087e9eba 100644 --- a/VmwareEngine/src/V1/ListClustersRequest.php +++ b/VmwareEngine/src/V1/ListClustersRequest.php @@ -25,7 +25,7 @@ class ListClustersRequest 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 clusters to return in one page. * The service may return fewer than this value. @@ -34,7 +34,7 @@ class ListClustersRequest 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 `ListClusters` call. * Provide this to retrieve the subsequent page. @@ -43,7 +43,7 @@ class ListClustersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * To filter on multiple expressions, provide each separate expression within * parentheses. For example: @@ -61,7 +61,7 @@ class ListClustersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results are * ordered by `name` in ascending order. You can also sort results in @@ -70,7 +70,7 @@ class ListClustersRequest 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 private cloud to query for clusters. diff --git a/VmwareEngine/src/V1/ListClustersResponse.php b/VmwareEngine/src/V1/ListClustersResponse.php index 052749257f2b..1db7f0ab9272 100644 --- a/VmwareEngine/src/V1/ListClustersResponse.php +++ b/VmwareEngine/src/V1/ListClustersResponse.php @@ -28,7 +28,7 @@ class ListClustersResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListExternalAccessRulesRequest.php b/VmwareEngine/src/V1/ListExternalAccessRulesRequest.php index baf89e5afb83..c4d4fa886150 100644 --- a/VmwareEngine/src/V1/ListExternalAccessRulesRequest.php +++ b/VmwareEngine/src/V1/ListExternalAccessRulesRequest.php @@ -25,7 +25,7 @@ class ListExternalAccessRulesRequest 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 external access rules to return in one page. * The service may return fewer than this value. @@ -34,7 +34,7 @@ class ListExternalAccessRulesRequest 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 `ListExternalAccessRulesRequest` * call. Provide this to retrieve the subsequent page. @@ -44,7 +44,7 @@ class ListExternalAccessRulesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison @@ -71,7 +71,7 @@ class ListExternalAccessRulesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results * are ordered by `name` in ascending order. @@ -81,7 +81,7 @@ class ListExternalAccessRulesRequest 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 network policy to query for external diff --git a/VmwareEngine/src/V1/ListExternalAccessRulesResponse.php b/VmwareEngine/src/V1/ListExternalAccessRulesResponse.php index 3c4b8d115ca0..a20836638504 100644 --- a/VmwareEngine/src/V1/ListExternalAccessRulesResponse.php +++ b/VmwareEngine/src/V1/ListExternalAccessRulesResponse.php @@ -28,7 +28,7 @@ class ListExternalAccessRulesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListExternalAddressesRequest.php b/VmwareEngine/src/V1/ListExternalAddressesRequest.php index 795e3cab7dab..068486baec1c 100644 --- a/VmwareEngine/src/V1/ListExternalAddressesRequest.php +++ b/VmwareEngine/src/V1/ListExternalAddressesRequest.php @@ -26,7 +26,7 @@ class ListExternalAddressesRequest 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 external IP addresses to return in one page. * The service may return fewer than this value. @@ -35,7 +35,7 @@ class ListExternalAddressesRequest 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 `ListExternalAddresses` call. * Provide this to retrieve the subsequent page. @@ -44,7 +44,7 @@ class ListExternalAddressesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison @@ -71,7 +71,7 @@ class ListExternalAddressesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results * are ordered by `name` in ascending order. @@ -81,7 +81,7 @@ class ListExternalAddressesRequest 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 private cloud to be queried for diff --git a/VmwareEngine/src/V1/ListExternalAddressesResponse.php b/VmwareEngine/src/V1/ListExternalAddressesResponse.php index fbb5c791bd9b..43b0db7791d5 100644 --- a/VmwareEngine/src/V1/ListExternalAddressesResponse.php +++ b/VmwareEngine/src/V1/ListExternalAddressesResponse.php @@ -28,7 +28,7 @@ class ListExternalAddressesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListHcxActivationKeysRequest.php b/VmwareEngine/src/V1/ListHcxActivationKeysRequest.php index 15a8e5b7d2e8..0a19130f8a2c 100644 --- a/VmwareEngine/src/V1/ListHcxActivationKeysRequest.php +++ b/VmwareEngine/src/V1/ListHcxActivationKeysRequest.php @@ -26,7 +26,7 @@ class ListHcxActivationKeysRequest 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 HCX activation keys to return in one page. * The service may return fewer than this value. @@ -35,7 +35,7 @@ class ListHcxActivationKeysRequest 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 `ListHcxActivationKeys` call. * Provide this to retrieve the subsequent page. @@ -45,7 +45,7 @@ class ListHcxActivationKeysRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The resource name of the private cloud diff --git a/VmwareEngine/src/V1/ListHcxActivationKeysResponse.php b/VmwareEngine/src/V1/ListHcxActivationKeysResponse.php index 4c81864533ac..d38aeee53fb8 100644 --- a/VmwareEngine/src/V1/ListHcxActivationKeysResponse.php +++ b/VmwareEngine/src/V1/ListHcxActivationKeysResponse.php @@ -28,7 +28,7 @@ class ListHcxActivationKeysResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListLoggingServersRequest.php b/VmwareEngine/src/V1/ListLoggingServersRequest.php index 08ba667fd37a..84953a0b6836 100644 --- a/VmwareEngine/src/V1/ListLoggingServersRequest.php +++ b/VmwareEngine/src/V1/ListLoggingServersRequest.php @@ -26,7 +26,7 @@ class ListLoggingServersRequest 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 logging servers to return in one page. * The service may return fewer than this value. @@ -35,7 +35,7 @@ class ListLoggingServersRequest 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 `ListLoggingServersRequest` call. * Provide this to retrieve the subsequent page. @@ -45,7 +45,7 @@ class ListLoggingServersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison @@ -72,7 +72,7 @@ class ListLoggingServersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results * are ordered by `name` in ascending order. @@ -82,7 +82,7 @@ class ListLoggingServersRequest 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 private cloud to be queried for diff --git a/VmwareEngine/src/V1/ListLoggingServersResponse.php b/VmwareEngine/src/V1/ListLoggingServersResponse.php index 2b5f89f69355..549354db2821 100644 --- a/VmwareEngine/src/V1/ListLoggingServersResponse.php +++ b/VmwareEngine/src/V1/ListLoggingServersResponse.php @@ -28,7 +28,7 @@ class ListLoggingServersResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListManagementDnsZoneBindingsRequest.php b/VmwareEngine/src/V1/ListManagementDnsZoneBindingsRequest.php index 4af09306476a..ab7704b5f7fd 100644 --- a/VmwareEngine/src/V1/ListManagementDnsZoneBindingsRequest.php +++ b/VmwareEngine/src/V1/ListManagementDnsZoneBindingsRequest.php @@ -26,7 +26,7 @@ class ListManagementDnsZoneBindingsRequest 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 = ''; /** * The maximum number of management DNS zone bindings to return in one page. * The service may return fewer than this value. @@ -35,7 +35,7 @@ class ListManagementDnsZoneBindingsRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous `ListManagementDnsZoneBindings` * call. Provide this to retrieve the subsequent page. @@ -45,7 +45,7 @@ class ListManagementDnsZoneBindingsRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison @@ -72,7 +72,7 @@ class ListManagementDnsZoneBindingsRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results * are ordered by `name` in ascending order. @@ -82,7 +82,7 @@ class ListManagementDnsZoneBindingsRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string order_by = 5; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The resource name of the private cloud to be queried for diff --git a/VmwareEngine/src/V1/ListManagementDnsZoneBindingsResponse.php b/VmwareEngine/src/V1/ListManagementDnsZoneBindingsResponse.php index b46c35d0be5b..96371ae524ff 100644 --- a/VmwareEngine/src/V1/ListManagementDnsZoneBindingsResponse.php +++ b/VmwareEngine/src/V1/ListManagementDnsZoneBindingsResponse.php @@ -28,7 +28,7 @@ class ListManagementDnsZoneBindingsResponse extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListNetworkPeeringsRequest.php b/VmwareEngine/src/V1/ListNetworkPeeringsRequest.php index ad9d7f068661..38dce0b8e673 100644 --- a/VmwareEngine/src/V1/ListNetworkPeeringsRequest.php +++ b/VmwareEngine/src/V1/ListNetworkPeeringsRequest.php @@ -24,7 +24,7 @@ class ListNetworkPeeringsRequest 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 network peerings to return in one page. * The maximum value is coerced to 1000. @@ -32,7 +32,7 @@ class ListNetworkPeeringsRequest 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 `ListNetworkPeerings` call. * Provide this to retrieve the subsequent page. @@ -42,7 +42,7 @@ class ListNetworkPeeringsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison @@ -69,7 +69,7 @@ class ListNetworkPeeringsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results * are ordered by `name` in ascending order. @@ -79,7 +79,7 @@ class ListNetworkPeeringsRequest 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 (global) to query for diff --git a/VmwareEngine/src/V1/ListNetworkPeeringsResponse.php b/VmwareEngine/src/V1/ListNetworkPeeringsResponse.php index 7927dcd65995..23484cf1c0fc 100644 --- a/VmwareEngine/src/V1/ListNetworkPeeringsResponse.php +++ b/VmwareEngine/src/V1/ListNetworkPeeringsResponse.php @@ -28,7 +28,7 @@ class ListNetworkPeeringsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Unreachable resources. * diff --git a/VmwareEngine/src/V1/ListNetworkPoliciesRequest.php b/VmwareEngine/src/V1/ListNetworkPoliciesRequest.php index 8820062246fc..bee75e476e17 100644 --- a/VmwareEngine/src/V1/ListNetworkPoliciesRequest.php +++ b/VmwareEngine/src/V1/ListNetworkPoliciesRequest.php @@ -24,7 +24,7 @@ class ListNetworkPoliciesRequest 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 network policies to return in one page. * The service may return fewer than this value. @@ -33,7 +33,7 @@ class ListNetworkPoliciesRequest 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 `ListNetworkPolicies` call. * Provide this to retrieve the subsequent page. @@ -43,7 +43,7 @@ class ListNetworkPoliciesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison @@ -70,7 +70,7 @@ class ListNetworkPoliciesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results * are ordered by `name` in ascending order. @@ -80,7 +80,7 @@ class ListNetworkPoliciesRequest 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 (region) to query for diff --git a/VmwareEngine/src/V1/ListNetworkPoliciesResponse.php b/VmwareEngine/src/V1/ListNetworkPoliciesResponse.php index 1f27ec6e6ece..abad447203f7 100644 --- a/VmwareEngine/src/V1/ListNetworkPoliciesResponse.php +++ b/VmwareEngine/src/V1/ListNetworkPoliciesResponse.php @@ -28,7 +28,7 @@ class ListNetworkPoliciesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListNodeTypesRequest.php b/VmwareEngine/src/V1/ListNodeTypesRequest.php index b2c76701d3b8..d8b2a072333f 100644 --- a/VmwareEngine/src/V1/ListNodeTypesRequest.php +++ b/VmwareEngine/src/V1/ListNodeTypesRequest.php @@ -25,7 +25,7 @@ class ListNodeTypesRequest 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 node types to return in one page. * The service may return fewer than this value. @@ -34,7 +34,7 @@ class ListNodeTypesRequest 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 `ListNodeTypes` call. * Provide this to retrieve the subsequent page. @@ -43,7 +43,7 @@ class ListNodeTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison @@ -70,7 +70,7 @@ class ListNodeTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * @param string $parent Required. The resource name of the location to be queried for node types. diff --git a/VmwareEngine/src/V1/ListNodeTypesResponse.php b/VmwareEngine/src/V1/ListNodeTypesResponse.php index ce94dab7ad06..c8de39d538ae 100644 --- a/VmwareEngine/src/V1/ListNodeTypesResponse.php +++ b/VmwareEngine/src/V1/ListNodeTypesResponse.php @@ -28,7 +28,7 @@ class ListNodeTypesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListNodesRequest.php b/VmwareEngine/src/V1/ListNodesRequest.php index b283bc2a65f5..55daa226a1ef 100644 --- a/VmwareEngine/src/V1/ListNodesRequest.php +++ b/VmwareEngine/src/V1/ListNodesRequest.php @@ -25,7 +25,7 @@ class ListNodesRequest 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 nodes to return in one page. * The service may return fewer than this value. @@ -34,7 +34,7 @@ class ListNodesRequest 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 `ListNodes` call. * Provide this to retrieve the subsequent page. @@ -44,7 +44,7 @@ class ListNodesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The resource name of the cluster to be queried for nodes. diff --git a/VmwareEngine/src/V1/ListNodesResponse.php b/VmwareEngine/src/V1/ListNodesResponse.php index 0eb6a5fd7871..790b31a63eda 100644 --- a/VmwareEngine/src/V1/ListNodesResponse.php +++ b/VmwareEngine/src/V1/ListNodesResponse.php @@ -28,7 +28,7 @@ class ListNodesResponse 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/VmwareEngine/src/V1/ListPeeringRoutesRequest.php b/VmwareEngine/src/V1/ListPeeringRoutesRequest.php index 6cf11befaec9..55118727a6e9 100644 --- a/VmwareEngine/src/V1/ListPeeringRoutesRequest.php +++ b/VmwareEngine/src/V1/ListPeeringRoutesRequest.php @@ -24,7 +24,7 @@ class ListPeeringRoutesRequest 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 peering routes to return in one page. * The service may return fewer than this value. @@ -33,7 +33,7 @@ class ListPeeringRoutesRequest 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 `ListPeeringRoutes` call. * Provide this to retrieve the subsequent page. @@ -42,7 +42,7 @@ class ListPeeringRoutesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * Currently, only filtering on the `direction` field is supported. To return @@ -52,7 +52,7 @@ class ListPeeringRoutesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 6; */ - private $filter = ''; + protected $filter = ''; /** * @param string $parent Required. The resource name of the network peering to retrieve peering diff --git a/VmwareEngine/src/V1/ListPeeringRoutesResponse.php b/VmwareEngine/src/V1/ListPeeringRoutesResponse.php index b5a675a5028c..61112faa0ec9 100644 --- a/VmwareEngine/src/V1/ListPeeringRoutesResponse.php +++ b/VmwareEngine/src/V1/ListPeeringRoutesResponse.php @@ -28,7 +28,7 @@ class ListPeeringRoutesResponse 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/VmwareEngine/src/V1/ListPrivateCloudsRequest.php b/VmwareEngine/src/V1/ListPrivateCloudsRequest.php index 8132ca3b6f41..8e9d635b77be 100644 --- a/VmwareEngine/src/V1/ListPrivateCloudsRequest.php +++ b/VmwareEngine/src/V1/ListPrivateCloudsRequest.php @@ -25,7 +25,7 @@ class ListPrivateCloudsRequest 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 private clouds to return in one page. * The service may return fewer than this value. @@ -34,7 +34,7 @@ class ListPrivateCloudsRequest 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 `ListPrivateClouds` call. * Provide this to retrieve the subsequent page. @@ -43,7 +43,7 @@ class ListPrivateCloudsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison operator, and the @@ -71,7 +71,7 @@ class ListPrivateCloudsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results are * ordered by `name` in ascending order. You can also sort results in @@ -80,7 +80,7 @@ class ListPrivateCloudsRequest 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 private cloud to be queried for diff --git a/VmwareEngine/src/V1/ListPrivateCloudsResponse.php b/VmwareEngine/src/V1/ListPrivateCloudsResponse.php index 7365c01f50d9..bb0c02544fb4 100644 --- a/VmwareEngine/src/V1/ListPrivateCloudsResponse.php +++ b/VmwareEngine/src/V1/ListPrivateCloudsResponse.php @@ -28,7 +28,7 @@ class ListPrivateCloudsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListPrivateConnectionPeeringRoutesRequest.php b/VmwareEngine/src/V1/ListPrivateConnectionPeeringRoutesRequest.php index 9045297d5c9d..fcb2b9941abf 100644 --- a/VmwareEngine/src/V1/ListPrivateConnectionPeeringRoutesRequest.php +++ b/VmwareEngine/src/V1/ListPrivateConnectionPeeringRoutesRequest.php @@ -24,7 +24,7 @@ class ListPrivateConnectionPeeringRoutesRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of peering routes to return in one page. * The service may return fewer than this value. @@ -33,7 +33,7 @@ class ListPrivateConnectionPeeringRoutesRequest extends \Google\Protobuf\Interna * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` * call. Provide this to retrieve the subsequent page. When paginating, all @@ -42,7 +42,7 @@ class ListPrivateConnectionPeeringRoutesRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The resource name of the private connection to retrieve peering diff --git a/VmwareEngine/src/V1/ListPrivateConnectionPeeringRoutesResponse.php b/VmwareEngine/src/V1/ListPrivateConnectionPeeringRoutesResponse.php index 68f5da216205..7ae5850a3c69 100644 --- a/VmwareEngine/src/V1/ListPrivateConnectionPeeringRoutesResponse.php +++ b/VmwareEngine/src/V1/ListPrivateConnectionPeeringRoutesResponse.php @@ -28,7 +28,7 @@ class ListPrivateConnectionPeeringRoutesResponse extends \Google\Protobuf\Intern * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/ListPrivateConnectionsRequest.php b/VmwareEngine/src/V1/ListPrivateConnectionsRequest.php index 6310bcfdffef..7f5a5622e56b 100644 --- a/VmwareEngine/src/V1/ListPrivateConnectionsRequest.php +++ b/VmwareEngine/src/V1/ListPrivateConnectionsRequest.php @@ -24,7 +24,7 @@ class ListPrivateConnectionsRequest 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 private connections to return in one page. * The maximum value is coerced to 1000. @@ -32,7 +32,7 @@ class ListPrivateConnectionsRequest 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 `ListPrivateConnections` call. * Provide this to retrieve the subsequent page. @@ -42,7 +42,7 @@ class ListPrivateConnectionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison @@ -69,7 +69,7 @@ class ListPrivateConnectionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results * are ordered by `name` in ascending order. @@ -79,7 +79,7 @@ class ListPrivateConnectionsRequest 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 query for diff --git a/VmwareEngine/src/V1/ListPrivateConnectionsResponse.php b/VmwareEngine/src/V1/ListPrivateConnectionsResponse.php index 15b2cef7a0f8..2ce8e6c074aa 100644 --- a/VmwareEngine/src/V1/ListPrivateConnectionsResponse.php +++ b/VmwareEngine/src/V1/ListPrivateConnectionsResponse.php @@ -28,7 +28,7 @@ class ListPrivateConnectionsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Unreachable resources. * diff --git a/VmwareEngine/src/V1/ListSubnetsRequest.php b/VmwareEngine/src/V1/ListSubnetsRequest.php index 82fa130ece8d..8cd0a8dbe644 100644 --- a/VmwareEngine/src/V1/ListSubnetsRequest.php +++ b/VmwareEngine/src/V1/ListSubnetsRequest.php @@ -26,7 +26,7 @@ class ListSubnetsRequest 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 subnets to return in one page. * The service may return fewer than this value. @@ -35,7 +35,7 @@ class ListSubnetsRequest 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 `ListSubnetsRequest` call. * Provide this to retrieve the subsequent page. @@ -44,7 +44,7 @@ class ListSubnetsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The resource name of the private cloud to be queried for diff --git a/VmwareEngine/src/V1/ListSubnetsResponse.php b/VmwareEngine/src/V1/ListSubnetsResponse.php index b07a86af5ce8..d6a41be2b735 100644 --- a/VmwareEngine/src/V1/ListSubnetsResponse.php +++ b/VmwareEngine/src/V1/ListSubnetsResponse.php @@ -28,7 +28,7 @@ class ListSubnetsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached when making an aggregated query using * wildcards. diff --git a/VmwareEngine/src/V1/ListVmwareEngineNetworksRequest.php b/VmwareEngine/src/V1/ListVmwareEngineNetworksRequest.php index 6d39a393f90b..5d04a5162774 100644 --- a/VmwareEngine/src/V1/ListVmwareEngineNetworksRequest.php +++ b/VmwareEngine/src/V1/ListVmwareEngineNetworksRequest.php @@ -24,7 +24,7 @@ class ListVmwareEngineNetworksRequest 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 results to return in one page. * The maximum value is coerced to 1000. @@ -32,7 +32,7 @@ class ListVmwareEngineNetworksRequest 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 `ListVmwareEngineNetworks` call. * Provide this to retrieve the subsequent page. @@ -42,7 +42,7 @@ class ListVmwareEngineNetworksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * A filter expression that matches resources returned in the response. * The expression must specify the field name, a comparison @@ -69,7 +69,7 @@ class ListVmwareEngineNetworksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 4; */ - private $filter = ''; + protected $filter = ''; /** * Sorts list results by a certain order. By default, returned results * are ordered by `name` in ascending order. @@ -79,7 +79,7 @@ class ListVmwareEngineNetworksRequest 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 query for diff --git a/VmwareEngine/src/V1/ListVmwareEngineNetworksResponse.php b/VmwareEngine/src/V1/ListVmwareEngineNetworksResponse.php index 77909a3d8411..0ca339105be3 100644 --- a/VmwareEngine/src/V1/ListVmwareEngineNetworksResponse.php +++ b/VmwareEngine/src/V1/ListVmwareEngineNetworksResponse.php @@ -28,7 +28,7 @@ class ListVmwareEngineNetworksResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Unreachable resources. * diff --git a/VmwareEngine/src/V1/LoggingServer.php b/VmwareEngine/src/V1/LoggingServer.php index a9ca0b8a7b7f..e064acbab3d1 100644 --- a/VmwareEngine/src/V1/LoggingServer.php +++ b/VmwareEngine/src/V1/LoggingServer.php @@ -24,51 +24,51 @@ class LoggingServer extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Required. Fully-qualified domain name (FQDN) or IP Address of the logging * server. * * Generated from protobuf field string hostname = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $hostname = ''; + protected $hostname = ''; /** * Required. Port number at which the logging server receives logs. * * Generated from protobuf field int32 port = 7 [(.google.api.field_behavior) = REQUIRED]; */ - private $port = 0; + protected $port = 0; /** * Required. Protocol used by vCenter to send logs to a logging server. * * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer.Protocol protocol = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $protocol = 0; + protected $protocol = 0; /** * Required. The type of component that produces logs that will be forwarded * to this logging server. * * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer.SourceType source_type = 10 [(.google.api.field_behavior) = REQUIRED]; */ - private $source_type = 0; + protected $source_type = 0; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/ManagementDnsZoneBinding.php b/VmwareEngine/src/V1/ManagementDnsZoneBinding.php index 9df0644fcaa3..d2a7a7f295a1 100644 --- a/VmwareEngine/src/V1/ManagementDnsZoneBinding.php +++ b/VmwareEngine/src/V1/ManagementDnsZoneBinding.php @@ -28,37 +28,37 @@ class ManagementDnsZoneBinding extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. The state of the resource. * * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * User-provided description for this resource. * * Generated from protobuf field string description = 13; */ - private $description = ''; + protected $description = ''; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; protected $bind_network; /** diff --git a/VmwareEngine/src/V1/NetworkConfig.php b/VmwareEngine/src/V1/NetworkConfig.php index 104897dcf813..60536fcd1805 100644 --- a/VmwareEngine/src/V1/NetworkConfig.php +++ b/VmwareEngine/src/V1/NetworkConfig.php @@ -21,7 +21,7 @@ class NetworkConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string management_cidr = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $management_cidr = ''; + protected $management_cidr = ''; /** * Optional. The relative resource name of the VMware Engine network attached * to the private cloud. Specify the name in the following form: @@ -30,14 +30,14 @@ class NetworkConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vmware_engine_network = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $vmware_engine_network = ''; + protected $vmware_engine_network = ''; /** * Output only. The canonical name of the VMware Engine network in the form: * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` * * Generated from protobuf field string vmware_engine_network_canonical = 6 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $vmware_engine_network_canonical = ''; + protected $vmware_engine_network_canonical = ''; /** * Output only. The IP address layout version of the management IP address * range. Possible versions include: @@ -50,7 +50,7 @@ class NetworkConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 management_ip_address_layout_version = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $management_ip_address_layout_version = 0; + protected $management_ip_address_layout_version = 0; /** * Output only. DNS Server IP of the Private Cloud. * All DNS queries can be forwarded to this address for name resolution of @@ -59,7 +59,7 @@ class NetworkConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dns_server_ip = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $dns_server_ip = ''; + protected $dns_server_ip = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/NetworkPeering.php b/VmwareEngine/src/V1/NetworkPeering.php index 5af02e8c9d62..75600189db38 100644 --- a/VmwareEngine/src/V1/NetworkPeering.php +++ b/VmwareEngine/src/V1/NetworkPeering.php @@ -25,19 +25,19 @@ class NetworkPeering extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Required. The relative resource name of the network to peer with * a standard VMware Engine network. The provided network can be a @@ -50,21 +50,21 @@ class NetworkPeering extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string peer_network = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $peer_network = ''; + protected $peer_network = ''; /** * Optional. True if custom routes are exported to the peered network; * false otherwise. The default value is true. * * Generated from protobuf field optional bool export_custom_routes = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $export_custom_routes = null; + protected $export_custom_routes = null; /** * Optional. True if custom routes are imported from the peered network; * false otherwise. The default value is true. * * Generated from protobuf field optional bool import_custom_routes = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $import_custom_routes = null; + protected $import_custom_routes = null; /** * Optional. True if full mesh connectivity is created and managed * automatically between peered networks; false otherwise. Currently this @@ -74,7 +74,7 @@ class NetworkPeering extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool exchange_subnet_routes = 10 [(.google.api.field_behavior) = OPTIONAL]; */ - private $exchange_subnet_routes = null; + protected $exchange_subnet_routes = null; /** * Optional. True if all subnet routes with a public IP address range are * exported; false otherwise. The default value is true. IPv4 special-use @@ -83,7 +83,7 @@ class NetworkPeering extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool export_custom_routes_with_public_ip = 11 [(.google.api.field_behavior) = OPTIONAL]; */ - private $export_custom_routes_with_public_ip = null; + protected $export_custom_routes_with_public_ip = null; /** * Optional. True if all subnet routes with public IP address range are * imported; false otherwise. The default value is true. IPv4 special-use @@ -92,7 +92,7 @@ class NetworkPeering extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool import_custom_routes_with_public_ip = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $import_custom_routes_with_public_ip = null; + protected $import_custom_routes_with_public_ip = null; /** * Output only. State of the network peering. This field * has a value of 'ACTIVE' when there's a matching configuration in the peer @@ -100,14 +100,14 @@ class NetworkPeering extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Output Only. Details about the current state of the network * peering. * * Generated from protobuf field string state_details = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state_details = ''; + protected $state_details = ''; /** * Optional. Maximum transmission unit (MTU) in bytes. * The default value is `1500`. If a value of `0` is provided for this field, @@ -115,19 +115,19 @@ class NetworkPeering extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 peer_mtu = 14 [(.google.api.field_behavior) = OPTIONAL]; */ - private $peer_mtu = 0; + protected $peer_mtu = 0; /** * Required. The type of the network to peer with the VMware Engine network. * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering.PeerNetworkType peer_network_type = 16 [(.google.api.field_behavior) = REQUIRED]; */ - private $peer_network_type = 0; + protected $peer_network_type = 0; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Required. The relative resource name of the VMware Engine network. * Specify the name in the following form: @@ -136,13 +136,13 @@ class NetworkPeering extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vmware_engine_network = 20 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $vmware_engine_network = ''; + protected $vmware_engine_network = ''; /** * Optional. User-provided description for this network peering. * * Generated from protobuf field string description = 21 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/NetworkPolicy.php b/VmwareEngine/src/V1/NetworkPolicy.php index e1a0f09b1360..a0706a1327c9 100644 --- a/VmwareEngine/src/V1/NetworkPolicy.php +++ b/VmwareEngine/src/V1/NetworkPolicy.php @@ -29,25 +29,25 @@ class NetworkPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Network service that allows VMware workloads to access the internet. * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService internet_access = 6; */ - private $internet_access = null; + protected $internet_access = null; /** * Network service that allows External IP addresses to be assigned to VMware * workloads. This service can only be enabled when `internet_access` is also @@ -55,7 +55,7 @@ class NetworkPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService external_ip = 7; */ - private $external_ip = null; + protected $external_ip = null; /** * Required. IP address range in CIDR notation used to create internet access * and external IP access. An RFC 1918 CIDR block, with a "/26" prefix, is @@ -64,13 +64,13 @@ class NetworkPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string edge_services_cidr = 9 [(.google.api.field_behavior) = REQUIRED]; */ - private $edge_services_cidr = ''; + protected $edge_services_cidr = ''; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Optional. The relative resource name of the VMware Engine network. * Specify the name in the following form: @@ -79,20 +79,20 @@ class NetworkPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vmware_engine_network = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ - private $vmware_engine_network = ''; + protected $vmware_engine_network = ''; /** * Optional. User-provided description for this network policy. * * Generated from protobuf field string description = 13 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Output only. The canonical name of the VMware Engine network in the form: * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` * * Generated from protobuf field string vmware_engine_network_canonical = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $vmware_engine_network_canonical = ''; + protected $vmware_engine_network_canonical = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/NetworkPolicy/NetworkService.php b/VmwareEngine/src/V1/NetworkPolicy/NetworkService.php index 15dc3064fbe6..9baf3a7b492e 100644 --- a/VmwareEngine/src/V1/NetworkPolicy/NetworkService.php +++ b/VmwareEngine/src/V1/NetworkPolicy/NetworkService.php @@ -24,14 +24,14 @@ class NetworkService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enabled = 1; */ - private $enabled = false; + protected $enabled = false; /** * Output only. State of the service. New values may be added to this enum * when appropriate. * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Constructor. diff --git a/VmwareEngine/src/V1/Node.php b/VmwareEngine/src/V1/Node.php index e2b08f55249d..7967bc524fb7 100644 --- a/VmwareEngine/src/V1/Node.php +++ b/VmwareEngine/src/V1/Node.php @@ -24,19 +24,19 @@ class Node extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Fully qualified domain name of the node. * * Generated from protobuf field string fqdn = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $fqdn = ''; + protected $fqdn = ''; /** * Output only. Internal IP address of the node. * * Generated from protobuf field string internal_ip = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $internal_ip = ''; + protected $internal_ip = ''; /** * Output only. The canonical identifier of the node type (corresponds to the * `NodeType`). @@ -44,26 +44,26 @@ class Node extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_type_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $node_type_id = ''; + protected $node_type_id = ''; /** * Output only. The version number of the VMware ESXi * management component in this cluster. * * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $version = ''; + protected $version = ''; /** * Output only. Customized number of cores * * Generated from protobuf field int64 custom_core_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $custom_core_count = 0; + protected $custom_core_count = 0; /** * Output only. The state of the appliance. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Node.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Constructor. diff --git a/VmwareEngine/src/V1/NodeType.php b/VmwareEngine/src/V1/NodeType.php index 3f342b2ede7b..dd6e532b2efd 100644 --- a/VmwareEngine/src/V1/NodeType.php +++ b/VmwareEngine/src/V1/NodeType.php @@ -24,45 +24,45 @@ class NodeType 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 canonical identifier of the node type * (corresponds to the `NodeType`). For example: standard-72. * * Generated from protobuf field string node_type_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $node_type_id = ''; + protected $node_type_id = ''; /** * Output only. The friendly name for this node type. * For example: ve1-standard-72 * * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $display_name = ''; + protected $display_name = ''; /** * Output only. The total number of virtual CPUs in a single node. * * Generated from protobuf field int32 virtual_cpu_count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $virtual_cpu_count = 0; + protected $virtual_cpu_count = 0; /** * Output only. The total number of CPU cores in a single node. * * Generated from protobuf field int32 total_core_count = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $total_core_count = 0; + protected $total_core_count = 0; /** * Output only. The amount of physical memory available, defined in GB. * * Generated from protobuf field int32 memory_gb = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $memory_gb = 0; + protected $memory_gb = 0; /** * Output only. The amount of storage available, defined in GB. * * Generated from protobuf field int32 disk_size_gb = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $disk_size_gb = 0; + protected $disk_size_gb = 0; /** * Output only. List of possible values of custom core count. * @@ -74,7 +74,7 @@ class NodeType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.NodeType.Kind kind = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $kind = 0; + protected $kind = 0; /** * Output only. Families of the node type. * For node types to be in the same cluster diff --git a/VmwareEngine/src/V1/NodeTypeConfig.php b/VmwareEngine/src/V1/NodeTypeConfig.php index 71ec0d327c54..5308613bd056 100644 --- a/VmwareEngine/src/V1/NodeTypeConfig.php +++ b/VmwareEngine/src/V1/NodeTypeConfig.php @@ -20,7 +20,7 @@ class NodeTypeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 node_count = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_count = 0; + protected $node_count = 0; /** * Optional. Customized number of cores available to each node of the type. * This number must always be one of `nodeType.availableCustomCoreCounts`. @@ -29,7 +29,7 @@ class NodeTypeConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 custom_core_count = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $custom_core_count = 0; + protected $custom_core_count = 0; /** * Constructor. diff --git a/VmwareEngine/src/V1/Nsx.php b/VmwareEngine/src/V1/Nsx.php index 79fdf708d003..21cfc7076157 100644 --- a/VmwareEngine/src/V1/Nsx.php +++ b/VmwareEngine/src/V1/Nsx.php @@ -20,25 +20,25 @@ class Nsx extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string internal_ip = 2; */ - private $internal_ip = ''; + protected $internal_ip = ''; /** * Version of the appliance. * * Generated from protobuf field string version = 4; */ - private $version = ''; + protected $version = ''; /** * Output only. The state of the appliance. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Nsx.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Fully qualified domain name of the appliance. * * Generated from protobuf field string fqdn = 6; */ - private $fqdn = ''; + protected $fqdn = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/OperationMetadata.php b/VmwareEngine/src/V1/OperationMetadata.php index f505c00e6c51..a520f27cb3e3 100644 --- a/VmwareEngine/src/V1/OperationMetadata.php +++ b/VmwareEngine/src/V1/OperationMetadata.php @@ -20,31 +20,31 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The time the operation finished running. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Server-defined resource path for the target of the operation. * * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $target = ''; + protected $target = ''; /** * Output only. Name of the verb executed by the operation. * * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $verb = ''; + protected $verb = ''; /** * Output only. Human-readable status of the operation, if any. * * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $status_message = ''; + protected $status_message = ''; /** * Output only. True if the user has requested cancellation * of the operation; false otherwise. @@ -55,13 +55,13 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $requested_cancellation = false; + protected $requested_cancellation = false; /** * Output only. API version used to start the operation. * * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $api_version = ''; + protected $api_version = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/PeeringRoute.php b/VmwareEngine/src/V1/PeeringRoute.php index 94e1c34622e6..ed79b2063cdf 100644 --- a/VmwareEngine/src/V1/PeeringRoute.php +++ b/VmwareEngine/src/V1/PeeringRoute.php @@ -20,26 +20,26 @@ class PeeringRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dest_range = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $dest_range = ''; + protected $dest_range = ''; /** * Output only. Type of the route in the peer VPC network. * * Generated from protobuf field .google.cloud.vmwareengine.v1.PeeringRoute.Type type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $type = 0; + protected $type = 0; /** * Output only. Region containing the next hop of the peering route. This * field only applies to dynamic routes in the peer VPC network. * * Generated from protobuf field string next_hop_region = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_hop_region = ''; + protected $next_hop_region = ''; /** * Output only. The priority of the peering route. * * Generated from protobuf field int64 priority = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $priority = 0; + protected $priority = 0; /** * Output only. True if the peering route has been imported from a peered * VPC network; false otherwise. The import happens if the field @@ -49,7 +49,7 @@ class PeeringRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool imported = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $imported = false; + protected $imported = false; /** * Output only. Direction of the routes exchanged with the peer network, from * the VMware Engine network perspective: @@ -59,7 +59,7 @@ class PeeringRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.PeeringRoute.Direction direction = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $direction = 0; + protected $direction = 0; /** * Constructor. diff --git a/VmwareEngine/src/V1/PrivateCloud.php b/VmwareEngine/src/V1/PrivateCloud.php index f3fed93d721f..1e778c354002 100644 --- a/VmwareEngine/src/V1/PrivateCloud.php +++ b/VmwareEngine/src/V1/PrivateCloud.php @@ -26,44 +26,44 @@ class PrivateCloud extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. Time when the resource was scheduled for deletion. * * Generated from protobuf field .google.protobuf.Timestamp delete_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $delete_time = null; + protected $delete_time = null; /** * Output only. Time when the resource will be irreversibly deleted. * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $expire_time = null; + protected $expire_time = null; /** * Output only. State of the resource. New values may be added to this enum * when appropriate. * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Required. Network configuration of the private cloud. * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkConfig network_config = 9 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_config = null; + protected $network_config = null; /** * Required. Input only. The management cluster for this private cloud. * This field is required during creation of the private cloud to provide @@ -73,43 +73,43 @@ class PrivateCloud extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.ManagementCluster management_cluster = 10 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = REQUIRED]; */ - private $management_cluster = null; + protected $management_cluster = null; /** * User-provided description for this private cloud. * * Generated from protobuf field string description = 11; */ - private $description = ''; + protected $description = ''; /** * Output only. HCX appliance. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Hcx hcx = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $hcx = null; + protected $hcx = null; /** * Output only. NSX appliance. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Nsx nsx = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $nsx = null; + protected $nsx = null; /** * Output only. Vcenter appliance. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Vcenter vcenter = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $vcenter = null; + protected $vcenter = null; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Optional. Type of the private cloud. Defaults to STANDARD. * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.Type type = 22 [(.google.api.field_behavior) = OPTIONAL]; */ - private $type = 0; + protected $type = 0; /** * Constructor. diff --git a/VmwareEngine/src/V1/PrivateCloud/ManagementCluster.php b/VmwareEngine/src/V1/PrivateCloud/ManagementCluster.php index 53864ce6286d..85fb18665258 100644 --- a/VmwareEngine/src/V1/PrivateCloud/ManagementCluster.php +++ b/VmwareEngine/src/V1/PrivateCloud/ManagementCluster.php @@ -27,7 +27,7 @@ class ManagementCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string cluster_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $cluster_id = ''; + protected $cluster_id = ''; /** * Required. The map of cluster node types in this cluster, where the key is * canonical identifier of the node type (corresponds to the `NodeType`). @@ -41,7 +41,7 @@ class ManagementCluster extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.StretchedClusterConfig stretched_cluster_config = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $stretched_cluster_config = null; + protected $stretched_cluster_config = null; /** * Constructor. diff --git a/VmwareEngine/src/V1/PrivateConnection.php b/VmwareEngine/src/V1/PrivateConnection.php index c2c6d3755917..c68b2badfa67 100644 --- a/VmwareEngine/src/V1/PrivateConnection.php +++ b/VmwareEngine/src/V1/PrivateConnection.php @@ -25,31 +25,31 @@ class PrivateConnection extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * 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. User-provided description for this private connection. * * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Output only. State of the private connection. * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Required. The relative resource name of Legacy VMware Engine network. * Specify the name in the following form: @@ -61,27 +61,27 @@ class PrivateConnection extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vmware_engine_network = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $vmware_engine_network = ''; + protected $vmware_engine_network = ''; /** * Output only. The canonical name of the VMware Engine network in the form: * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` * * Generated from protobuf field string vmware_engine_network_canonical = 9 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $vmware_engine_network_canonical = ''; + protected $vmware_engine_network_canonical = ''; /** * Required. Private connection type. * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.Type type = 10 [(.google.api.field_behavior) = REQUIRED]; */ - private $type = 0; + protected $type = 0; /** * Output only. VPC network peering id between given network VPC and * VMwareEngineNetwork. * * Generated from protobuf field string peering_id = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $peering_id = ''; + protected $peering_id = ''; /** * Optional. Routing Mode. * Default value is set to GLOBAL. @@ -90,13 +90,13 @@ class PrivateConnection extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.RoutingMode routing_mode = 13 [(.google.api.field_behavior) = OPTIONAL]; */ - private $routing_mode = 0; + protected $routing_mode = 0; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Required. Service network to create private connection. * Specify the name in the following form: @@ -113,14 +113,14 @@ class PrivateConnection extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_network = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $service_network = ''; + protected $service_network = ''; /** * Output only. Peering state between service network and VMware Engine * network. * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.PeeringState peering_state = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $peering_state = 0; + protected $peering_state = 0; /** * Constructor. diff --git a/VmwareEngine/src/V1/RepairManagementDnsZoneBindingRequest.php b/VmwareEngine/src/V1/RepairManagementDnsZoneBindingRequest.php index ed4835b88c64..b438309f8d3c 100644 --- a/VmwareEngine/src/V1/RepairManagementDnsZoneBindingRequest.php +++ b/VmwareEngine/src/V1/RepairManagementDnsZoneBindingRequest.php @@ -24,7 +24,7 @@ class RepairManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -41,7 +41,7 @@ class RepairManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the management DNS zone binding to repair. diff --git a/VmwareEngine/src/V1/ResetNsxCredentialsRequest.php b/VmwareEngine/src/V1/ResetNsxCredentialsRequest.php index f628295e204f..9da980200072 100644 --- a/VmwareEngine/src/V1/ResetNsxCredentialsRequest.php +++ b/VmwareEngine/src/V1/ResetNsxCredentialsRequest.php @@ -26,7 +26,7 @@ class ResetNsxCredentialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $private_cloud = ''; + protected $private_cloud = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -43,7 +43,7 @@ class ResetNsxCredentialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $privateCloud Required. The resource name of the private cloud diff --git a/VmwareEngine/src/V1/ResetVcenterCredentialsRequest.php b/VmwareEngine/src/V1/ResetVcenterCredentialsRequest.php index af68d5743640..a39d63627f24 100644 --- a/VmwareEngine/src/V1/ResetVcenterCredentialsRequest.php +++ b/VmwareEngine/src/V1/ResetVcenterCredentialsRequest.php @@ -26,7 +26,7 @@ class ResetVcenterCredentialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $private_cloud = ''; + protected $private_cloud = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -43,7 +43,7 @@ class ResetVcenterCredentialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * Optional. The username of the user to be to reset the credentials. * The default value of this field is CloudOwner@gve.local. @@ -57,7 +57,7 @@ class ResetVcenterCredentialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string username = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $username = ''; + protected $username = ''; /** * @param string $privateCloud Required. The resource name of the private cloud diff --git a/VmwareEngine/src/V1/RevokeDnsBindPermissionRequest.php b/VmwareEngine/src/V1/RevokeDnsBindPermissionRequest.php index 17d0dc40930c..564092bc2a77 100644 --- a/VmwareEngine/src/V1/RevokeDnsBindPermissionRequest.php +++ b/VmwareEngine/src/V1/RevokeDnsBindPermissionRequest.php @@ -26,7 +26,7 @@ class RevokeDnsBindPermissionRequest 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 consumer provided user/service account which needs to be * granted permission to bind with the intranet VPC corresponding to the @@ -34,7 +34,7 @@ class RevokeDnsBindPermissionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.Principal principal = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $principal = null; + protected $principal = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -51,7 +51,7 @@ class RevokeDnsBindPermissionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The name of the resource which stores the users/service accounts diff --git a/VmwareEngine/src/V1/ShowNsxCredentialsRequest.php b/VmwareEngine/src/V1/ShowNsxCredentialsRequest.php index 9ec13a7bcc43..a84e71cca4cd 100644 --- a/VmwareEngine/src/V1/ShowNsxCredentialsRequest.php +++ b/VmwareEngine/src/V1/ShowNsxCredentialsRequest.php @@ -26,7 +26,7 @@ class ShowNsxCredentialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $private_cloud = ''; + protected $private_cloud = ''; /** * @param string $privateCloud Required. The resource name of the private cloud diff --git a/VmwareEngine/src/V1/ShowVcenterCredentialsRequest.php b/VmwareEngine/src/V1/ShowVcenterCredentialsRequest.php index d9865c1b4d5e..5201c0e2b530 100644 --- a/VmwareEngine/src/V1/ShowVcenterCredentialsRequest.php +++ b/VmwareEngine/src/V1/ShowVcenterCredentialsRequest.php @@ -26,7 +26,7 @@ class ShowVcenterCredentialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $private_cloud = ''; + protected $private_cloud = ''; /** * Optional. The username of the user to be queried for credentials. * The default value of this field is CloudOwner@gve.local. @@ -41,7 +41,7 @@ class ShowVcenterCredentialsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string username = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $username = ''; + protected $username = ''; /** * @param string $privateCloud Required. The resource name of the private cloud diff --git a/VmwareEngine/src/V1/StretchedClusterConfig.php b/VmwareEngine/src/V1/StretchedClusterConfig.php index 9f36d5edd13d..fca19569c8eb 100644 --- a/VmwareEngine/src/V1/StretchedClusterConfig.php +++ b/VmwareEngine/src/V1/StretchedClusterConfig.php @@ -24,7 +24,7 @@ class StretchedClusterConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string preferred_location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $preferred_location = ''; + protected $preferred_location = ''; /** * Required. Additional zone for a higher level of availability and load * balancing. Specify the resource name of a zone that belongs to the region @@ -34,7 +34,7 @@ class StretchedClusterConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string secondary_location = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $secondary_location = ''; + protected $secondary_location = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/Subnet.php b/VmwareEngine/src/V1/Subnet.php index 808dc06f3626..dc5ded5f9a43 100644 --- a/VmwareEngine/src/V1/Subnet.php +++ b/VmwareEngine/src/V1/Subnet.php @@ -25,39 +25,39 @@ class Subnet extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * The IP address range of the subnet in CIDR format '10.0.0.0/24'. * * Generated from protobuf field string ip_cidr_range = 7; */ - private $ip_cidr_range = ''; + protected $ip_cidr_range = ''; /** * The IP address of the gateway of this subnet. * Must fall within the IP prefix defined above. * * Generated from protobuf field string gateway_ip = 8; */ - private $gateway_ip = ''; + protected $gateway_ip = ''; /** * Output only. The type of the subnet. For example "management" or * "userDefined". * * Generated from protobuf field string type = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $type = ''; + protected $type = ''; /** * Output only. The state of the resource. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Subnet.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. VLAN ID of the VLAN on which the subnet is configured * * Generated from protobuf field int32 vlan_id = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $vlan_id = 0; + protected $vlan_id = 0; /** * Constructor. diff --git a/VmwareEngine/src/V1/UndeletePrivateCloudRequest.php b/VmwareEngine/src/V1/UndeletePrivateCloudRequest.php index fec1fdb9c85c..821fbcbc6865 100644 --- a/VmwareEngine/src/V1/UndeletePrivateCloudRequest.php +++ b/VmwareEngine/src/V1/UndeletePrivateCloudRequest.php @@ -25,14 +25,14 @@ class UndeletePrivateCloudRequest 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 request ID must be a valid UUID with the exception that zero * UUID is not supported (00000000-0000-0000-0000-000000000000). * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The resource name of the private cloud scheduled for deletion. diff --git a/VmwareEngine/src/V1/UpdateClusterRequest.php b/VmwareEngine/src/V1/UpdateClusterRequest.php index 6301ff2a5604..badc304f0823 100644 --- a/VmwareEngine/src/V1/UpdateClusterRequest.php +++ b/VmwareEngine/src/V1/UpdateClusterRequest.php @@ -25,27 +25,27 @@ class UpdateClusterRequest 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 description of the cluster. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $cluster = null; + protected $cluster = null; /** * Optional. The request ID must be a valid UUID with the exception that * zero UUID is not supported (00000000-0000-0000-0000-000000000000). * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * Optional. True if you want the request to be validated and not executed; * false otherwise. * * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $validate_only = false; + protected $validate_only = false; /** * @param \Google\Cloud\VmwareEngine\V1\Cluster $cluster Required. The description of the cluster. diff --git a/VmwareEngine/src/V1/UpdateDnsForwardingRequest.php b/VmwareEngine/src/V1/UpdateDnsForwardingRequest.php index 81d606f0b4b5..8d37ab7be38e 100644 --- a/VmwareEngine/src/V1/UpdateDnsForwardingRequest.php +++ b/VmwareEngine/src/V1/UpdateDnsForwardingRequest.php @@ -21,7 +21,7 @@ class UpdateDnsForwardingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.DnsForwarding dns_forwarding = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $dns_forwarding = null; + protected $dns_forwarding = null; /** * Required. Field mask is used to specify the fields to be overwritten in the * `DnsForwarding` resource by the update. @@ -31,7 +31,7 @@ class UpdateDnsForwardingRequest 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; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class UpdateDnsForwardingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\DnsForwarding $dnsForwarding Required. DnsForwarding config details. diff --git a/VmwareEngine/src/V1/UpdateExternalAccessRuleRequest.php b/VmwareEngine/src/V1/UpdateExternalAccessRuleRequest.php index a40a03b55f4d..7012b7dd0069 100644 --- a/VmwareEngine/src/V1/UpdateExternalAccessRuleRequest.php +++ b/VmwareEngine/src/V1/UpdateExternalAccessRuleRequest.php @@ -25,13 +25,13 @@ class UpdateExternalAccessRuleRequest 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. Description of the external access rule. * * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rule = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $external_access_rule = null; + protected $external_access_rule = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class UpdateExternalAccessRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\ExternalAccessRule $externalAccessRule Required. Description of the external access rule. diff --git a/VmwareEngine/src/V1/UpdateExternalAddressRequest.php b/VmwareEngine/src/V1/UpdateExternalAddressRequest.php index b529883f30e5..9b39c54b907a 100644 --- a/VmwareEngine/src/V1/UpdateExternalAddressRequest.php +++ b/VmwareEngine/src/V1/UpdateExternalAddressRequest.php @@ -25,13 +25,13 @@ class UpdateExternalAddressRequest 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. External IP address description. * * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress external_address = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $external_address = null; + protected $external_address = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class UpdateExternalAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\ExternalAddress $externalAddress Required. External IP address description. diff --git a/VmwareEngine/src/V1/UpdateLoggingServerRequest.php b/VmwareEngine/src/V1/UpdateLoggingServerRequest.php index f284286784fd..a1fa394ba6f0 100644 --- a/VmwareEngine/src/V1/UpdateLoggingServerRequest.php +++ b/VmwareEngine/src/V1/UpdateLoggingServerRequest.php @@ -25,13 +25,13 @@ class UpdateLoggingServerRequest 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. Logging server description. * * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer logging_server = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $logging_server = null; + protected $logging_server = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class UpdateLoggingServerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\LoggingServer $loggingServer Required. Logging server description. diff --git a/VmwareEngine/src/V1/UpdateManagementDnsZoneBindingRequest.php b/VmwareEngine/src/V1/UpdateManagementDnsZoneBindingRequest.php index 9e55545629a2..5080e3c59eb6 100644 --- a/VmwareEngine/src/V1/UpdateManagementDnsZoneBindingRequest.php +++ b/VmwareEngine/src/V1/UpdateManagementDnsZoneBindingRequest.php @@ -25,13 +25,13 @@ class UpdateManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. New values to update the management DNS zone binding with. * * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_binding = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $management_dns_zone_binding = null; + protected $management_dns_zone_binding = null; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class UpdateManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding $managementDnsZoneBinding Required. New values to update the management DNS zone binding with. diff --git a/VmwareEngine/src/V1/UpdateNetworkPeeringRequest.php b/VmwareEngine/src/V1/UpdateNetworkPeeringRequest.php index bda3b0805795..cb753c3e50ff 100644 --- a/VmwareEngine/src/V1/UpdateNetworkPeeringRequest.php +++ b/VmwareEngine/src/V1/UpdateNetworkPeeringRequest.php @@ -21,7 +21,7 @@ class UpdateNetworkPeeringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering network_peering = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_peering = null; + protected $network_peering = null; /** * Required. Field mask is used to specify the fields to be overwritten in the * `NetworkPeering` resource by the update. @@ -31,7 +31,7 @@ class UpdateNetworkPeeringRequest 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; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class UpdateNetworkPeeringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\NetworkPeering $networkPeering Required. Network peering description. diff --git a/VmwareEngine/src/V1/UpdateNetworkPolicyRequest.php b/VmwareEngine/src/V1/UpdateNetworkPolicyRequest.php index 2fd24b76f052..7fddaaad169e 100644 --- a/VmwareEngine/src/V1/UpdateNetworkPolicyRequest.php +++ b/VmwareEngine/src/V1/UpdateNetworkPolicyRequest.php @@ -21,7 +21,7 @@ class UpdateNetworkPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy network_policy = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_policy = null; + protected $network_policy = null; /** * Required. Field mask is used to specify the fields to be overwritten in the * `NetworkPolicy` resource by the update. @@ -31,7 +31,7 @@ class UpdateNetworkPolicyRequest 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; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class UpdateNetworkPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\NetworkPolicy $networkPolicy Required. Network policy description. diff --git a/VmwareEngine/src/V1/UpdatePrivateCloudRequest.php b/VmwareEngine/src/V1/UpdatePrivateCloudRequest.php index c6a168ad120f..16c19f6e1410 100644 --- a/VmwareEngine/src/V1/UpdatePrivateCloudRequest.php +++ b/VmwareEngine/src/V1/UpdatePrivateCloudRequest.php @@ -21,7 +21,7 @@ class UpdatePrivateCloudRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud private_cloud = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $private_cloud = null; + protected $private_cloud = null; /** * Required. Field mask is used to specify the fields to be overwritten in the * `PrivateCloud` resource by the update. The fields specified in `updateMask` @@ -31,14 +31,14 @@ class UpdatePrivateCloudRequest 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; /** * Optional. The request ID must be a valid UUID with the exception that zero * UUID is not supported (00000000-0000-0000-0000-000000000000). * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\PrivateCloud $privateCloud Required. Private cloud description. diff --git a/VmwareEngine/src/V1/UpdatePrivateConnectionRequest.php b/VmwareEngine/src/V1/UpdatePrivateConnectionRequest.php index cb2d7b561406..24fa1e9a5ae6 100644 --- a/VmwareEngine/src/V1/UpdatePrivateConnectionRequest.php +++ b/VmwareEngine/src/V1/UpdatePrivateConnectionRequest.php @@ -21,7 +21,7 @@ class UpdatePrivateConnectionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection private_connection = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $private_connection = null; + protected $private_connection = null; /** * Required. Field mask is used to specify the fields to be overwritten in the * `PrivateConnection` resource by the update. @@ -31,7 +31,7 @@ class UpdatePrivateConnectionRequest 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; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class UpdatePrivateConnectionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\PrivateConnection $privateConnection Required. Private connection description. diff --git a/VmwareEngine/src/V1/UpdateSubnetRequest.php b/VmwareEngine/src/V1/UpdateSubnetRequest.php index 2749a715792e..b4877c06c757 100644 --- a/VmwareEngine/src/V1/UpdateSubnetRequest.php +++ b/VmwareEngine/src/V1/UpdateSubnetRequest.php @@ -25,13 +25,13 @@ class UpdateSubnetRequest 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. Subnet description. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Subnet subnet = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnet = null; + protected $subnet = null; /** * @param \Google\Cloud\VmwareEngine\V1\Subnet $subnet Required. Subnet description. diff --git a/VmwareEngine/src/V1/UpdateVmwareEngineNetworkRequest.php b/VmwareEngine/src/V1/UpdateVmwareEngineNetworkRequest.php index 5cdc0d2ed0ac..38f1091baa29 100644 --- a/VmwareEngine/src/V1/UpdateVmwareEngineNetworkRequest.php +++ b/VmwareEngine/src/V1/UpdateVmwareEngineNetworkRequest.php @@ -21,7 +21,7 @@ class UpdateVmwareEngineNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_network = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $vmware_engine_network = null; + protected $vmware_engine_network = null; /** * Required. Field mask is used to specify the fields to be overwritten in the * VMware Engine network resource by the update. @@ -32,7 +32,7 @@ class UpdateVmwareEngineNetworkRequest 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; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -49,7 +49,7 @@ class UpdateVmwareEngineNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork $vmwareEngineNetwork Required. VMware Engine network description. diff --git a/VmwareEngine/src/V1/Vcenter.php b/VmwareEngine/src/V1/Vcenter.php index 5fde8d4313af..1d7fb8297ae3 100644 --- a/VmwareEngine/src/V1/Vcenter.php +++ b/VmwareEngine/src/V1/Vcenter.php @@ -20,25 +20,25 @@ class Vcenter extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string internal_ip = 2; */ - private $internal_ip = ''; + protected $internal_ip = ''; /** * Version of the appliance. * * Generated from protobuf field string version = 4; */ - private $version = ''; + protected $version = ''; /** * Output only. The state of the appliance. * * Generated from protobuf field .google.cloud.vmwareengine.v1.Vcenter.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Fully qualified domain name of the appliance. * * Generated from protobuf field string fqdn = 6; */ - private $fqdn = ''; + protected $fqdn = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/VmwareEngineClient.php b/VmwareEngine/src/V1/VmwareEngineClient.php deleted file mode 100644 index d606ecc2c814..000000000000 --- a/VmwareEngine/src/V1/VmwareEngineClient.php +++ /dev/null @@ -1,34 +0,0 @@ -string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. Creation time of this resource. * * 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. Last update time of this resource. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * User-provided description for this VMware Engine network. * * Generated from protobuf field string description = 5; */ - private $description = ''; + protected $description = ''; /** * Output only. VMware Engine service VPC networks that provide connectivity * from a private cloud to customer projects, the internet, and other Google @@ -57,19 +57,19 @@ class VmwareEngineNetwork extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Required. VMware Engine network type. * * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.Type type = 8 [(.google.api.field_behavior) = REQUIRED]; */ - private $type = 0; + protected $type = 0; /** * Output only. System-generated unique identifier for the resource. * * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $uid = ''; + protected $uid = ''; /** * Checksum that may be sent on update and delete requests to ensure that the * user-provided value is up to date before the server processes a request. @@ -78,7 +78,7 @@ class VmwareEngineNetwork extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string etag = 10; */ - private $etag = ''; + protected $etag = ''; /** * Constructor. diff --git a/VmwareEngine/src/V1/VmwareEngineNetwork/VpcNetwork.php b/VmwareEngine/src/V1/VmwareEngineNetwork/VpcNetwork.php index 9138f5455f07..a994e1283fb4 100644 --- a/VmwareEngine/src/V1/VmwareEngineNetwork/VpcNetwork.php +++ b/VmwareEngine/src/V1/VmwareEngineNetwork/VpcNetwork.php @@ -22,7 +22,7 @@ class VpcNetwork extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.VpcNetwork.Type type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $type = 0; + protected $type = 0; /** * Output only. The relative resource name of the service VPC network this * VMware Engine network is attached to. For example: @@ -30,7 +30,7 @@ class VpcNetwork extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $network = ''; + protected $network = ''; /** * Constructor. diff --git a/VmwareEngine/tests/Unit/V1/Client/VmwareEngineClientTest.php b/VmwareEngine/tests/Unit/V1/Client/VmwareEngineClientTest.php index 836e01785e30..9ea9f5599bf4 100644 --- a/VmwareEngine/tests/Unit/V1/Client/VmwareEngineClientTest.php +++ b/VmwareEngine/tests/Unit/V1/Client/VmwareEngineClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return VmwareEngineClient */ @@ -299,12 +301,15 @@ public function createClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); @@ -449,12 +454,15 @@ public function createExternalAccessRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); @@ -592,12 +600,15 @@ public function createExternalAddressExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); @@ -731,12 +742,15 @@ public function createHcxActivationKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); @@ -880,12 +894,15 @@ public function createLoggingServerExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); @@ -979,7 +996,10 @@ public function createManagementDnsZoneBindingTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/CreateManagementDnsZoneBinding', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.vmwareengine.v1.VmwareEngine/CreateManagementDnsZoneBinding', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getManagementDnsZoneBinding(); @@ -1029,12 +1049,15 @@ public function createManagementDnsZoneBindingExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); @@ -1127,7 +1150,11 @@ public function createNetworkPeeringTest() $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); - $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); $request = (new CreateNetworkPeeringRequest()) ->setParent($formattedParent) @@ -1192,12 +1219,15 @@ public function createNetworkPeeringExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -1207,7 +1237,11 @@ public function createNetworkPeeringExceptionTest() $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); - $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); $request = (new CreateNetworkPeeringRequest()) ->setParent($formattedParent) @@ -1345,12 +1379,15 @@ public function createNetworkPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -1501,12 +1538,15 @@ public function createPrivateCloudExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -1600,7 +1640,11 @@ public function createPrivateConnectionTest() $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $privateConnectionId = 'privateConnectionId-1948601248'; $privateConnection = new PrivateConnection(); - $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); $privateConnectionType = Type::TYPE_UNSPECIFIED; $privateConnection->setType($privateConnectionType); @@ -1669,18 +1713,25 @@ public function createPrivateConnectionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); $privateConnectionId = 'privateConnectionId-1948601248'; $privateConnection = new PrivateConnection(); - $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); $privateConnectionType = Type::TYPE_UNSPECIFIED; $privateConnection->setType($privateConnectionType); @@ -1818,12 +1869,15 @@ public function createVmwareEngineNetworkExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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]'); @@ -1888,8 +1942,7 @@ public function deleteClusterTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $request = (new DeleteClusterRequest()) - ->setName($formattedName); + $request = (new DeleteClusterRequest())->setName($formattedName); $response = $gapicClient->deleteCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1945,17 +1998,19 @@ public function deleteClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $request = (new DeleteClusterRequest()) - ->setName($formattedName); + $request = (new DeleteClusterRequest())->setName($formattedName); $response = $gapicClient->deleteCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2008,9 +2063,13 @@ public function deleteExternalAccessRuleTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - $request = (new DeleteExternalAccessRuleRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->externalAccessRuleName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]', + '[EXTERNAL_ACCESS_RULE]' + ); + $request = (new DeleteExternalAccessRuleRequest())->setName($formattedName); $response = $gapicClient->deleteExternalAccessRule($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2066,17 +2125,24 @@ public function deleteExternalAccessRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - $request = (new DeleteExternalAccessRuleRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->externalAccessRuleName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]', + '[EXTERNAL_ACCESS_RULE]' + ); + $request = (new DeleteExternalAccessRuleRequest())->setName($formattedName); $response = $gapicClient->deleteExternalAccessRule($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2129,9 +2195,13 @@ public function deleteExternalAddressTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - $request = (new DeleteExternalAddressRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->externalAddressName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[EXTERNAL_ADDRESS]' + ); + $request = (new DeleteExternalAddressRequest())->setName($formattedName); $response = $gapicClient->deleteExternalAddress($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2187,17 +2257,24 @@ public function deleteExternalAddressExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - $request = (new DeleteExternalAddressRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->externalAddressName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[EXTERNAL_ADDRESS]' + ); + $request = (new DeleteExternalAddressRequest())->setName($formattedName); $response = $gapicClient->deleteExternalAddress($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2250,9 +2327,13 @@ public function deleteLoggingServerTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - $request = (new DeleteLoggingServerRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->loggingServerName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[LOGGING_SERVER]' + ); + $request = (new DeleteLoggingServerRequest())->setName($formattedName); $response = $gapicClient->deleteLoggingServer($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2308,17 +2389,24 @@ public function deleteLoggingServerExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - $request = (new DeleteLoggingServerRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->loggingServerName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[LOGGING_SERVER]' + ); + $request = (new DeleteLoggingServerRequest())->setName($formattedName); $response = $gapicClient->deleteLoggingServer($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2371,9 +2459,13 @@ public function deleteManagementDnsZoneBindingTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $request = (new DeleteManagementDnsZoneBindingRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->managementDnsZoneBindingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[MANAGEMENT_DNS_ZONE_BINDING]' + ); + $request = (new DeleteManagementDnsZoneBindingRequest())->setName($formattedName); $response = $gapicClient->deleteManagementDnsZoneBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2383,7 +2475,10 @@ public function deleteManagementDnsZoneBindingTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/DeleteManagementDnsZoneBinding', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.vmwareengine.v1.VmwareEngine/DeleteManagementDnsZoneBinding', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -2429,17 +2524,24 @@ public function deleteManagementDnsZoneBindingExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $request = (new DeleteManagementDnsZoneBindingRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->managementDnsZoneBindingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[MANAGEMENT_DNS_ZONE_BINDING]' + ); + $request = (new DeleteManagementDnsZoneBindingRequest())->setName($formattedName); $response = $gapicClient->deleteManagementDnsZoneBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2493,8 +2595,7 @@ public function deleteNetworkPeeringTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $request = (new DeleteNetworkPeeringRequest()) - ->setName($formattedName); + $request = (new DeleteNetworkPeeringRequest())->setName($formattedName); $response = $gapicClient->deleteNetworkPeering($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2550,17 +2651,19 @@ public function deleteNetworkPeeringExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $request = (new DeleteNetworkPeeringRequest()) - ->setName($formattedName); + $request = (new DeleteNetworkPeeringRequest())->setName($formattedName); $response = $gapicClient->deleteNetworkPeering($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2614,8 +2717,7 @@ public function deleteNetworkPolicyTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $request = (new DeleteNetworkPolicyRequest()) - ->setName($formattedName); + $request = (new DeleteNetworkPolicyRequest())->setName($formattedName); $response = $gapicClient->deleteNetworkPolicy($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2671,17 +2773,19 @@ public function deleteNetworkPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $request = (new DeleteNetworkPolicyRequest()) - ->setName($formattedName); + $request = (new DeleteNetworkPolicyRequest())->setName($formattedName); $response = $gapicClient->deleteNetworkPolicy($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2741,8 +2845,7 @@ public function deletePrivateCloudTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new DeletePrivateCloudRequest()) - ->setName($formattedName); + $request = (new DeletePrivateCloudRequest())->setName($formattedName); $response = $gapicClient->deletePrivateCloud($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2798,17 +2901,19 @@ public function deletePrivateCloudExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new DeletePrivateCloudRequest()) - ->setName($formattedName); + $request = (new DeletePrivateCloudRequest())->setName($formattedName); $response = $gapicClient->deletePrivateCloud($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2862,8 +2967,7 @@ public function deletePrivateConnectionTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $request = (new DeletePrivateConnectionRequest()) - ->setName($formattedName); + $request = (new DeletePrivateConnectionRequest())->setName($formattedName); $response = $gapicClient->deletePrivateConnection($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2919,17 +3023,19 @@ public function deletePrivateConnectionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $request = (new DeletePrivateConnectionRequest()) - ->setName($formattedName); + $request = (new DeletePrivateConnectionRequest())->setName($formattedName); $response = $gapicClient->deletePrivateConnection($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2983,8 +3089,7 @@ public function deleteVmwareEngineNetworkTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $request = (new DeleteVmwareEngineNetworkRequest()) - ->setName($formattedName); + $request = (new DeleteVmwareEngineNetworkRequest())->setName($formattedName); $response = $gapicClient->deleteVmwareEngineNetwork($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -3040,17 +3145,19 @@ public function deleteVmwareEngineNetworkExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $request = (new DeleteVmwareEngineNetworkRequest()) - ->setName($formattedName); + $request = (new DeleteVmwareEngineNetworkRequest())->setName($formattedName); $response = $gapicClient->deleteVmwareEngineNetwork($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -3084,17 +3191,14 @@ public function fetchNetworkPolicyExternalAddressesTest() // Mock response $nextPageToken = ''; $externalAddressesElement = new ExternalAddress(); - $externalAddresses = [ - $externalAddressesElement, - ]; + $externalAddresses = [$externalAddressesElement]; $expectedResponse = new FetchNetworkPolicyExternalAddressesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setExternalAddresses($externalAddresses); $transport->addResponse($expectedResponse); // Mock request $formattedNetworkPolicy = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $request = (new FetchNetworkPolicyExternalAddressesRequest()) - ->setNetworkPolicy($formattedNetworkPolicy); + $request = (new FetchNetworkPolicyExternalAddressesRequest())->setNetworkPolicy($formattedNetworkPolicy); $response = $gapicClient->fetchNetworkPolicyExternalAddresses($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3104,7 +3208,10 @@ public function fetchNetworkPolicyExternalAddressesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/FetchNetworkPolicyExternalAddresses', $actualFuncCall); + $this->assertSame( + '/google.cloud.vmwareengine.v1.VmwareEngine/FetchNetworkPolicyExternalAddresses', + $actualFuncCall + ); $actualValue = $actualRequestObject->getNetworkPolicy(); $this->assertProtobufEquals($formattedNetworkPolicy, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -3121,17 +3228,19 @@ public function fetchNetworkPolicyExternalAddressesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedNetworkPolicy = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $request = (new FetchNetworkPolicyExternalAddressesRequest()) - ->setNetworkPolicy($formattedNetworkPolicy); + $request = (new FetchNetworkPolicyExternalAddressesRequest())->setNetworkPolicy($formattedNetworkPolicy); try { $gapicClient->fetchNetworkPolicyExternalAddresses($request); // If the $gapicClient method call did not throw, fail the test @@ -3164,8 +3273,7 @@ public function getClusterTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $request = (new GetClusterRequest()) - ->setName($formattedName); + $request = (new GetClusterRequest())->setName($formattedName); $response = $gapicClient->getCluster($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3189,17 +3297,19 @@ public function getClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $request = (new GetClusterRequest()) - ->setName($formattedName); + $request = (new GetClusterRequest())->setName($formattedName); try { $gapicClient->getCluster($request); // If the $gapicClient method call did not throw, fail the test @@ -3228,8 +3338,7 @@ public function getDnsBindPermissionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - $request = (new GetDnsBindPermissionRequest()) - ->setName($formattedName); + $request = (new GetDnsBindPermissionRequest())->setName($formattedName); $response = $gapicClient->getDnsBindPermission($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3253,17 +3362,19 @@ public function getDnsBindPermissionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - $request = (new GetDnsBindPermissionRequest()) - ->setName($formattedName); + $request = (new GetDnsBindPermissionRequest())->setName($formattedName); try { $gapicClient->getDnsBindPermission($request); // If the $gapicClient method call did not throw, fail the test @@ -3292,8 +3403,7 @@ public function getDnsForwardingTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new GetDnsForwardingRequest()) - ->setName($formattedName); + $request = (new GetDnsForwardingRequest())->setName($formattedName); $response = $gapicClient->getDnsForwarding($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3317,17 +3427,19 @@ public function getDnsForwardingExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new GetDnsForwardingRequest()) - ->setName($formattedName); + $request = (new GetDnsForwardingRequest())->setName($formattedName); try { $gapicClient->getDnsForwarding($request); // If the $gapicClient method call did not throw, fail the test @@ -3363,9 +3475,13 @@ public function getExternalAccessRuleTest() $expectedResponse->setUid($uid); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - $request = (new GetExternalAccessRuleRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->externalAccessRuleName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]', + '[EXTERNAL_ACCESS_RULE]' + ); + $request = (new GetExternalAccessRuleRequest())->setName($formattedName); $response = $gapicClient->getExternalAccessRule($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3389,17 +3505,24 @@ public function getExternalAccessRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - $request = (new GetExternalAccessRuleRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->externalAccessRuleName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]', + '[EXTERNAL_ACCESS_RULE]' + ); + $request = (new GetExternalAccessRuleRequest())->setName($formattedName); try { $gapicClient->getExternalAccessRule($request); // If the $gapicClient method call did not throw, fail the test @@ -3435,9 +3558,13 @@ public function getExternalAddressTest() $expectedResponse->setDescription($description); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - $request = (new GetExternalAddressRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->externalAddressName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[EXTERNAL_ADDRESS]' + ); + $request = (new GetExternalAddressRequest())->setName($formattedName); $response = $gapicClient->getExternalAddress($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3461,17 +3588,24 @@ public function getExternalAddressExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - $request = (new GetExternalAddressRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->externalAddressName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[EXTERNAL_ADDRESS]' + ); + $request = (new GetExternalAddressRequest())->setName($formattedName); try { $gapicClient->getExternalAddress($request); // If the $gapicClient method call did not throw, fail the test @@ -3503,9 +3637,13 @@ public function getHcxActivationKeyTest() $expectedResponse->setUid($uid); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); - $request = (new GetHcxActivationKeyRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->hcxActivationKeyName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[HCX_ACTIVATION_KEY]' + ); + $request = (new GetHcxActivationKeyRequest())->setName($formattedName); $response = $gapicClient->getHcxActivationKey($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3529,17 +3667,24 @@ public function getHcxActivationKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); - $request = (new GetHcxActivationKeyRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->hcxActivationKeyName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[HCX_ACTIVATION_KEY]' + ); + $request = (new GetHcxActivationKeyRequest())->setName($formattedName); try { $gapicClient->getHcxActivationKey($request); // If the $gapicClient method call did not throw, fail the test @@ -3573,9 +3718,13 @@ public function getLoggingServerTest() $expectedResponse->setUid($uid); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - $request = (new GetLoggingServerRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->loggingServerName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[LOGGING_SERVER]' + ); + $request = (new GetLoggingServerRequest())->setName($formattedName); $response = $gapicClient->getLoggingServer($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3599,17 +3748,24 @@ public function getLoggingServerExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - $request = (new GetLoggingServerRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->loggingServerName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[LOGGING_SERVER]' + ); + $request = (new GetLoggingServerRequest())->setName($formattedName); try { $gapicClient->getLoggingServer($request); // If the $gapicClient method call did not throw, fail the test @@ -3643,9 +3799,13 @@ public function getManagementDnsZoneBindingTest() $expectedResponse->setUid($uid); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $request = (new GetManagementDnsZoneBindingRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->managementDnsZoneBindingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[MANAGEMENT_DNS_ZONE_BINDING]' + ); + $request = (new GetManagementDnsZoneBindingRequest())->setName($formattedName); $response = $gapicClient->getManagementDnsZoneBinding($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3669,17 +3829,24 @@ public function getManagementDnsZoneBindingExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $request = (new GetManagementDnsZoneBindingRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->managementDnsZoneBindingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[MANAGEMENT_DNS_ZONE_BINDING]' + ); + $request = (new GetManagementDnsZoneBindingRequest())->setName($formattedName); try { $gapicClient->getManagementDnsZoneBinding($request); // If the $gapicClient method call did not throw, fail the test @@ -3730,8 +3897,7 @@ public function getNetworkPeeringTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $request = (new GetNetworkPeeringRequest()) - ->setName($formattedName); + $request = (new GetNetworkPeeringRequest())->setName($formattedName); $response = $gapicClient->getNetworkPeering($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3755,17 +3921,19 @@ public function getNetworkPeeringExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $request = (new GetNetworkPeeringRequest()) - ->setName($formattedName); + $request = (new GetNetworkPeeringRequest())->setName($formattedName); try { $gapicClient->getNetworkPeering($request); // If the $gapicClient method call did not throw, fail the test @@ -3804,8 +3972,7 @@ public function getNetworkPolicyTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $request = (new GetNetworkPolicyRequest()) - ->setName($formattedName); + $request = (new GetNetworkPolicyRequest())->setName($formattedName); $response = $gapicClient->getNetworkPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3829,17 +3996,19 @@ public function getNetworkPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $request = (new GetNetworkPolicyRequest()) - ->setName($formattedName); + $request = (new GetNetworkPolicyRequest())->setName($formattedName); try { $gapicClient->getNetworkPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -3878,8 +4047,7 @@ public function getNodeTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); - $request = (new GetNodeRequest()) - ->setName($formattedName); + $request = (new GetNodeRequest())->setName($formattedName); $response = $gapicClient->getNode($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3903,17 +4071,19 @@ public function getNodeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); - $request = (new GetNodeRequest()) - ->setName($formattedName); + $request = (new GetNodeRequest())->setName($formattedName); try { $gapicClient->getNode($request); // If the $gapicClient method call did not throw, fail the test @@ -3954,8 +4124,7 @@ public function getNodeTypeTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); - $request = (new GetNodeTypeRequest()) - ->setName($formattedName); + $request = (new GetNodeTypeRequest())->setName($formattedName); $response = $gapicClient->getNodeType($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3979,17 +4148,19 @@ public function getNodeTypeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); - $request = (new GetNodeTypeRequest()) - ->setName($formattedName); + $request = (new GetNodeTypeRequest())->setName($formattedName); try { $gapicClient->getNodeType($request); // If the $gapicClient method call did not throw, fail the test @@ -4022,8 +4193,7 @@ public function getPrivateCloudTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new GetPrivateCloudRequest()) - ->setName($formattedName); + $request = (new GetPrivateCloudRequest())->setName($formattedName); $response = $gapicClient->getPrivateCloud($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -4047,17 +4217,19 @@ public function getPrivateCloudExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new GetPrivateCloudRequest()) - ->setName($formattedName); + $request = (new GetPrivateCloudRequest())->setName($formattedName); try { $gapicClient->getPrivateCloud($request); // If the $gapicClient method call did not throw, fail the test @@ -4098,8 +4270,7 @@ public function getPrivateConnectionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $request = (new GetPrivateConnectionRequest()) - ->setName($formattedName); + $request = (new GetPrivateConnectionRequest())->setName($formattedName); $response = $gapicClient->getPrivateConnection($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -4123,17 +4294,19 @@ public function getPrivateConnectionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $request = (new GetPrivateConnectionRequest()) - ->setName($formattedName); + $request = (new GetPrivateConnectionRequest())->setName($formattedName); try { $gapicClient->getPrivateConnection($request); // If the $gapicClient method call did not throw, fail the test @@ -4170,8 +4343,7 @@ public function getSubnetTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); - $request = (new GetSubnetRequest()) - ->setName($formattedName); + $request = (new GetSubnetRequest())->setName($formattedName); $response = $gapicClient->getSubnet($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -4195,17 +4367,19 @@ public function getSubnetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); - $request = (new GetSubnetRequest()) - ->setName($formattedName); + $request = (new GetSubnetRequest())->setName($formattedName); try { $gapicClient->getSubnet($request); // If the $gapicClient method call did not throw, fail the test @@ -4240,8 +4414,7 @@ public function getVmwareEngineNetworkTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $request = (new GetVmwareEngineNetworkRequest()) - ->setName($formattedName); + $request = (new GetVmwareEngineNetworkRequest())->setName($formattedName); $response = $gapicClient->getVmwareEngineNetwork($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -4265,17 +4438,19 @@ public function getVmwareEngineNetworkExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $request = (new GetVmwareEngineNetworkRequest()) - ->setName($formattedName); + $request = (new GetVmwareEngineNetworkRequest())->setName($formattedName); try { $gapicClient->getVmwareEngineNetwork($request); // If the $gapicClient method call did not throw, fail the test @@ -4323,9 +4498,7 @@ public function grantDnsBindPermissionTest() // Mock request $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); $principal = new Principal(); - $request = (new GrantDnsBindPermissionRequest()) - ->setName($formattedName) - ->setPrincipal($principal); + $request = (new GrantDnsBindPermissionRequest())->setName($formattedName)->setPrincipal($principal); $response = $gapicClient->grantDnsBindPermission($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4383,19 +4556,20 @@ public function grantDnsBindPermissionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); $principal = new Principal(); - $request = (new GrantDnsBindPermissionRequest()) - ->setName($formattedName) - ->setPrincipal($principal); + $request = (new GrantDnsBindPermissionRequest())->setName($formattedName)->setPrincipal($principal); $response = $gapicClient->grantDnsBindPermission($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4429,17 +4603,14 @@ public function listClustersTest() // Mock response $nextPageToken = ''; $clustersElement = new Cluster(); - $clusters = [ - $clustersElement, - ]; + $clusters = [$clustersElement]; $expectedResponse = new ListClustersResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setClusters($clusters); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListClustersRequest()) - ->setParent($formattedParent); + $request = (new ListClustersRequest())->setParent($formattedParent); $response = $gapicClient->listClusters($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -4466,17 +4637,19 @@ public function listClustersExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListClustersRequest()) - ->setParent($formattedParent); + $request = (new ListClustersRequest())->setParent($formattedParent); try { $gapicClient->listClusters($request); // If the $gapicClient method call did not throw, fail the test @@ -4501,17 +4674,14 @@ public function listExternalAccessRulesTest() // Mock response $nextPageToken = ''; $externalAccessRulesElement = new ExternalAccessRule(); - $externalAccessRules = [ - $externalAccessRulesElement, - ]; + $externalAccessRules = [$externalAccessRulesElement]; $expectedResponse = new ListExternalAccessRulesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setExternalAccessRules($externalAccessRules); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $request = (new ListExternalAccessRulesRequest()) - ->setParent($formattedParent); + $request = (new ListExternalAccessRulesRequest())->setParent($formattedParent); $response = $gapicClient->listExternalAccessRules($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -4538,17 +4708,19 @@ public function listExternalAccessRulesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $request = (new ListExternalAccessRulesRequest()) - ->setParent($formattedParent); + $request = (new ListExternalAccessRulesRequest())->setParent($formattedParent); try { $gapicClient->listExternalAccessRules($request); // If the $gapicClient method call did not throw, fail the test @@ -4573,17 +4745,14 @@ public function listExternalAddressesTest() // Mock response $nextPageToken = ''; $externalAddressesElement = new ExternalAddress(); - $externalAddresses = [ - $externalAddressesElement, - ]; + $externalAddresses = [$externalAddressesElement]; $expectedResponse = new ListExternalAddressesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setExternalAddresses($externalAddresses); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListExternalAddressesRequest()) - ->setParent($formattedParent); + $request = (new ListExternalAddressesRequest())->setParent($formattedParent); $response = $gapicClient->listExternalAddresses($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -4610,17 +4779,19 @@ public function listExternalAddressesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListExternalAddressesRequest()) - ->setParent($formattedParent); + $request = (new ListExternalAddressesRequest())->setParent($formattedParent); try { $gapicClient->listExternalAddresses($request); // If the $gapicClient method call did not throw, fail the test @@ -4645,17 +4816,14 @@ public function listHcxActivationKeysTest() // Mock response $nextPageToken = ''; $hcxActivationKeysElement = new HcxActivationKey(); - $hcxActivationKeys = [ - $hcxActivationKeysElement, - ]; + $hcxActivationKeys = [$hcxActivationKeysElement]; $expectedResponse = new ListHcxActivationKeysResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setHcxActivationKeys($hcxActivationKeys); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListHcxActivationKeysRequest()) - ->setParent($formattedParent); + $request = (new ListHcxActivationKeysRequest())->setParent($formattedParent); $response = $gapicClient->listHcxActivationKeys($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -4682,17 +4850,19 @@ public function listHcxActivationKeysExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListHcxActivationKeysRequest()) - ->setParent($formattedParent); + $request = (new ListHcxActivationKeysRequest())->setParent($formattedParent); try { $gapicClient->listHcxActivationKeys($request); // If the $gapicClient method call did not throw, fail the test @@ -4717,17 +4887,14 @@ public function listLoggingServersTest() // Mock response $nextPageToken = ''; $loggingServersElement = new LoggingServer(); - $loggingServers = [ - $loggingServersElement, - ]; + $loggingServers = [$loggingServersElement]; $expectedResponse = new ListLoggingServersResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLoggingServers($loggingServers); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListLoggingServersRequest()) - ->setParent($formattedParent); + $request = (new ListLoggingServersRequest())->setParent($formattedParent); $response = $gapicClient->listLoggingServers($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -4754,17 +4921,19 @@ public function listLoggingServersExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListLoggingServersRequest()) - ->setParent($formattedParent); + $request = (new ListLoggingServersRequest())->setParent($formattedParent); try { $gapicClient->listLoggingServers($request); // If the $gapicClient method call did not throw, fail the test @@ -4789,17 +4958,14 @@ public function listManagementDnsZoneBindingsTest() // Mock response $nextPageToken = ''; $managementDnsZoneBindingsElement = new ManagementDnsZoneBinding(); - $managementDnsZoneBindings = [ - $managementDnsZoneBindingsElement, - ]; + $managementDnsZoneBindings = [$managementDnsZoneBindingsElement]; $expectedResponse = new ListManagementDnsZoneBindingsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setManagementDnsZoneBindings($managementDnsZoneBindings); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListManagementDnsZoneBindingsRequest()) - ->setParent($formattedParent); + $request = (new ListManagementDnsZoneBindingsRequest())->setParent($formattedParent); $response = $gapicClient->listManagementDnsZoneBindings($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -4826,17 +4992,19 @@ public function listManagementDnsZoneBindingsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListManagementDnsZoneBindingsRequest()) - ->setParent($formattedParent); + $request = (new ListManagementDnsZoneBindingsRequest())->setParent($formattedParent); try { $gapicClient->listManagementDnsZoneBindings($request); // If the $gapicClient method call did not throw, fail the test @@ -4861,17 +5029,14 @@ public function listNetworkPeeringsTest() // Mock response $nextPageToken = ''; $networkPeeringsElement = new NetworkPeering(); - $networkPeerings = [ - $networkPeeringsElement, - ]; + $networkPeerings = [$networkPeeringsElement]; $expectedResponse = new ListNetworkPeeringsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setNetworkPeerings($networkPeerings); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNetworkPeeringsRequest()) - ->setParent($formattedParent); + $request = (new ListNetworkPeeringsRequest())->setParent($formattedParent); $response = $gapicClient->listNetworkPeerings($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -4898,17 +5063,19 @@ public function listNetworkPeeringsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListNetworkPeeringsRequest()) - ->setParent($formattedParent); + $request = (new ListNetworkPeeringsRequest())->setParent($formattedParent); try { $gapicClient->listNetworkPeerings($request); // If the $gapicClient method call did not throw, fail the test @@ -4933,17 +5100,14 @@ public function listNetworkPoliciesTest() // Mock response $nextPageToken = ''; $networkPoliciesElement = new NetworkPolicy(); - $networkPolicies = [ - $networkPoliciesElement, - ]; + $networkPolicies = [$networkPoliciesElement]; $expectedResponse = new ListNetworkPoliciesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setNetworkPolicies($networkPolicies); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNetworkPoliciesRequest()) - ->setParent($formattedParent); + $request = (new ListNetworkPoliciesRequest())->setParent($formattedParent); $response = $gapicClient->listNetworkPolicies($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -4970,17 +5134,19 @@ public function listNetworkPoliciesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListNetworkPoliciesRequest()) - ->setParent($formattedParent); + $request = (new ListNetworkPoliciesRequest())->setParent($formattedParent); try { $gapicClient->listNetworkPolicies($request); // If the $gapicClient method call did not throw, fail the test @@ -5005,17 +5171,14 @@ public function listNodeTypesTest() // Mock response $nextPageToken = ''; $nodeTypesElement = new NodeType(); - $nodeTypes = [ - $nodeTypesElement, - ]; + $nodeTypes = [$nodeTypesElement]; $expectedResponse = new ListNodeTypesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setNodeTypes($nodeTypes); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNodeTypesRequest()) - ->setParent($formattedParent); + $request = (new ListNodeTypesRequest())->setParent($formattedParent); $response = $gapicClient->listNodeTypes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -5042,17 +5205,19 @@ public function listNodeTypesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListNodeTypesRequest()) - ->setParent($formattedParent); + $request = (new ListNodeTypesRequest())->setParent($formattedParent); try { $gapicClient->listNodeTypes($request); // If the $gapicClient method call did not throw, fail the test @@ -5077,17 +5242,14 @@ public function listNodesTest() // Mock response $nextPageToken = ''; $nodesElement = new Node(); - $nodes = [ - $nodesElement, - ]; + $nodes = [$nodesElement]; $expectedResponse = new ListNodesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setNodes($nodes); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $request = (new ListNodesRequest()) - ->setParent($formattedParent); + $request = (new ListNodesRequest())->setParent($formattedParent); $response = $gapicClient->listNodes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -5114,17 +5276,19 @@ public function listNodesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $request = (new ListNodesRequest()) - ->setParent($formattedParent); + $request = (new ListNodesRequest())->setParent($formattedParent); try { $gapicClient->listNodes($request); // If the $gapicClient method call did not throw, fail the test @@ -5149,17 +5313,14 @@ public function listPeeringRoutesTest() // Mock response $nextPageToken = ''; $peeringRoutesElement = new PeeringRoute(); - $peeringRoutes = [ - $peeringRoutesElement, - ]; + $peeringRoutes = [$peeringRoutesElement]; $expectedResponse = new ListPeeringRoutesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setPeeringRoutes($peeringRoutes); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $request = (new ListPeeringRoutesRequest()) - ->setParent($formattedParent); + $request = (new ListPeeringRoutesRequest())->setParent($formattedParent); $response = $gapicClient->listPeeringRoutes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -5186,17 +5347,19 @@ public function listPeeringRoutesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $request = (new ListPeeringRoutesRequest()) - ->setParent($formattedParent); + $request = (new ListPeeringRoutesRequest())->setParent($formattedParent); try { $gapicClient->listPeeringRoutes($request); // If the $gapicClient method call did not throw, fail the test @@ -5221,17 +5384,14 @@ public function listPrivateCloudsTest() // Mock response $nextPageToken = ''; $privateCloudsElement = new PrivateCloud(); - $privateClouds = [ - $privateCloudsElement, - ]; + $privateClouds = [$privateCloudsElement]; $expectedResponse = new ListPrivateCloudsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setPrivateClouds($privateClouds); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListPrivateCloudsRequest()) - ->setParent($formattedParent); + $request = (new ListPrivateCloudsRequest())->setParent($formattedParent); $response = $gapicClient->listPrivateClouds($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -5258,17 +5418,19 @@ public function listPrivateCloudsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListPrivateCloudsRequest()) - ->setParent($formattedParent); + $request = (new ListPrivateCloudsRequest())->setParent($formattedParent); try { $gapicClient->listPrivateClouds($request); // If the $gapicClient method call did not throw, fail the test @@ -5293,17 +5455,14 @@ public function listPrivateConnectionPeeringRoutesTest() // Mock response $nextPageToken = ''; $peeringRoutesElement = new PeeringRoute(); - $peeringRoutes = [ - $peeringRoutesElement, - ]; + $peeringRoutes = [$peeringRoutesElement]; $expectedResponse = new ListPrivateConnectionPeeringRoutesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setPeeringRoutes($peeringRoutes); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $request = (new ListPrivateConnectionPeeringRoutesRequest()) - ->setParent($formattedParent); + $request = (new ListPrivateConnectionPeeringRoutesRequest())->setParent($formattedParent); $response = $gapicClient->listPrivateConnectionPeeringRoutes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -5313,7 +5472,10 @@ public function listPrivateConnectionPeeringRoutesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateConnectionPeeringRoutes', $actualFuncCall); + $this->assertSame( + '/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateConnectionPeeringRoutes', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -5330,17 +5492,19 @@ public function listPrivateConnectionPeeringRoutesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $request = (new ListPrivateConnectionPeeringRoutesRequest()) - ->setParent($formattedParent); + $request = (new ListPrivateConnectionPeeringRoutesRequest())->setParent($formattedParent); try { $gapicClient->listPrivateConnectionPeeringRoutes($request); // If the $gapicClient method call did not throw, fail the test @@ -5365,17 +5529,14 @@ public function listPrivateConnectionsTest() // Mock response $nextPageToken = ''; $privateConnectionsElement = new PrivateConnection(); - $privateConnections = [ - $privateConnectionsElement, - ]; + $privateConnections = [$privateConnectionsElement]; $expectedResponse = new ListPrivateConnectionsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setPrivateConnections($privateConnections); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListPrivateConnectionsRequest()) - ->setParent($formattedParent); + $request = (new ListPrivateConnectionsRequest())->setParent($formattedParent); $response = $gapicClient->listPrivateConnections($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -5402,17 +5563,19 @@ public function listPrivateConnectionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListPrivateConnectionsRequest()) - ->setParent($formattedParent); + $request = (new ListPrivateConnectionsRequest())->setParent($formattedParent); try { $gapicClient->listPrivateConnections($request); // If the $gapicClient method call did not throw, fail the test @@ -5437,17 +5600,14 @@ public function listSubnetsTest() // Mock response $nextPageToken = ''; $subnetsElement = new Subnet(); - $subnets = [ - $subnetsElement, - ]; + $subnets = [$subnetsElement]; $expectedResponse = new ListSubnetsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setSubnets($subnets); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListSubnetsRequest()) - ->setParent($formattedParent); + $request = (new ListSubnetsRequest())->setParent($formattedParent); $response = $gapicClient->listSubnets($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -5474,17 +5634,19 @@ public function listSubnetsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ListSubnetsRequest()) - ->setParent($formattedParent); + $request = (new ListSubnetsRequest())->setParent($formattedParent); try { $gapicClient->listSubnets($request); // If the $gapicClient method call did not throw, fail the test @@ -5509,17 +5671,14 @@ public function listVmwareEngineNetworksTest() // Mock response $nextPageToken = ''; $vmwareEngineNetworksElement = new VmwareEngineNetwork(); - $vmwareEngineNetworks = [ - $vmwareEngineNetworksElement, - ]; + $vmwareEngineNetworks = [$vmwareEngineNetworksElement]; $expectedResponse = new ListVmwareEngineNetworksResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setVmwareEngineNetworks($vmwareEngineNetworks); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListVmwareEngineNetworksRequest()) - ->setParent($formattedParent); + $request = (new ListVmwareEngineNetworksRequest())->setParent($formattedParent); $response = $gapicClient->listVmwareEngineNetworks($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -5546,17 +5705,19 @@ public function listVmwareEngineNetworksExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_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 ListVmwareEngineNetworksRequest()) - ->setParent($formattedParent); + $request = (new ListVmwareEngineNetworksRequest())->setParent($formattedParent); try { $gapicClient->listVmwareEngineNetworks($request); // If the $gapicClient method call did not throw, fail the test @@ -5608,9 +5769,13 @@ public function repairManagementDnsZoneBindingTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $request = (new RepairManagementDnsZoneBindingRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->managementDnsZoneBindingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[MANAGEMENT_DNS_ZONE_BINDING]' + ); + $request = (new RepairManagementDnsZoneBindingRequest())->setName($formattedName); $response = $gapicClient->repairManagementDnsZoneBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -5620,7 +5785,10 @@ public function repairManagementDnsZoneBindingTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/RepairManagementDnsZoneBinding', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.vmwareengine.v1.VmwareEngine/RepairManagementDnsZoneBinding', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -5666,17 +5834,24 @@ public function repairManagementDnsZoneBindingExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $request = (new RepairManagementDnsZoneBindingRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->managementDnsZoneBindingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[MANAGEMENT_DNS_ZONE_BINDING]' + ); + $request = (new RepairManagementDnsZoneBindingRequest())->setName($formattedName); $response = $gapicClient->repairManagementDnsZoneBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -5736,8 +5911,7 @@ public function resetNsxCredentialsTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ResetNsxCredentialsRequest()) - ->setPrivateCloud($formattedPrivateCloud); + $request = (new ResetNsxCredentialsRequest())->setPrivateCloud($formattedPrivateCloud); $response = $gapicClient->resetNsxCredentials($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -5793,17 +5967,19 @@ public function resetNsxCredentialsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ResetNsxCredentialsRequest()) - ->setPrivateCloud($formattedPrivateCloud); + $request = (new ResetNsxCredentialsRequest())->setPrivateCloud($formattedPrivateCloud); $response = $gapicClient->resetNsxCredentials($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -5863,8 +6039,7 @@ public function resetVcenterCredentialsTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ResetVcenterCredentialsRequest()) - ->setPrivateCloud($formattedPrivateCloud); + $request = (new ResetVcenterCredentialsRequest())->setPrivateCloud($formattedPrivateCloud); $response = $gapicClient->resetVcenterCredentials($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -5920,17 +6095,19 @@ public function resetVcenterCredentialsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ResetVcenterCredentialsRequest()) - ->setPrivateCloud($formattedPrivateCloud); + $request = (new ResetVcenterCredentialsRequest())->setPrivateCloud($formattedPrivateCloud); $response = $gapicClient->resetVcenterCredentials($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -5987,9 +6164,7 @@ public function revokeDnsBindPermissionTest() // Mock request $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); $principal = new Principal(); - $request = (new RevokeDnsBindPermissionRequest()) - ->setName($formattedName) - ->setPrincipal($principal); + $request = (new RevokeDnsBindPermissionRequest())->setName($formattedName)->setPrincipal($principal); $response = $gapicClient->revokeDnsBindPermission($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -6047,19 +6222,20 @@ public function revokeDnsBindPermissionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); $principal = new Principal(); - $request = (new RevokeDnsBindPermissionRequest()) - ->setName($formattedName) - ->setPrincipal($principal); + $request = (new RevokeDnsBindPermissionRequest())->setName($formattedName)->setPrincipal($principal); $response = $gapicClient->revokeDnsBindPermission($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -6099,8 +6275,7 @@ public function showNsxCredentialsTest() $transport->addResponse($expectedResponse); // Mock request $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ShowNsxCredentialsRequest()) - ->setPrivateCloud($formattedPrivateCloud); + $request = (new ShowNsxCredentialsRequest())->setPrivateCloud($formattedPrivateCloud); $response = $gapicClient->showNsxCredentials($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -6124,17 +6299,19 @@ public function showNsxCredentialsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ShowNsxCredentialsRequest()) - ->setPrivateCloud($formattedPrivateCloud); + $request = (new ShowNsxCredentialsRequest())->setPrivateCloud($formattedPrivateCloud); try { $gapicClient->showNsxCredentials($request); // If the $gapicClient method call did not throw, fail the test @@ -6165,8 +6342,7 @@ public function showVcenterCredentialsTest() $transport->addResponse($expectedResponse); // Mock request $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ShowVcenterCredentialsRequest()) - ->setPrivateCloud($formattedPrivateCloud); + $request = (new ShowVcenterCredentialsRequest())->setPrivateCloud($formattedPrivateCloud); $response = $gapicClient->showVcenterCredentials($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -6190,17 +6366,19 @@ public function showVcenterCredentialsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new ShowVcenterCredentialsRequest()) - ->setPrivateCloud($formattedPrivateCloud); + $request = (new ShowVcenterCredentialsRequest())->setPrivateCloud($formattedPrivateCloud); try { $gapicClient->showVcenterCredentials($request); // If the $gapicClient method call did not throw, fail the test @@ -6251,8 +6429,7 @@ public function undeletePrivateCloudTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new UndeletePrivateCloudRequest()) - ->setName($formattedName); + $request = (new UndeletePrivateCloudRequest())->setName($formattedName); $response = $gapicClient->undeletePrivateCloud($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -6308,17 +6485,19 @@ public function undeletePrivateCloudExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $request = (new UndeletePrivateCloudRequest()) - ->setName($formattedName); + $request = (new UndeletePrivateCloudRequest())->setName($formattedName); $response = $gapicClient->undeletePrivateCloud($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -6386,9 +6565,7 @@ public function updateClusterTest() 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, ]; $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); - $request = (new UpdateClusterRequest()) - ->setUpdateMask($updateMask) - ->setCluster($cluster); + $request = (new UpdateClusterRequest())->setUpdateMask($updateMask)->setCluster($cluster); $response = $gapicClient->updateCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -6446,12 +6623,15 @@ public function updateClusterExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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(); @@ -6463,9 +6643,7 @@ public function updateClusterExceptionTest() 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, ]; $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); - $request = (new UpdateClusterRequest()) - ->setUpdateMask($updateMask) - ->setCluster($cluster); + $request = (new UpdateClusterRequest())->setUpdateMask($updateMask)->setCluster($cluster); $response = $gapicClient->updateCluster($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -6524,9 +6702,7 @@ public function updateDnsForwardingTest() $dnsForwardingForwardingRules = []; $dnsForwarding->setForwardingRules($dnsForwardingForwardingRules); $updateMask = new FieldMask(); - $request = (new UpdateDnsForwardingRequest()) - ->setDnsForwarding($dnsForwarding) - ->setUpdateMask($updateMask); + $request = (new UpdateDnsForwardingRequest())->setDnsForwarding($dnsForwarding)->setUpdateMask($updateMask); $response = $gapicClient->updateDnsForwarding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -6584,21 +6760,22 @@ public function updateDnsForwardingExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $dnsForwarding = new DnsForwarding(); $dnsForwardingForwardingRules = []; $dnsForwarding->setForwardingRules($dnsForwardingForwardingRules); $updateMask = new FieldMask(); - $request = (new UpdateDnsForwardingRequest()) - ->setDnsForwarding($dnsForwarding) - ->setUpdateMask($updateMask); + $request = (new UpdateDnsForwardingRequest())->setDnsForwarding($dnsForwarding)->setUpdateMask($updateMask); $response = $gapicClient->updateDnsForwarding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -6723,12 +6900,15 @@ public function updateExternalAccessRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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(); @@ -6860,12 +7040,15 @@ public function updateExternalAddressExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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(); @@ -6943,9 +7126,7 @@ public function updateLoggingServerTest() $loggingServer->setProtocol($loggingServerProtocol); $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; $loggingServer->setSourceType($loggingServerSourceType); - $request = (new UpdateLoggingServerRequest()) - ->setUpdateMask($updateMask) - ->setLoggingServer($loggingServer); + $request = (new UpdateLoggingServerRequest())->setUpdateMask($updateMask)->setLoggingServer($loggingServer); $response = $gapicClient->updateLoggingServer($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -7003,12 +7184,15 @@ public function updateLoggingServerExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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(); @@ -7021,9 +7205,7 @@ public function updateLoggingServerExceptionTest() $loggingServer->setProtocol($loggingServerProtocol); $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; $loggingServer->setSourceType($loggingServerSourceType); - $request = (new UpdateLoggingServerRequest()) - ->setUpdateMask($updateMask) - ->setLoggingServer($loggingServer); + $request = (new UpdateLoggingServerRequest())->setUpdateMask($updateMask)->setLoggingServer($loggingServer); $response = $gapicClient->updateLoggingServer($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -7098,7 +7280,10 @@ public function updateManagementDnsZoneBindingTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/UpdateManagementDnsZoneBinding', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.vmwareengine.v1.VmwareEngine/UpdateManagementDnsZoneBinding', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getUpdateMask(); $this->assertProtobufEquals($updateMask, $actualValue); $actualValue = $actualApiRequestObject->getManagementDnsZoneBinding(); @@ -7146,12 +7331,15 @@ public function updateManagementDnsZoneBindingExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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(); @@ -7240,12 +7428,14 @@ public function updateNetworkPeeringTest() $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); - $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); $updateMask = new FieldMask(); - $request = (new UpdateNetworkPeeringRequest()) - ->setNetworkPeering($networkPeering) - ->setUpdateMask($updateMask); + $request = (new UpdateNetworkPeeringRequest())->setNetworkPeering($networkPeering)->setUpdateMask($updateMask); $response = $gapicClient->updateNetworkPeering($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -7303,12 +7493,15 @@ public function updateNetworkPeeringExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkPeering = new NetworkPeering(); @@ -7316,12 +7509,14 @@ public function updateNetworkPeeringExceptionTest() $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); - $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); $updateMask = new FieldMask(); - $request = (new UpdateNetworkPeeringRequest()) - ->setNetworkPeering($networkPeering) - ->setUpdateMask($updateMask); + $request = (new UpdateNetworkPeeringRequest())->setNetworkPeering($networkPeering)->setUpdateMask($updateMask); $response = $gapicClient->updateNetworkPeering($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -7390,9 +7585,7 @@ public function updateNetworkPolicyTest() $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); $updateMask = new FieldMask(); - $request = (new UpdateNetworkPolicyRequest()) - ->setNetworkPolicy($networkPolicy) - ->setUpdateMask($updateMask); + $request = (new UpdateNetworkPolicyRequest())->setNetworkPolicy($networkPolicy)->setUpdateMask($updateMask); $response = $gapicClient->updateNetworkPolicy($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -7450,21 +7643,22 @@ public function updateNetworkPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkPolicy = new NetworkPolicy(); $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); $updateMask = new FieldMask(); - $request = (new UpdateNetworkPolicyRequest()) - ->setNetworkPolicy($networkPolicy) - ->setUpdateMask($updateMask); + $request = (new UpdateNetworkPolicyRequest())->setNetworkPolicy($networkPolicy)->setUpdateMask($updateMask); $response = $gapicClient->updateNetworkPolicy($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -7540,9 +7734,7 @@ public function updatePrivateCloudTest() $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); $privateCloud->setManagementCluster($privateCloudManagementCluster); $updateMask = new FieldMask(); - $request = (new UpdatePrivateCloudRequest()) - ->setPrivateCloud($privateCloud) - ->setUpdateMask($updateMask); + $request = (new UpdatePrivateCloudRequest())->setPrivateCloud($privateCloud)->setUpdateMask($updateMask); $response = $gapicClient->updatePrivateCloud($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -7600,12 +7792,15 @@ public function updatePrivateCloudExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $privateCloud = new PrivateCloud(); @@ -7625,9 +7820,7 @@ public function updatePrivateCloudExceptionTest() $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); $privateCloud->setManagementCluster($privateCloudManagementCluster); $updateMask = new FieldMask(); - $request = (new UpdatePrivateCloudRequest()) - ->setPrivateCloud($privateCloud) - ->setUpdateMask($updateMask); + $request = (new UpdatePrivateCloudRequest())->setPrivateCloud($privateCloud)->setUpdateMask($updateMask); $response = $gapicClient->updatePrivateCloud($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -7695,7 +7888,11 @@ public function updatePrivateConnectionTest() $operationsTransport->addResponse($completeOperation); // Mock request $privateConnection = new PrivateConnection(); - $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); $privateConnectionType = Type::TYPE_UNSPECIFIED; $privateConnection->setType($privateConnectionType); @@ -7762,16 +7959,23 @@ public function updatePrivateConnectionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $privateConnection = new PrivateConnection(); - $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); $privateConnectionType = Type::TYPE_UNSPECIFIED; $privateConnection->setType($privateConnectionType); @@ -7845,9 +8049,7 @@ public function updateSubnetTest() // Mock request $updateMask = new FieldMask(); $subnet = new Subnet(); - $request = (new UpdateSubnetRequest()) - ->setUpdateMask($updateMask) - ->setSubnet($subnet); + $request = (new UpdateSubnetRequest())->setUpdateMask($updateMask)->setSubnet($subnet); $response = $gapicClient->updateSubnet($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -7905,19 +8107,20 @@ public function updateSubnetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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(); $subnet = new Subnet(); - $request = (new UpdateSubnetRequest()) - ->setUpdateMask($updateMask) - ->setSubnet($subnet); + $request = (new UpdateSubnetRequest())->setUpdateMask($updateMask)->setSubnet($subnet); $response = $gapicClient->updateSubnet($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -8042,12 +8245,15 @@ public function updateVmwareEngineNetworkExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $vmwareEngineNetwork = new VmwareEngineNetwork(); @@ -8118,12 +8324,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 { @@ -8150,9 +8359,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -8182,12 +8389,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 { @@ -8220,8 +8430,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(); @@ -8245,17 +8454,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 @@ -8287,9 +8498,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(); @@ -8315,19 +8524,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 @@ -8355,9 +8565,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(); @@ -8383,19 +8591,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/VmwareEngine/tests/Unit/V1/VmwareEngineClientTest.php b/VmwareEngine/tests/Unit/V1/VmwareEngineClientTest.php deleted file mode 100644 index e644ff57743b..000000000000 --- a/VmwareEngine/tests/Unit/V1/VmwareEngineClientTest.php +++ /dev/null @@ -1,7944 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return VmwareEngineClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new VmwareEngineClient($options); - } - - /** @test */ - public function createClusterTest() - { - $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/createClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $management = false; - $uid = 'uid115792'; - $expectedResponse = new Cluster(); - $expectedResponse->setName($name); - $expectedResponse->setManagement($management); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $clusterId = 'clusterId240280960'; - $cluster = new Cluster(); - $nodeTypeConfigsValue = new NodeTypeConfig(); - $valueNodeCount = 1174748740; - $nodeTypeConfigsValue->setNodeCount($valueNodeCount); - $clusterNodeTypeConfigs = [ - 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, - ]; - $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); - $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); - $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.vmwareengine.v1.VmwareEngine/CreateCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getClusterId(); - $this->assertProtobufEquals($clusterId, $actualValue); - $actualValue = $actualApiRequestObject->getCluster(); - $this->assertProtobufEquals($cluster, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createClusterTest'); - $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 createClusterExceptionTest() - { - $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/createClusterTest'); - $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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $clusterId = 'clusterId240280960'; - $cluster = new Cluster(); - $nodeTypeConfigsValue = new NodeTypeConfig(); - $valueNodeCount = 1174748740; - $nodeTypeConfigsValue->setNodeCount($valueNodeCount); - $clusterNodeTypeConfigs = [ - 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, - ]; - $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); - $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createClusterTest'); - 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 createExternalAccessRuleTest() - { - $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/createExternalAccessRuleTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $priority = 1165461084; - $ipProtocol = 'ipProtocol-1134653776'; - $uid = 'uid115792'; - $expectedResponse = new ExternalAccessRule(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setPriority($priority); - $expectedResponse->setIpProtocol($ipProtocol); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createExternalAccessRuleTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $externalAccessRule = new ExternalAccessRule(); - $externalAccessRuleId = 'externalAccessRuleId1434975319'; - $response = $gapicClient->createExternalAccessRule($formattedParent, $externalAccessRule, $externalAccessRuleId); - $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.vmwareengine.v1.VmwareEngine/CreateExternalAccessRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getExternalAccessRule(); - $this->assertProtobufEquals($externalAccessRule, $actualValue); - $actualValue = $actualApiRequestObject->getExternalAccessRuleId(); - $this->assertProtobufEquals($externalAccessRuleId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createExternalAccessRuleTest'); - $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 createExternalAccessRuleExceptionTest() - { - $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/createExternalAccessRuleTest'); - $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->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $externalAccessRule = new ExternalAccessRule(); - $externalAccessRuleId = 'externalAccessRuleId1434975319'; - $response = $gapicClient->createExternalAccessRule($formattedParent, $externalAccessRule, $externalAccessRuleId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createExternalAccessRuleTest'); - 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 createExternalAddressTest() - { - $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/createExternalAddressTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $internalIp = 'internalIp-2080778775'; - $externalIp = 'externalIp-1153075685'; - $uid = 'uid115792'; - $description = 'description-1724546052'; - $expectedResponse = new ExternalAddress(); - $expectedResponse->setName($name); - $expectedResponse->setInternalIp($internalIp); - $expectedResponse->setExternalIp($externalIp); - $expectedResponse->setUid($uid); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createExternalAddressTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $externalAddress = new ExternalAddress(); - $externalAddressId = 'externalAddressId344331834'; - $response = $gapicClient->createExternalAddress($formattedParent, $externalAddress, $externalAddressId); - $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.vmwareengine.v1.VmwareEngine/CreateExternalAddress', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getExternalAddress(); - $this->assertProtobufEquals($externalAddress, $actualValue); - $actualValue = $actualApiRequestObject->getExternalAddressId(); - $this->assertProtobufEquals($externalAddressId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createExternalAddressTest'); - $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 createExternalAddressExceptionTest() - { - $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/createExternalAddressTest'); - $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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $externalAddress = new ExternalAddress(); - $externalAddressId = 'externalAddressId344331834'; - $response = $gapicClient->createExternalAddress($formattedParent, $externalAddress, $externalAddressId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createExternalAddressTest'); - 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 createHcxActivationKeyTest() - { - $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/createHcxActivationKeyTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $activationKey = 'activationKey-1343958090'; - $uid = 'uid115792'; - $expectedResponse = new HcxActivationKey(); - $expectedResponse->setName($name); - $expectedResponse->setActivationKey($activationKey); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createHcxActivationKeyTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $hcxActivationKey = new HcxActivationKey(); - $hcxActivationKeyId = 'hcxActivationKeyId26532194'; - $response = $gapicClient->createHcxActivationKey($formattedParent, $hcxActivationKey, $hcxActivationKeyId); - $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.vmwareengine.v1.VmwareEngine/CreateHcxActivationKey', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getHcxActivationKey(); - $this->assertProtobufEquals($hcxActivationKey, $actualValue); - $actualValue = $actualApiRequestObject->getHcxActivationKeyId(); - $this->assertProtobufEquals($hcxActivationKeyId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createHcxActivationKeyTest'); - $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 createHcxActivationKeyExceptionTest() - { - $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/createHcxActivationKeyTest'); - $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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $hcxActivationKey = new HcxActivationKey(); - $hcxActivationKeyId = 'hcxActivationKeyId26532194'; - $response = $gapicClient->createHcxActivationKey($formattedParent, $hcxActivationKey, $hcxActivationKeyId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createHcxActivationKeyTest'); - 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 createLoggingServerTest() - { - $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/createLoggingServerTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $hostname = 'hostname-299803597'; - $port = 3446913; - $uid = 'uid115792'; - $expectedResponse = new LoggingServer(); - $expectedResponse->setName($name); - $expectedResponse->setHostname($hostname); - $expectedResponse->setPort($port); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createLoggingServerTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $loggingServer = new LoggingServer(); - $loggingServerHostname = 'loggingServerHostname2082652629'; - $loggingServer->setHostname($loggingServerHostname); - $loggingServerPort = 243392733; - $loggingServer->setPort($loggingServerPort); - $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; - $loggingServer->setProtocol($loggingServerProtocol); - $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; - $loggingServer->setSourceType($loggingServerSourceType); - $loggingServerId = 'loggingServerId-2097171785'; - $response = $gapicClient->createLoggingServer($formattedParent, $loggingServer, $loggingServerId); - $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.vmwareengine.v1.VmwareEngine/CreateLoggingServer', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getLoggingServer(); - $this->assertProtobufEquals($loggingServer, $actualValue); - $actualValue = $actualApiRequestObject->getLoggingServerId(); - $this->assertProtobufEquals($loggingServerId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createLoggingServerTest'); - $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 createLoggingServerExceptionTest() - { - $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/createLoggingServerTest'); - $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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $loggingServer = new LoggingServer(); - $loggingServerHostname = 'loggingServerHostname2082652629'; - $loggingServer->setHostname($loggingServerHostname); - $loggingServerPort = 243392733; - $loggingServer->setPort($loggingServerPort); - $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; - $loggingServer->setProtocol($loggingServerProtocol); - $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; - $loggingServer->setSourceType($loggingServerSourceType); - $loggingServerId = 'loggingServerId-2097171785'; - $response = $gapicClient->createLoggingServer($formattedParent, $loggingServer, $loggingServerId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createLoggingServerTest'); - 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 createManagementDnsZoneBindingTest() - { - $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/createManagementDnsZoneBindingTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $vpcNetwork = 'vpcNetwork-764161832'; - $uid = 'uid115792'; - $expectedResponse = new ManagementDnsZoneBinding(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setVpcNetwork($vpcNetwork); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createManagementDnsZoneBindingTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $managementDnsZoneBinding = new ManagementDnsZoneBinding(); - $managementDnsZoneBindingId = 'managementDnsZoneBindingId-1294625162'; - $response = $gapicClient->createManagementDnsZoneBinding($formattedParent, $managementDnsZoneBinding, $managementDnsZoneBindingId); - $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.vmwareengine.v1.VmwareEngine/CreateManagementDnsZoneBinding', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getManagementDnsZoneBinding(); - $this->assertProtobufEquals($managementDnsZoneBinding, $actualValue); - $actualValue = $actualApiRequestObject->getManagementDnsZoneBindingId(); - $this->assertProtobufEquals($managementDnsZoneBindingId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createManagementDnsZoneBindingTest'); - $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 createManagementDnsZoneBindingExceptionTest() - { - $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/createManagementDnsZoneBindingTest'); - $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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $managementDnsZoneBinding = new ManagementDnsZoneBinding(); - $managementDnsZoneBindingId = 'managementDnsZoneBindingId-1294625162'; - $response = $gapicClient->createManagementDnsZoneBinding($formattedParent, $managementDnsZoneBinding, $managementDnsZoneBindingId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createManagementDnsZoneBindingTest'); - 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 createNetworkPeeringTest() - { - $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/createNetworkPeeringTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $peerNetwork = 'peerNetwork2111238225'; - $exportCustomRoutes = false; - $importCustomRoutes = true; - $exchangeSubnetRoutes = true; - $exportCustomRoutesWithPublicIp = true; - $importCustomRoutesWithPublicIp = false; - $stateDetails = 'stateDetails632437908'; - $peerMtu = 69584721; - $uid = 'uid115792'; - $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; - $description = 'description-1724546052'; - $expectedResponse = new NetworkPeering(); - $expectedResponse->setName($name); - $expectedResponse->setPeerNetwork($peerNetwork); - $expectedResponse->setExportCustomRoutes($exportCustomRoutes); - $expectedResponse->setImportCustomRoutes($importCustomRoutes); - $expectedResponse->setExchangeSubnetRoutes($exchangeSubnetRoutes); - $expectedResponse->setExportCustomRoutesWithPublicIp($exportCustomRoutesWithPublicIp); - $expectedResponse->setImportCustomRoutesWithPublicIp($importCustomRoutesWithPublicIp); - $expectedResponse->setStateDetails($stateDetails); - $expectedResponse->setPeerMtu($peerMtu); - $expectedResponse->setUid($uid); - $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createNetworkPeeringTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $networkPeeringId = 'networkPeeringId-2057959125'; - $networkPeering = new NetworkPeering(); - $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; - $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); - $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; - $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); - $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); - $response = $gapicClient->createNetworkPeering($formattedParent, $networkPeeringId, $networkPeering); - $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.vmwareengine.v1.VmwareEngine/CreateNetworkPeering', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkPeeringId(); - $this->assertProtobufEquals($networkPeeringId, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkPeering(); - $this->assertProtobufEquals($networkPeering, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createNetworkPeeringTest'); - $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 createNetworkPeeringExceptionTest() - { - $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/createNetworkPeeringTest'); - $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]'); - $networkPeeringId = 'networkPeeringId-2057959125'; - $networkPeering = new NetworkPeering(); - $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; - $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); - $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; - $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); - $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); - $response = $gapicClient->createNetworkPeering($formattedParent, $networkPeeringId, $networkPeering); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createNetworkPeeringTest'); - 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 createNetworkPolicyTest() - { - $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/createNetworkPolicyTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $edgeServicesCidr = 'edgeServicesCidr-792872013'; - $uid = 'uid115792'; - $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; - $description = 'description-1724546052'; - $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; - $expectedResponse = new NetworkPolicy(); - $expectedResponse->setName($name); - $expectedResponse->setEdgeServicesCidr($edgeServicesCidr); - $expectedResponse->setUid($uid); - $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); - $expectedResponse->setDescription($description); - $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createNetworkPolicyTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $networkPolicyId = 'networkPolicyId173955703'; - $networkPolicy = new NetworkPolicy(); - $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; - $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); - $response = $gapicClient->createNetworkPolicy($formattedParent, $networkPolicyId, $networkPolicy); - $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.vmwareengine.v1.VmwareEngine/CreateNetworkPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkPolicyId(); - $this->assertProtobufEquals($networkPolicyId, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkPolicy(); - $this->assertProtobufEquals($networkPolicy, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createNetworkPolicyTest'); - $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 createNetworkPolicyExceptionTest() - { - $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/createNetworkPolicyTest'); - $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]'); - $networkPolicyId = 'networkPolicyId173955703'; - $networkPolicy = new NetworkPolicy(); - $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; - $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); - $response = $gapicClient->createNetworkPolicy($formattedParent, $networkPolicyId, $networkPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createNetworkPolicyTest'); - 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 createPrivateCloudTest() - { - $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/createPrivateCloudTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $expectedResponse = new PrivateCloud(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createPrivateCloudTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $privateCloudId = 'privateCloudId1366391457'; - $privateCloud = new PrivateCloud(); - $privateCloudNetworkConfig = new NetworkConfig(); - $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; - $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); - $privateCloud->setNetworkConfig($privateCloudNetworkConfig); - $privateCloudManagementCluster = new ManagementCluster(); - $managementClusterClusterId = 'managementClusterClusterId311493182'; - $privateCloudManagementCluster->setClusterId($managementClusterClusterId); - $nodeTypeConfigsValue = new NodeTypeConfig(); - $valueNodeCount = 1174748740; - $nodeTypeConfigsValue->setNodeCount($valueNodeCount); - $managementClusterNodeTypeConfigs = [ - 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, - ]; - $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); - $privateCloud->setManagementCluster($privateCloudManagementCluster); - $response = $gapicClient->createPrivateCloud($formattedParent, $privateCloudId, $privateCloud); - $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.vmwareengine.v1.VmwareEngine/CreatePrivateCloud', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getPrivateCloudId(); - $this->assertProtobufEquals($privateCloudId, $actualValue); - $actualValue = $actualApiRequestObject->getPrivateCloud(); - $this->assertProtobufEquals($privateCloud, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createPrivateCloudTest'); - $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 createPrivateCloudExceptionTest() - { - $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/createPrivateCloudTest'); - $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]'); - $privateCloudId = 'privateCloudId1366391457'; - $privateCloud = new PrivateCloud(); - $privateCloudNetworkConfig = new NetworkConfig(); - $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; - $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); - $privateCloud->setNetworkConfig($privateCloudNetworkConfig); - $privateCloudManagementCluster = new ManagementCluster(); - $managementClusterClusterId = 'managementClusterClusterId311493182'; - $privateCloudManagementCluster->setClusterId($managementClusterClusterId); - $nodeTypeConfigsValue = new NodeTypeConfig(); - $valueNodeCount = 1174748740; - $nodeTypeConfigsValue->setNodeCount($valueNodeCount); - $managementClusterNodeTypeConfigs = [ - 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, - ]; - $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); - $privateCloud->setManagementCluster($privateCloudManagementCluster); - $response = $gapicClient->createPrivateCloud($formattedParent, $privateCloudId, $privateCloud); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createPrivateCloudTest'); - 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 createPrivateConnectionTest() - { - $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/createPrivateConnectionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; - $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; - $peeringId = 'peeringId-1561749894'; - $uid = 'uid115792'; - $serviceNetwork = 'serviceNetwork1072775844'; - $expectedResponse = new PrivateConnection(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); - $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); - $expectedResponse->setPeeringId($peeringId); - $expectedResponse->setUid($uid); - $expectedResponse->setServiceNetwork($serviceNetwork); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createPrivateConnectionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $privateConnectionId = 'privateConnectionId-1948601248'; - $privateConnection = new PrivateConnection(); - $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); - $privateConnectionType = Type::TYPE_UNSPECIFIED; - $privateConnection->setType($privateConnectionType); - $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); - $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); - $response = $gapicClient->createPrivateConnection($formattedParent, $privateConnectionId, $privateConnection); - $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.vmwareengine.v1.VmwareEngine/CreatePrivateConnection', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getPrivateConnectionId(); - $this->assertProtobufEquals($privateConnectionId, $actualValue); - $actualValue = $actualApiRequestObject->getPrivateConnection(); - $this->assertProtobufEquals($privateConnection, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createPrivateConnectionTest'); - $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 createPrivateConnectionExceptionTest() - { - $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/createPrivateConnectionTest'); - $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]'); - $privateConnectionId = 'privateConnectionId-1948601248'; - $privateConnection = new PrivateConnection(); - $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); - $privateConnectionType = Type::TYPE_UNSPECIFIED; - $privateConnection->setType($privateConnectionType); - $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); - $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); - $response = $gapicClient->createPrivateConnection($formattedParent, $privateConnectionId, $privateConnection); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createPrivateConnectionTest'); - 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 createVmwareEngineNetworkTest() - { - $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/createVmwareEngineNetworkTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $etag = 'etag3123477'; - $expectedResponse = new VmwareEngineNetwork(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createVmwareEngineNetworkTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $vmwareEngineNetworkId = 'vmwareEngineNetworkId2131972382'; - $vmwareEngineNetwork = new VmwareEngineNetwork(); - $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; - $vmwareEngineNetwork->setType($vmwareEngineNetworkType); - $response = $gapicClient->createVmwareEngineNetwork($formattedParent, $vmwareEngineNetworkId, $vmwareEngineNetwork); - $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.vmwareengine.v1.VmwareEngine/CreateVmwareEngineNetwork', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getVmwareEngineNetworkId(); - $this->assertProtobufEquals($vmwareEngineNetworkId, $actualValue); - $actualValue = $actualApiRequestObject->getVmwareEngineNetwork(); - $this->assertProtobufEquals($vmwareEngineNetwork, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createVmwareEngineNetworkTest'); - $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 createVmwareEngineNetworkExceptionTest() - { - $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/createVmwareEngineNetworkTest'); - $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]'); - $vmwareEngineNetworkId = 'vmwareEngineNetworkId2131972382'; - $vmwareEngineNetwork = new VmwareEngineNetwork(); - $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; - $vmwareEngineNetwork->setType($vmwareEngineNetworkType); - $response = $gapicClient->createVmwareEngineNetwork($formattedParent, $vmwareEngineNetworkId, $vmwareEngineNetwork); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createVmwareEngineNetworkTest'); - 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 deleteClusterTest() - { - $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/deleteClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $response = $gapicClient->deleteCluster($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.vmwareengine.v1.VmwareEngine/DeleteCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); - $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 deleteClusterExceptionTest() - { - $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/deleteClusterTest'); - $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->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $response = $gapicClient->deleteCluster($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); - 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 deleteExternalAccessRuleTest() - { - $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/deleteExternalAccessRuleTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteExternalAccessRuleTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - $response = $gapicClient->deleteExternalAccessRule($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.vmwareengine.v1.VmwareEngine/DeleteExternalAccessRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteExternalAccessRuleTest'); - $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 deleteExternalAccessRuleExceptionTest() - { - $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/deleteExternalAccessRuleTest'); - $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->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - $response = $gapicClient->deleteExternalAccessRule($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteExternalAccessRuleTest'); - 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 deleteExternalAddressTest() - { - $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/deleteExternalAddressTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteExternalAddressTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - $response = $gapicClient->deleteExternalAddress($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.vmwareengine.v1.VmwareEngine/DeleteExternalAddress', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteExternalAddressTest'); - $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 deleteExternalAddressExceptionTest() - { - $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/deleteExternalAddressTest'); - $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->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - $response = $gapicClient->deleteExternalAddress($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteExternalAddressTest'); - 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 deleteLoggingServerTest() - { - $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/deleteLoggingServerTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteLoggingServerTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - $response = $gapicClient->deleteLoggingServer($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.vmwareengine.v1.VmwareEngine/DeleteLoggingServer', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteLoggingServerTest'); - $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 deleteLoggingServerExceptionTest() - { - $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/deleteLoggingServerTest'); - $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->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - $response = $gapicClient->deleteLoggingServer($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteLoggingServerTest'); - 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 deleteManagementDnsZoneBindingTest() - { - $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/deleteManagementDnsZoneBindingTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteManagementDnsZoneBindingTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $response = $gapicClient->deleteManagementDnsZoneBinding($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.vmwareengine.v1.VmwareEngine/DeleteManagementDnsZoneBinding', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteManagementDnsZoneBindingTest'); - $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 deleteManagementDnsZoneBindingExceptionTest() - { - $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/deleteManagementDnsZoneBindingTest'); - $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->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $response = $gapicClient->deleteManagementDnsZoneBinding($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteManagementDnsZoneBindingTest'); - 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 deleteNetworkPeeringTest() - { - $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/deleteNetworkPeeringTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteNetworkPeeringTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $response = $gapicClient->deleteNetworkPeering($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.vmwareengine.v1.VmwareEngine/DeleteNetworkPeering', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNetworkPeeringTest'); - $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 deleteNetworkPeeringExceptionTest() - { - $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/deleteNetworkPeeringTest'); - $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->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $response = $gapicClient->deleteNetworkPeering($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNetworkPeeringTest'); - 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 deleteNetworkPolicyTest() - { - $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/deleteNetworkPolicyTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteNetworkPolicyTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $response = $gapicClient->deleteNetworkPolicy($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.vmwareengine.v1.VmwareEngine/DeleteNetworkPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNetworkPolicyTest'); - $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 deleteNetworkPolicyExceptionTest() - { - $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/deleteNetworkPolicyTest'); - $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->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $response = $gapicClient->deleteNetworkPolicy($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNetworkPolicyTest'); - 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 deletePrivateCloudTest() - { - $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/deletePrivateCloudTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $expectedResponse = new PrivateCloud(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deletePrivateCloudTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->deletePrivateCloud($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.vmwareengine.v1.VmwareEngine/DeletePrivateCloud', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deletePrivateCloudTest'); - $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 deletePrivateCloudExceptionTest() - { - $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/deletePrivateCloudTest'); - $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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->deletePrivateCloud($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deletePrivateCloudTest'); - 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 deletePrivateConnectionTest() - { - $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/deletePrivateConnectionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deletePrivateConnectionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $response = $gapicClient->deletePrivateConnection($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.vmwareengine.v1.VmwareEngine/DeletePrivateConnection', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deletePrivateConnectionTest'); - $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 deletePrivateConnectionExceptionTest() - { - $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/deletePrivateConnectionTest'); - $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->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $response = $gapicClient->deletePrivateConnection($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deletePrivateConnectionTest'); - 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 deleteVmwareEngineNetworkTest() - { - $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/deleteVmwareEngineNetworkTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteVmwareEngineNetworkTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $response = $gapicClient->deleteVmwareEngineNetwork($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.vmwareengine.v1.VmwareEngine/DeleteVmwareEngineNetwork', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteVmwareEngineNetworkTest'); - $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 deleteVmwareEngineNetworkExceptionTest() - { - $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/deleteVmwareEngineNetworkTest'); - $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->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $response = $gapicClient->deleteVmwareEngineNetwork($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteVmwareEngineNetworkTest'); - 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 fetchNetworkPolicyExternalAddressesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $externalAddressesElement = new ExternalAddress(); - $externalAddresses = [ - $externalAddressesElement, - ]; - $expectedResponse = new FetchNetworkPolicyExternalAddressesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setExternalAddresses($externalAddresses); - $transport->addResponse($expectedResponse); - // Mock request - $formattedNetworkPolicy = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $response = $gapicClient->fetchNetworkPolicyExternalAddresses($formattedNetworkPolicy); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getExternalAddresses()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/FetchNetworkPolicyExternalAddresses', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkPolicy(); - $this->assertProtobufEquals($formattedNetworkPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function fetchNetworkPolicyExternalAddressesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedNetworkPolicy = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - try { - $gapicClient->fetchNetworkPolicyExternalAddresses($formattedNetworkPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getClusterTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $management = false; - $uid = 'uid115792'; - $expectedResponse = new Cluster(); - $expectedResponse->setName($name2); - $expectedResponse->setManagement($management); - $expectedResponse->setUid($uid); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $response = $gapicClient->getCluster($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.vmwareengine.v1.VmwareEngine/GetCluster', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getClusterExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - try { - $gapicClient->getCluster($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 getDnsBindPermissionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new DnsBindPermission(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->getDnsBindPermission($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.vmwareengine.v1.VmwareEngine/GetDnsBindPermission', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDnsBindPermissionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->getDnsBindPermission($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 getDnsForwardingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new DnsForwarding(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->getDnsForwarding($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.vmwareengine.v1.VmwareEngine/GetDnsForwarding', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDnsForwardingExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->getDnsForwarding($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 getExternalAccessRuleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $priority = 1165461084; - $ipProtocol = 'ipProtocol-1134653776'; - $uid = 'uid115792'; - $expectedResponse = new ExternalAccessRule(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setPriority($priority); - $expectedResponse->setIpProtocol($ipProtocol); - $expectedResponse->setUid($uid); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - $response = $gapicClient->getExternalAccessRule($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.vmwareengine.v1.VmwareEngine/GetExternalAccessRule', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExternalAccessRuleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); - try { - $gapicClient->getExternalAccessRule($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 getExternalAddressTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $internalIp = 'internalIp-2080778775'; - $externalIp = 'externalIp-1153075685'; - $uid = 'uid115792'; - $description = 'description-1724546052'; - $expectedResponse = new ExternalAddress(); - $expectedResponse->setName($name2); - $expectedResponse->setInternalIp($internalIp); - $expectedResponse->setExternalIp($externalIp); - $expectedResponse->setUid($uid); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - $response = $gapicClient->getExternalAddress($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.vmwareengine.v1.VmwareEngine/GetExternalAddress', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExternalAddressExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); - try { - $gapicClient->getExternalAddress($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 getHcxActivationKeyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $activationKey = 'activationKey-1343958090'; - $uid = 'uid115792'; - $expectedResponse = new HcxActivationKey(); - $expectedResponse->setName($name2); - $expectedResponse->setActivationKey($activationKey); - $expectedResponse->setUid($uid); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); - $response = $gapicClient->getHcxActivationKey($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.vmwareengine.v1.VmwareEngine/GetHcxActivationKey', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getHcxActivationKeyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); - try { - $gapicClient->getHcxActivationKey($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 getLoggingServerTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $hostname = 'hostname-299803597'; - $port = 3446913; - $uid = 'uid115792'; - $expectedResponse = new LoggingServer(); - $expectedResponse->setName($name2); - $expectedResponse->setHostname($hostname); - $expectedResponse->setPort($port); - $expectedResponse->setUid($uid); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - $response = $gapicClient->getLoggingServer($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.vmwareengine.v1.VmwareEngine/GetLoggingServer', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLoggingServerExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); - try { - $gapicClient->getLoggingServer($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 getManagementDnsZoneBindingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $vpcNetwork = 'vpcNetwork-764161832'; - $uid = 'uid115792'; - $expectedResponse = new ManagementDnsZoneBinding(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setVpcNetwork($vpcNetwork); - $expectedResponse->setUid($uid); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $response = $gapicClient->getManagementDnsZoneBinding($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.vmwareengine.v1.VmwareEngine/GetManagementDnsZoneBinding', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getManagementDnsZoneBindingExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - try { - $gapicClient->getManagementDnsZoneBinding($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 getNetworkPeeringTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $peerNetwork = 'peerNetwork2111238225'; - $exportCustomRoutes = false; - $importCustomRoutes = true; - $exchangeSubnetRoutes = true; - $exportCustomRoutesWithPublicIp = true; - $importCustomRoutesWithPublicIp = false; - $stateDetails = 'stateDetails632437908'; - $peerMtu = 69584721; - $uid = 'uid115792'; - $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; - $description = 'description-1724546052'; - $expectedResponse = new NetworkPeering(); - $expectedResponse->setName($name2); - $expectedResponse->setPeerNetwork($peerNetwork); - $expectedResponse->setExportCustomRoutes($exportCustomRoutes); - $expectedResponse->setImportCustomRoutes($importCustomRoutes); - $expectedResponse->setExchangeSubnetRoutes($exchangeSubnetRoutes); - $expectedResponse->setExportCustomRoutesWithPublicIp($exportCustomRoutesWithPublicIp); - $expectedResponse->setImportCustomRoutesWithPublicIp($importCustomRoutesWithPublicIp); - $expectedResponse->setStateDetails($stateDetails); - $expectedResponse->setPeerMtu($peerMtu); - $expectedResponse->setUid($uid); - $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $response = $gapicClient->getNetworkPeering($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.vmwareengine.v1.VmwareEngine/GetNetworkPeering', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNetworkPeeringExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - try { - $gapicClient->getNetworkPeering($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 getNetworkPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $edgeServicesCidr = 'edgeServicesCidr-792872013'; - $uid = 'uid115792'; - $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; - $description = 'description-1724546052'; - $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; - $expectedResponse = new NetworkPolicy(); - $expectedResponse->setName($name2); - $expectedResponse->setEdgeServicesCidr($edgeServicesCidr); - $expectedResponse->setUid($uid); - $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); - $expectedResponse->setDescription($description); - $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $response = $gapicClient->getNetworkPolicy($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.vmwareengine.v1.VmwareEngine/GetNetworkPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNetworkPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - try { - $gapicClient->getNetworkPolicy($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 getNodeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $fqdn = 'fqdn3150485'; - $internalIp = 'internalIp-2080778775'; - $nodeTypeId = 'nodeTypeId585437955'; - $version = 'version351608024'; - $customCoreCount = 2091833853; - $expectedResponse = new Node(); - $expectedResponse->setName($name2); - $expectedResponse->setFqdn($fqdn); - $expectedResponse->setInternalIp($internalIp); - $expectedResponse->setNodeTypeId($nodeTypeId); - $expectedResponse->setVersion($version); - $expectedResponse->setCustomCoreCount($customCoreCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); - $response = $gapicClient->getNode($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.vmwareengine.v1.VmwareEngine/GetNode', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNodeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); - try { - $gapicClient->getNode($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 getNodeTypeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $nodeTypeId = 'nodeTypeId585437955'; - $displayName = 'displayName1615086568'; - $virtualCpuCount = 289038212; - $totalCoreCount = 282953654; - $memoryGb = 1726613721; - $diskSizeGb = 757478089; - $expectedResponse = new NodeType(); - $expectedResponse->setName($name2); - $expectedResponse->setNodeTypeId($nodeTypeId); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setVirtualCpuCount($virtualCpuCount); - $expectedResponse->setTotalCoreCount($totalCoreCount); - $expectedResponse->setMemoryGb($memoryGb); - $expectedResponse->setDiskSizeGb($diskSizeGb); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); - $response = $gapicClient->getNodeType($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.vmwareengine.v1.VmwareEngine/GetNodeType', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNodeTypeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); - try { - $gapicClient->getNodeType($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 getPrivateCloudTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $expectedResponse = new PrivateCloud(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->getPrivateCloud($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.vmwareengine.v1.VmwareEngine/GetPrivateCloud', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getPrivateCloudExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->getPrivateCloud($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 getPrivateConnectionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; - $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; - $peeringId = 'peeringId-1561749894'; - $uid = 'uid115792'; - $serviceNetwork = 'serviceNetwork1072775844'; - $expectedResponse = new PrivateConnection(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); - $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); - $expectedResponse->setPeeringId($peeringId); - $expectedResponse->setUid($uid); - $expectedResponse->setServiceNetwork($serviceNetwork); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $response = $gapicClient->getPrivateConnection($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.vmwareengine.v1.VmwareEngine/GetPrivateConnection', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getPrivateConnectionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - try { - $gapicClient->getPrivateConnection($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 getSubnetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $ipCidrRange = 'ipCidrRange-2049366326'; - $gatewayIp = 'gatewayIp955798786'; - $type = 'type3575610'; - $vlanId = 536153463; - $expectedResponse = new Subnet(); - $expectedResponse->setName($name2); - $expectedResponse->setIpCidrRange($ipCidrRange); - $expectedResponse->setGatewayIp($gatewayIp); - $expectedResponse->setType($type); - $expectedResponse->setVlanId($vlanId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); - $response = $gapicClient->getSubnet($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.vmwareengine.v1.VmwareEngine/GetSubnet', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSubnetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); - try { - $gapicClient->getSubnet($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 getVmwareEngineNetworkTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $etag = 'etag3123477'; - $expectedResponse = new VmwareEngineNetwork(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $response = $gapicClient->getVmwareEngineNetwork($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.vmwareengine.v1.VmwareEngine/GetVmwareEngineNetwork', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getVmwareEngineNetworkExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - try { - $gapicClient->getVmwareEngineNetwork($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 grantDnsBindPermissionTest() - { - $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/grantDnsBindPermissionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $expectedResponse = new DnsBindPermission(); - $expectedResponse->setName($name2); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/grantDnsBindPermissionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - $principal = new Principal(); - $response = $gapicClient->grantDnsBindPermission($formattedName, $principal); - $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.vmwareengine.v1.VmwareEngine/GrantDnsBindPermission', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualApiRequestObject->getPrincipal(); - $this->assertProtobufEquals($principal, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/grantDnsBindPermissionTest'); - $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 grantDnsBindPermissionExceptionTest() - { - $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/grantDnsBindPermissionTest'); - $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->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - $principal = new Principal(); - $response = $gapicClient->grantDnsBindPermission($formattedName, $principal); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/grantDnsBindPermissionTest'); - 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 listClustersTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $clustersElement = new Cluster(); - $clusters = [ - $clustersElement, - ]; - $expectedResponse = new ListClustersResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setClusters($clusters); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->listClusters($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getClusters()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListClusters', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listClustersExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->listClusters($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 listExternalAccessRulesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $externalAccessRulesElement = new ExternalAccessRule(); - $externalAccessRules = [ - $externalAccessRulesElement, - ]; - $expectedResponse = new ListExternalAccessRulesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setExternalAccessRules($externalAccessRules); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - $response = $gapicClient->listExternalAccessRules($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getExternalAccessRules()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListExternalAccessRules', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExternalAccessRulesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); - try { - $gapicClient->listExternalAccessRules($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 listExternalAddressesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $externalAddressesElement = new ExternalAddress(); - $externalAddresses = [ - $externalAddressesElement, - ]; - $expectedResponse = new ListExternalAddressesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setExternalAddresses($externalAddresses); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->listExternalAddresses($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getExternalAddresses()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListExternalAddresses', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExternalAddressesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->listExternalAddresses($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 listHcxActivationKeysTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $hcxActivationKeysElement = new HcxActivationKey(); - $hcxActivationKeys = [ - $hcxActivationKeysElement, - ]; - $expectedResponse = new ListHcxActivationKeysResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setHcxActivationKeys($hcxActivationKeys); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->listHcxActivationKeys($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getHcxActivationKeys()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListHcxActivationKeys', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listHcxActivationKeysExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->listHcxActivationKeys($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 listLoggingServersTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $loggingServersElement = new LoggingServer(); - $loggingServers = [ - $loggingServersElement, - ]; - $expectedResponse = new ListLoggingServersResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLoggingServers($loggingServers); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->listLoggingServers($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLoggingServers()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListLoggingServers', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLoggingServersExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->listLoggingServers($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 listManagementDnsZoneBindingsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $managementDnsZoneBindingsElement = new ManagementDnsZoneBinding(); - $managementDnsZoneBindings = [ - $managementDnsZoneBindingsElement, - ]; - $expectedResponse = new ListManagementDnsZoneBindingsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setManagementDnsZoneBindings($managementDnsZoneBindings); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->listManagementDnsZoneBindings($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getManagementDnsZoneBindings()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListManagementDnsZoneBindings', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listManagementDnsZoneBindingsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->listManagementDnsZoneBindings($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 listNetworkPeeringsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $networkPeeringsElement = new NetworkPeering(); - $networkPeerings = [ - $networkPeeringsElement, - ]; - $expectedResponse = new ListNetworkPeeringsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setNetworkPeerings($networkPeerings); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listNetworkPeerings($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNetworkPeerings()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNetworkPeerings', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNetworkPeeringsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listNetworkPeerings($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 listNetworkPoliciesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $networkPoliciesElement = new NetworkPolicy(); - $networkPolicies = [ - $networkPoliciesElement, - ]; - $expectedResponse = new ListNetworkPoliciesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setNetworkPolicies($networkPolicies); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listNetworkPolicies($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNetworkPolicies()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNetworkPolicies', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNetworkPoliciesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listNetworkPolicies($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 listNodeTypesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $nodeTypesElement = new NodeType(); - $nodeTypes = [ - $nodeTypesElement, - ]; - $expectedResponse = new ListNodeTypesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setNodeTypes($nodeTypes); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listNodeTypes($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNodeTypes()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNodeTypes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNodeTypesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listNodeTypes($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 listNodesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $nodesElement = new Node(); - $nodes = [ - $nodesElement, - ]; - $expectedResponse = new ListNodesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setNodes($nodes); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - $response = $gapicClient->listNodes($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNodes()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNodes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNodesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); - try { - $gapicClient->listNodes($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 listPeeringRoutesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $peeringRoutesElement = new PeeringRoute(); - $peeringRoutes = [ - $peeringRoutesElement, - ]; - $expectedResponse = new ListPeeringRoutesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setPeeringRoutes($peeringRoutes); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - $response = $gapicClient->listPeeringRoutes($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getPeeringRoutes()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPeeringRoutes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPeeringRoutesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); - try { - $gapicClient->listPeeringRoutes($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 listPrivateCloudsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $privateCloudsElement = new PrivateCloud(); - $privateClouds = [ - $privateCloudsElement, - ]; - $expectedResponse = new ListPrivateCloudsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setPrivateClouds($privateClouds); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listPrivateClouds($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getPrivateClouds()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateClouds', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPrivateCloudsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listPrivateClouds($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 listPrivateConnectionPeeringRoutesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $peeringRoutesElement = new PeeringRoute(); - $peeringRoutes = [ - $peeringRoutesElement, - ]; - $expectedResponse = new ListPrivateConnectionPeeringRoutesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setPeeringRoutes($peeringRoutes); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - $response = $gapicClient->listPrivateConnectionPeeringRoutes($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getPeeringRoutes()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateConnectionPeeringRoutes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPrivateConnectionPeeringRoutesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); - try { - $gapicClient->listPrivateConnectionPeeringRoutes($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 listPrivateConnectionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $privateConnectionsElement = new PrivateConnection(); - $privateConnections = [ - $privateConnectionsElement, - ]; - $expectedResponse = new ListPrivateConnectionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setPrivateConnections($privateConnections); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listPrivateConnections($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getPrivateConnections()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateConnections', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPrivateConnectionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listPrivateConnections($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 listSubnetsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $subnetsElement = new Subnet(); - $subnets = [ - $subnetsElement, - ]; - $expectedResponse = new ListSubnetsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSubnets($subnets); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->listSubnets($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSubnets()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListSubnets', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSubnetsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->listSubnets($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 listVmwareEngineNetworksTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $vmwareEngineNetworksElement = new VmwareEngineNetwork(); - $vmwareEngineNetworks = [ - $vmwareEngineNetworksElement, - ]; - $expectedResponse = new ListVmwareEngineNetworksResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setVmwareEngineNetworks($vmwareEngineNetworks); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listVmwareEngineNetworks($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getVmwareEngineNetworks()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListVmwareEngineNetworks', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listVmwareEngineNetworksExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listVmwareEngineNetworks($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 repairManagementDnsZoneBindingTest() - { - $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/repairManagementDnsZoneBindingTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $vpcNetwork = 'vpcNetwork-764161832'; - $uid = 'uid115792'; - $expectedResponse = new ManagementDnsZoneBinding(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setVpcNetwork($vpcNetwork); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/repairManagementDnsZoneBindingTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $response = $gapicClient->repairManagementDnsZoneBinding($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.vmwareengine.v1.VmwareEngine/RepairManagementDnsZoneBinding', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/repairManagementDnsZoneBindingTest'); - $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 repairManagementDnsZoneBindingExceptionTest() - { - $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/repairManagementDnsZoneBindingTest'); - $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->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); - $response = $gapicClient->repairManagementDnsZoneBinding($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/repairManagementDnsZoneBindingTest'); - 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 resetNsxCredentialsTest() - { - $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/resetNsxCredentialsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $expectedResponse = new PrivateCloud(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/resetNsxCredentialsTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->resetNsxCredentials($formattedPrivateCloud); - $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.vmwareengine.v1.VmwareEngine/ResetNsxCredentials', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getPrivateCloud(); - $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/resetNsxCredentialsTest'); - $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 resetNsxCredentialsExceptionTest() - { - $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/resetNsxCredentialsTest'); - $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 - $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->resetNsxCredentials($formattedPrivateCloud); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/resetNsxCredentialsTest'); - 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 resetVcenterCredentialsTest() - { - $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/resetVcenterCredentialsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $expectedResponse = new PrivateCloud(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/resetVcenterCredentialsTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->resetVcenterCredentials($formattedPrivateCloud); - $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.vmwareengine.v1.VmwareEngine/ResetVcenterCredentials', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getPrivateCloud(); - $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/resetVcenterCredentialsTest'); - $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 resetVcenterCredentialsExceptionTest() - { - $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/resetVcenterCredentialsTest'); - $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 - $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->resetVcenterCredentials($formattedPrivateCloud); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/resetVcenterCredentialsTest'); - 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 revokeDnsBindPermissionTest() - { - $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/revokeDnsBindPermissionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $expectedResponse = new DnsBindPermission(); - $expectedResponse->setName($name2); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/revokeDnsBindPermissionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - $principal = new Principal(); - $response = $gapicClient->revokeDnsBindPermission($formattedName, $principal); - $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.vmwareengine.v1.VmwareEngine/RevokeDnsBindPermission', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualApiRequestObject->getPrincipal(); - $this->assertProtobufEquals($principal, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/revokeDnsBindPermissionTest'); - $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 revokeDnsBindPermissionExceptionTest() - { - $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/revokeDnsBindPermissionTest'); - $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->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); - $principal = new Principal(); - $response = $gapicClient->revokeDnsBindPermission($formattedName, $principal); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/revokeDnsBindPermissionTest'); - 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 showNsxCredentialsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $username = 'username-265713450'; - $password = 'password1216985755'; - $expectedResponse = new Credentials(); - $expectedResponse->setUsername($username); - $expectedResponse->setPassword($password); - $transport->addResponse($expectedResponse); - // Mock request - $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->showNsxCredentials($formattedPrivateCloud); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ShowNsxCredentials', $actualFuncCall); - $actualValue = $actualRequestObject->getPrivateCloud(); - $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function showNsxCredentialsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->showNsxCredentials($formattedPrivateCloud); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function showVcenterCredentialsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $username2 = 'username2-1947551991'; - $password = 'password1216985755'; - $expectedResponse = new Credentials(); - $expectedResponse->setUsername($username2); - $expectedResponse->setPassword($password); - $transport->addResponse($expectedResponse); - // Mock request - $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->showVcenterCredentials($formattedPrivateCloud); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ShowVcenterCredentials', $actualFuncCall); - $actualValue = $actualRequestObject->getPrivateCloud(); - $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function showVcenterCredentialsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - try { - $gapicClient->showVcenterCredentials($formattedPrivateCloud); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function undeletePrivateCloudTest() - { - $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/undeletePrivateCloudTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $expectedResponse = new PrivateCloud(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/undeletePrivateCloudTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->undeletePrivateCloud($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.vmwareengine.v1.VmwareEngine/UndeletePrivateCloud', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/undeletePrivateCloudTest'); - $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 undeletePrivateCloudExceptionTest() - { - $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/undeletePrivateCloudTest'); - $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->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); - $response = $gapicClient->undeletePrivateCloud($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/undeletePrivateCloudTest'); - 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 updateClusterTest() - { - $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/updateClusterTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $management = false; - $uid = 'uid115792'; - $expectedResponse = new Cluster(); - $expectedResponse->setName($name); - $expectedResponse->setManagement($management); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateClusterTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $updateMask = new FieldMask(); - $cluster = new Cluster(); - $nodeTypeConfigsValue = new NodeTypeConfig(); - $valueNodeCount = 1174748740; - $nodeTypeConfigsValue->setNodeCount($valueNodeCount); - $clusterNodeTypeConfigs = [ - 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, - ]; - $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); - $response = $gapicClient->updateCluster($updateMask, $cluster); - $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.vmwareengine.v1.VmwareEngine/UpdateCluster', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualApiRequestObject->getCluster(); - $this->assertProtobufEquals($cluster, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateClusterTest'); - $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 updateClusterExceptionTest() - { - $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/updateClusterTest'); - $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(); - $cluster = new Cluster(); - $nodeTypeConfigsValue = new NodeTypeConfig(); - $valueNodeCount = 1174748740; - $nodeTypeConfigsValue->setNodeCount($valueNodeCount); - $clusterNodeTypeConfigs = [ - 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, - ]; - $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); - $response = $gapicClient->updateCluster($updateMask, $cluster); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateClusterTest'); - 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 updateDnsForwardingTest() - { - $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/updateDnsForwardingTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $expectedResponse = new DnsForwarding(); - $expectedResponse->setName($name); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateDnsForwardingTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $dnsForwarding = new DnsForwarding(); - $dnsForwardingForwardingRules = []; - $dnsForwarding->setForwardingRules($dnsForwardingForwardingRules); - $updateMask = new FieldMask(); - $response = $gapicClient->updateDnsForwarding($dnsForwarding, $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.vmwareengine.v1.VmwareEngine/UpdateDnsForwarding', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDnsForwarding(); - $this->assertProtobufEquals($dnsForwarding, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDnsForwardingTest'); - $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 updateDnsForwardingExceptionTest() - { - $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/updateDnsForwardingTest'); - $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 - $dnsForwarding = new DnsForwarding(); - $dnsForwardingForwardingRules = []; - $dnsForwarding->setForwardingRules($dnsForwardingForwardingRules); - $updateMask = new FieldMask(); - $response = $gapicClient->updateDnsForwarding($dnsForwarding, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDnsForwardingTest'); - 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 updateExternalAccessRuleTest() - { - $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/updateExternalAccessRuleTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $priority = 1165461084; - $ipProtocol = 'ipProtocol-1134653776'; - $uid = 'uid115792'; - $expectedResponse = new ExternalAccessRule(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setPriority($priority); - $expectedResponse->setIpProtocol($ipProtocol); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateExternalAccessRuleTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $updateMask = new FieldMask(); - $externalAccessRule = new ExternalAccessRule(); - $response = $gapicClient->updateExternalAccessRule($updateMask, $externalAccessRule); - $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.vmwareengine.v1.VmwareEngine/UpdateExternalAccessRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualApiRequestObject->getExternalAccessRule(); - $this->assertProtobufEquals($externalAccessRule, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateExternalAccessRuleTest'); - $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 updateExternalAccessRuleExceptionTest() - { - $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/updateExternalAccessRuleTest'); - $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(); - $externalAccessRule = new ExternalAccessRule(); - $response = $gapicClient->updateExternalAccessRule($updateMask, $externalAccessRule); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateExternalAccessRuleTest'); - 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 updateExternalAddressTest() - { - $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/updateExternalAddressTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $internalIp = 'internalIp-2080778775'; - $externalIp = 'externalIp-1153075685'; - $uid = 'uid115792'; - $description = 'description-1724546052'; - $expectedResponse = new ExternalAddress(); - $expectedResponse->setName($name); - $expectedResponse->setInternalIp($internalIp); - $expectedResponse->setExternalIp($externalIp); - $expectedResponse->setUid($uid); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateExternalAddressTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $updateMask = new FieldMask(); - $externalAddress = new ExternalAddress(); - $response = $gapicClient->updateExternalAddress($updateMask, $externalAddress); - $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.vmwareengine.v1.VmwareEngine/UpdateExternalAddress', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualApiRequestObject->getExternalAddress(); - $this->assertProtobufEquals($externalAddress, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateExternalAddressTest'); - $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 updateExternalAddressExceptionTest() - { - $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/updateExternalAddressTest'); - $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(); - $externalAddress = new ExternalAddress(); - $response = $gapicClient->updateExternalAddress($updateMask, $externalAddress); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateExternalAddressTest'); - 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 updateLoggingServerTest() - { - $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/updateLoggingServerTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $hostname = 'hostname-299803597'; - $port = 3446913; - $uid = 'uid115792'; - $expectedResponse = new LoggingServer(); - $expectedResponse->setName($name); - $expectedResponse->setHostname($hostname); - $expectedResponse->setPort($port); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateLoggingServerTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $updateMask = new FieldMask(); - $loggingServer = new LoggingServer(); - $loggingServerHostname = 'loggingServerHostname2082652629'; - $loggingServer->setHostname($loggingServerHostname); - $loggingServerPort = 243392733; - $loggingServer->setPort($loggingServerPort); - $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; - $loggingServer->setProtocol($loggingServerProtocol); - $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; - $loggingServer->setSourceType($loggingServerSourceType); - $response = $gapicClient->updateLoggingServer($updateMask, $loggingServer); - $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.vmwareengine.v1.VmwareEngine/UpdateLoggingServer', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualApiRequestObject->getLoggingServer(); - $this->assertProtobufEquals($loggingServer, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateLoggingServerTest'); - $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 updateLoggingServerExceptionTest() - { - $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/updateLoggingServerTest'); - $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(); - $loggingServer = new LoggingServer(); - $loggingServerHostname = 'loggingServerHostname2082652629'; - $loggingServer->setHostname($loggingServerHostname); - $loggingServerPort = 243392733; - $loggingServer->setPort($loggingServerPort); - $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; - $loggingServer->setProtocol($loggingServerProtocol); - $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; - $loggingServer->setSourceType($loggingServerSourceType); - $response = $gapicClient->updateLoggingServer($updateMask, $loggingServer); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateLoggingServerTest'); - 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 updateManagementDnsZoneBindingTest() - { - $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/updateManagementDnsZoneBindingTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $vpcNetwork = 'vpcNetwork-764161832'; - $uid = 'uid115792'; - $expectedResponse = new ManagementDnsZoneBinding(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setVpcNetwork($vpcNetwork); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateManagementDnsZoneBindingTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $updateMask = new FieldMask(); - $managementDnsZoneBinding = new ManagementDnsZoneBinding(); - $response = $gapicClient->updateManagementDnsZoneBinding($updateMask, $managementDnsZoneBinding); - $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.vmwareengine.v1.VmwareEngine/UpdateManagementDnsZoneBinding', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualApiRequestObject->getManagementDnsZoneBinding(); - $this->assertProtobufEquals($managementDnsZoneBinding, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateManagementDnsZoneBindingTest'); - $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 updateManagementDnsZoneBindingExceptionTest() - { - $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/updateManagementDnsZoneBindingTest'); - $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(); - $managementDnsZoneBinding = new ManagementDnsZoneBinding(); - $response = $gapicClient->updateManagementDnsZoneBinding($updateMask, $managementDnsZoneBinding); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateManagementDnsZoneBindingTest'); - 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 updateNetworkPeeringTest() - { - $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/updateNetworkPeeringTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $peerNetwork = 'peerNetwork2111238225'; - $exportCustomRoutes = false; - $importCustomRoutes = true; - $exchangeSubnetRoutes = true; - $exportCustomRoutesWithPublicIp = true; - $importCustomRoutesWithPublicIp = false; - $stateDetails = 'stateDetails632437908'; - $peerMtu = 69584721; - $uid = 'uid115792'; - $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; - $description = 'description-1724546052'; - $expectedResponse = new NetworkPeering(); - $expectedResponse->setName($name); - $expectedResponse->setPeerNetwork($peerNetwork); - $expectedResponse->setExportCustomRoutes($exportCustomRoutes); - $expectedResponse->setImportCustomRoutes($importCustomRoutes); - $expectedResponse->setExchangeSubnetRoutes($exchangeSubnetRoutes); - $expectedResponse->setExportCustomRoutesWithPublicIp($exportCustomRoutesWithPublicIp); - $expectedResponse->setImportCustomRoutesWithPublicIp($importCustomRoutesWithPublicIp); - $expectedResponse->setStateDetails($stateDetails); - $expectedResponse->setPeerMtu($peerMtu); - $expectedResponse->setUid($uid); - $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateNetworkPeeringTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkPeering = new NetworkPeering(); - $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; - $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); - $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; - $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); - $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); - $updateMask = new FieldMask(); - $response = $gapicClient->updateNetworkPeering($networkPeering, $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.vmwareengine.v1.VmwareEngine/UpdateNetworkPeering', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkPeering(); - $this->assertProtobufEquals($networkPeering, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateNetworkPeeringTest'); - $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 updateNetworkPeeringExceptionTest() - { - $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/updateNetworkPeeringTest'); - $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 - $networkPeering = new NetworkPeering(); - $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; - $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); - $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; - $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); - $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); - $updateMask = new FieldMask(); - $response = $gapicClient->updateNetworkPeering($networkPeering, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateNetworkPeeringTest'); - 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 updateNetworkPolicyTest() - { - $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/updateNetworkPolicyTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $edgeServicesCidr = 'edgeServicesCidr-792872013'; - $uid = 'uid115792'; - $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; - $description = 'description-1724546052'; - $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; - $expectedResponse = new NetworkPolicy(); - $expectedResponse->setName($name); - $expectedResponse->setEdgeServicesCidr($edgeServicesCidr); - $expectedResponse->setUid($uid); - $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); - $expectedResponse->setDescription($description); - $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateNetworkPolicyTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkPolicy = new NetworkPolicy(); - $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; - $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); - $updateMask = new FieldMask(); - $response = $gapicClient->updateNetworkPolicy($networkPolicy, $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.vmwareengine.v1.VmwareEngine/UpdateNetworkPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkPolicy(); - $this->assertProtobufEquals($networkPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateNetworkPolicyTest'); - $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 updateNetworkPolicyExceptionTest() - { - $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/updateNetworkPolicyTest'); - $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 - $networkPolicy = new NetworkPolicy(); - $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; - $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); - $updateMask = new FieldMask(); - $response = $gapicClient->updateNetworkPolicy($networkPolicy, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateNetworkPolicyTest'); - 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 updatePrivateCloudTest() - { - $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/updatePrivateCloudTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $expectedResponse = new PrivateCloud(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updatePrivateCloudTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $privateCloud = new PrivateCloud(); - $privateCloudNetworkConfig = new NetworkConfig(); - $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; - $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); - $privateCloud->setNetworkConfig($privateCloudNetworkConfig); - $privateCloudManagementCluster = new ManagementCluster(); - $managementClusterClusterId = 'managementClusterClusterId311493182'; - $privateCloudManagementCluster->setClusterId($managementClusterClusterId); - $nodeTypeConfigsValue = new NodeTypeConfig(); - $valueNodeCount = 1174748740; - $nodeTypeConfigsValue->setNodeCount($valueNodeCount); - $managementClusterNodeTypeConfigs = [ - 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, - ]; - $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); - $privateCloud->setManagementCluster($privateCloudManagementCluster); - $updateMask = new FieldMask(); - $response = $gapicClient->updatePrivateCloud($privateCloud, $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.vmwareengine.v1.VmwareEngine/UpdatePrivateCloud', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getPrivateCloud(); - $this->assertProtobufEquals($privateCloud, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updatePrivateCloudTest'); - $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 updatePrivateCloudExceptionTest() - { - $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/updatePrivateCloudTest'); - $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 - $privateCloud = new PrivateCloud(); - $privateCloudNetworkConfig = new NetworkConfig(); - $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; - $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); - $privateCloud->setNetworkConfig($privateCloudNetworkConfig); - $privateCloudManagementCluster = new ManagementCluster(); - $managementClusterClusterId = 'managementClusterClusterId311493182'; - $privateCloudManagementCluster->setClusterId($managementClusterClusterId); - $nodeTypeConfigsValue = new NodeTypeConfig(); - $valueNodeCount = 1174748740; - $nodeTypeConfigsValue->setNodeCount($valueNodeCount); - $managementClusterNodeTypeConfigs = [ - 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, - ]; - $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); - $privateCloud->setManagementCluster($privateCloudManagementCluster); - $updateMask = new FieldMask(); - $response = $gapicClient->updatePrivateCloud($privateCloud, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updatePrivateCloudTest'); - 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 updatePrivateConnectionTest() - { - $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/updatePrivateConnectionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; - $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; - $peeringId = 'peeringId-1561749894'; - $uid = 'uid115792'; - $serviceNetwork = 'serviceNetwork1072775844'; - $expectedResponse = new PrivateConnection(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); - $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); - $expectedResponse->setPeeringId($peeringId); - $expectedResponse->setUid($uid); - $expectedResponse->setServiceNetwork($serviceNetwork); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updatePrivateConnectionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $privateConnection = new PrivateConnection(); - $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); - $privateConnectionType = Type::TYPE_UNSPECIFIED; - $privateConnection->setType($privateConnectionType); - $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); - $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); - $updateMask = new FieldMask(); - $response = $gapicClient->updatePrivateConnection($privateConnection, $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.vmwareengine.v1.VmwareEngine/UpdatePrivateConnection', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getPrivateConnection(); - $this->assertProtobufEquals($privateConnection, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updatePrivateConnectionTest'); - $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 updatePrivateConnectionExceptionTest() - { - $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/updatePrivateConnectionTest'); - $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 - $privateConnection = new PrivateConnection(); - $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); - $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); - $privateConnectionType = Type::TYPE_UNSPECIFIED; - $privateConnection->setType($privateConnectionType); - $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); - $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); - $updateMask = new FieldMask(); - $response = $gapicClient->updatePrivateConnection($privateConnection, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updatePrivateConnectionTest'); - 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 updateSubnetTest() - { - $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/updateSubnetTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $ipCidrRange = 'ipCidrRange-2049366326'; - $gatewayIp = 'gatewayIp955798786'; - $type = 'type3575610'; - $vlanId = 536153463; - $expectedResponse = new Subnet(); - $expectedResponse->setName($name); - $expectedResponse->setIpCidrRange($ipCidrRange); - $expectedResponse->setGatewayIp($gatewayIp); - $expectedResponse->setType($type); - $expectedResponse->setVlanId($vlanId); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateSubnetTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $updateMask = new FieldMask(); - $subnet = new Subnet(); - $response = $gapicClient->updateSubnet($updateMask, $subnet); - $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.vmwareengine.v1.VmwareEngine/UpdateSubnet', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualApiRequestObject->getSubnet(); - $this->assertProtobufEquals($subnet, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateSubnetTest'); - $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 updateSubnetExceptionTest() - { - $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/updateSubnetTest'); - $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(); - $subnet = new Subnet(); - $response = $gapicClient->updateSubnet($updateMask, $subnet); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateSubnetTest'); - 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 updateVmwareEngineNetworkTest() - { - $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/updateVmwareEngineNetworkTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $uid = 'uid115792'; - $etag = 'etag3123477'; - $expectedResponse = new VmwareEngineNetwork(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setUid($uid); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateVmwareEngineNetworkTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $vmwareEngineNetwork = new VmwareEngineNetwork(); - $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; - $vmwareEngineNetwork->setType($vmwareEngineNetworkType); - $updateMask = new FieldMask(); - $response = $gapicClient->updateVmwareEngineNetwork($vmwareEngineNetwork, $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.vmwareengine.v1.VmwareEngine/UpdateVmwareEngineNetwork', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getVmwareEngineNetwork(); - $this->assertProtobufEquals($vmwareEngineNetwork, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateVmwareEngineNetworkTest'); - $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 updateVmwareEngineNetworkExceptionTest() - { - $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/updateVmwareEngineNetworkTest'); - $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 - $vmwareEngineNetwork = new VmwareEngineNetwork(); - $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; - $vmwareEngineNetwork->setType($vmwareEngineNetworkType); - $updateMask = new FieldMask(); - $response = $gapicClient->updateVmwareEngineNetwork($vmwareEngineNetwork, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateVmwareEngineNetworkTest'); - 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()); - } -}